1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class ListeTicket : System.Web.UI.UserControl
{
public string Tech,Etat;
protected void Page_Load(object sender, EventArgs e)
{
cmTicket MonTicket = new cmTicket();
if (Etat == "O")
{
if (Tech == "all")
{
GV_LISTETIC.DataSource = MonTicket.ListeTicketEnCours();
}
}
else
{
if (Tech == "all")
{
GV_LISTETIC.DataSource = MonTicket.ListeTicket();
}
}
GV_LISTETIC.DataBind();
MonTicket.FermerConnexion();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
cmTicket monTicket = new cmTicket();
e.Row.Cells[6].Text = "<b>" + monTicket.NbSuivi(int.Parse(e.Row.Cells[1].Text)) + "</b>";
if (GV_LISTETIC.Columns[5].Visible)
{
string Resp = e.Row.Cells[5].Text;
if (Resp == "-1")
{
e.Row.Cells[5].Text = "<b>Non Attribué!</b>";
}
if (monTicket.GetResp(int.Parse(e.Row.Cells[1].Text)) == "-1")
{
e.Row.Cells[1].Text = "<img src='img/warning.gif' alt='Aucun responsable pour ce ticket!'> " + e.Row.Cells[1].Text;
}
}
else
{
if (monTicket.GetResp(int.Parse(e.Row.Cells[1].Text)) == "-1")
{
e.Row.Cells[1].Text = "<img src='img/warning.gif' alt='Aucun responsable pour ce ticket!'> " + e.Row.Cells[1].Text;
}
}
string Desc = e.Row.Cells[3].Text;
if (Desc.Length > 150)
{
e.Row.Cells[3].Text = Desc.Substring(0, 150) + "...";
}
e.Row.BackColor = GetColor(e.Row.Cells[0].Text);
e.Row.Cells[7].BackColor = GetColor(e.Row.Cells[0].Text);
}
}
protected Color GetColor(string color)
{
int R = int.Parse(color.Substring(1, 2), System.Globalization.NumberStyles.HexNumber);
int G = int.Parse(color.Substring(3, 2), System.Globalization.NumberStyles.HexNumber);
int B = int.Parse(color.Substring(5, 2), System.Globalization.NumberStyles.HexNumber);
Color Ocolor = Color.FromArgb(R, G, B);
return Ocolor;
}
protected void GV_LISTETIC_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GV_LISTETIC.PageIndex = e.NewPageIndex;
GV_LISTETIC.DataBind();
}
protected void GV_LISTETIC_DataBound(object sender, EventArgs e)
{
GV_LISTETIC.Columns[0].Visible = false;
GV_LISTETIC.Columns[7].ItemStyle.BackColor = Color.Gainsboro;
}
} |
Partager