protected void NodesGrid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "Alive") { if (e.GetValue("Alive").ToString() == "Yes") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (e.GetValue("isDisabled").ToString() == "Yes") { e.Cell.BackColor = System.Drawing.Color.Gray; e.Cell.Text = "DISABLED"; } else { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } } if (e.DataColumn.FieldName == "isDisabled") { if (e.GetValue("isDisabled").ToString() == "No") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } } }
protected void ASPxgvTargets_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.GetValue("Year") == null) { return; } if ((int)(e.GetValue("Year")) < DateTime.Today.Year) { e.Cell.Attributes.Add("onclick", "event.cancelBubble = true"); } }
protected void ASPxGridViewActiveUser_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName.Equals("IsActive")) { if (!CommonMethods.ParseBool(e.GetValue("IsActive"))) { e.Cell.BackColor = Color.Tomato; } else if (CommonMethods.ParseBool(e.GetValue("IsActive"))) { e.Cell.BackColor = Color.LightGreen; } } }
protected void grdTraining_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { try { if (e.DataColumn.FieldName == "id") { ASPxLabel lblTime = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblTime") as ASPxLabel; lblTime.Text = objTraining.GetTraining(Int32.Parse(e.CellValue.ToString())).fromdate.ToShortDateString() + " -" + objTraining.GetTraining(Int32.Parse(e.CellValue.ToString())).todate.ToShortDateString(); } if (e.DataColumn.FieldName == "employeeid") { ASPxLabel lblEmp = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblEmp") as ASPxLabel; lblEmp.Text = objEmployees.GetEmployees(Int32.Parse(e.CellValue.ToString())).fullname; } if (e.DataColumn.FieldName == "decision") { ASPxHyperLink hyperDowload = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hyperDowload") as ASPxHyperLink; ASPxImage imgFile = grdTraining.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "imgFile") as ASPxImage; hyperDowload.Text = e.CellValue.ToString(); if (e.GetValue("fileKem").ToString().Trim() != "") { imgFile.ImageUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/imgadmin/file.png"; hyperDowload.NavigateUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/FileQD/" + e.GetValue("fileKem").ToString(); } else { imgFile.Visible = false; } } } catch { } }
protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { string status = e.GetValue("Status").ToString(); if (e.DataColumn.FieldName == "")//|| e.DataColumn.Caption="") { if (status == "OK" || status == "Scanning") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (status == "Not Responding") { e.Cell.BackColor = System.Drawing.Color.Red; } else if (status == "Not Scanned") { e.Cell.BackColor = System.Drawing.Color.FromName("#87CEEB"); } else if (status == "disabled") { e.Cell.BackColor = System.Drawing.Color.Gray; } else if (status == "Maintenance") { e.Cell.BackColor = System.Drawing.Color.LightBlue; } else if (e.DataColumn.FieldName == "") { e.Cell.BackColor = System.Drawing.Color.Yellow; } } }
protected void grid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "luongcb") { ASPxLabel lbl_LuongCB = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_LuongCB") as ASPxLabel; lbl_LuongCB.Text = InsertSymbol(e.CellValue.ToString()); } if (e.DataColumn.FieldName == "thoidiem") { ASPxLabel lbl_thoidiem = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_thoidiem") as ASPxLabel; lbl_thoidiem.Text = string.Format("{0:dd/MM/yyyy}", e.CellValue); } if (e.DataColumn.FieldName == "soqd") { ASPxHyperLink hyperDowload = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hyperDowload") as ASPxHyperLink; ASPxImage imgFile = grid.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "imgFile") as ASPxImage; hyperDowload.Text = e.CellValue.ToString(); if (e.GetValue("fileKem").ToString().Trim() != "") { imgFile.ImageUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/imgadmin/file.png"; hyperDowload.NavigateUrl = DotNetNuke.Common.Globals.ApplicationPath + "/images/FileQD/" + e.GetValue("fileKem").ToString(); } else { imgFile.Visible = false; } } }
protected void SharePointTimerJobsGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "Status") { if (e.GetValue("Status").ToString() == "Failed") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.GetValue("Status").ToString() == "Issue") { e.Cell.BackColor = System.Drawing.Color.Yellow; } else { e.Cell.BackColor = System.Drawing.Color.LightGreen; } } }
protected void CPUMemGrid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { int memVal = 0; int memTVal = 0; int cpuVal = 0; int cpuTVal = 0; if (e.DataColumn.FieldName == "memdisp") { memVal = Convert.ToInt32(e.GetValue("memory")); memTVal = Convert.ToInt32(e.GetValue("Memory_Threshold")); e.Cell.ForeColor = (memVal >= 0 && memVal < (memTVal * 0.4) ? Color.Green : (memVal >= (memTVal * 0.4) && memVal < memTVal ? Color.Orange : Color.Red)); } if (e.DataColumn.FieldName == "cpudisp") { cpuVal = Convert.ToInt32(e.GetValue("cpu")); cpuTVal = Convert.ToInt32(e.GetValue("CPU_Threshold")); e.Cell.ForeColor = (cpuVal >= 0 && cpuVal < (cpuTVal * 0.4) ? Color.Green : (cpuVal >= (cpuTVal * 0.4) && cpuVal < cpuTVal ? Color.Orange : Color.Red)); } }
protected void grid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.Caption != "ตำแหน่ง") return; String POS_NAME = e.GetValue("POS_NAME").ToString(); if (POS_NAME == LastPosName) { //e.Cell //DevExpress.Web.ASPxGridView.Rendering.GridViewTableDataCell dataCell= //grid_SMM_JD_SUB_GROUP4.GetDataRow(e.) e.Cell.Style["border-top"] = "none"; } }
/// <summary> /// Grid view hteml data cell prepared event handler /// Used to customize place a line through to do item displayed or removie it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName.Equals("ToDoItem")) { var strikethrough = Convert.ToBoolean(e.GetValue("ToDoItemStrikeThough")); var key = Convert.ToInt32(e.GetValue("ToDoItemId")); var lbl = gridView.FindRowCellTemplateControl(e.VisibleIndex, gridView.Columns["colToDoItem"] as GridViewDataColumn, "lblTodo") as ASPxLabel; if (lbl != null) { if (strikethrough) { lbl.Style["text-decoration"] = "line-through"; } else { lbl.Style["text-decoration"] = "none"; } } } }
protected void gridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.Name != "ImageColumn") { return; } var iconIdValue = e.GetValue("FullIconID"); if (iconIdValue != null && iconIdValue.ToString().Contains("_svg_white")) { e.Cell.BackColor = System.Drawing.Color.LightGray; } }
protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { int TonToiThieu = 0, QTyinstock = 0, TonMax = 0; if (e.DataColumn.FieldName == "TonToiThieu") { Session["min"] = e.GetValue("TonToiThieu").ToString(); } if (e.DataColumn.FieldName == "TonMax") { Session["max"] = e.GetValue("TonMax").ToString(); } if (e.DataColumn.FieldName == "QTyinstock") { try { Int32.TryParse(Session["min"].ToString(), out TonToiThieu); Int32.TryParse(Session["max"].ToString(), out TonMax); } catch (Exception) { } QTyinstock = Convert.ToInt32(e.CellValue); if (TonToiThieu > QTyinstock) { e.Cell.BackColor = System.Drawing.Color.Yellow; e.Cell.ForeColor = System.Drawing.Color.Red; e.Cell.Font.Bold = true; } if (QTyinstock > TonMax) { e.Cell.BackColor = System.Drawing.Color.LightCyan; e.Cell.ForeColor = System.Drawing.Color.Blue; e.Cell.Font.Bold = true; } } }
protected void gridThongKeDSBaoHiem_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "Id") { ASPxLabel lbl_STT = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_STT") as ASPxLabel; lbl_STT.Text = nSTT++ + ""; } if (e.DataColumn.FieldName == "tienLuong") { int n = e.VisibleIndex; ASPxLabel lbl_heSoLuong = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_heSoLuong") as ASPxLabel; ASPxLabel lbl_heSoCV = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_heSoCV") as ASPxLabel; lbl_heSoLuong.Text = e.CellValue.ToString(); lbl_heSoCV.Text = e.GetValue("phuCapCV").ToString(); } if (e.DataColumn.FieldName == "NLD_BHXH") { ASPxLabel lbl_nldBHXH = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_nldBHXH") as ASPxLabel; ASPxLabel lbl_nsdldBHXH = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_nsdldBHXH") as ASPxLabel; lbl_nldBHXH.Text = e.CellValue.ToString(); lbl_nsdldBHXH.Text = e.GetValue("NSDLD_BHXH").ToString(); } if (e.DataColumn.FieldName == "NLD_BHYT") { ASPxLabel lbl_nldBHYT = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_nldBHYT") as ASPxLabel; ASPxLabel lbl_nsdldBHYT = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_nsdldBHYT") as ASPxLabel; lbl_nldBHYT.Text = e.CellValue.ToString(); lbl_nsdldBHYT.Text = e.GetValue("NSDLD_BHYT").ToString(); } if (e.DataColumn.FieldName == "NLD_BHTN") { ASPxLabel lbl_nldBHTN = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_nldBHTN") as ASPxLabel; ASPxLabel lbl_nsdldBHTN = gridThongKeDSBaoHiem.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_nsdldBHTN") as ASPxLabel; lbl_nldBHTN.Text = e.CellValue.ToString(); lbl_nsdldBHTN.Text = e.GetValue("NSDLD_BHTN").ToString(); } }
protected void DAGMembersGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName != "ServerName" && (e.CellValue.ToString() == "Pass" || e.CellValue.ToString() == "Passed")) { e.Cell.BackColor = System.Drawing.Color.LightGreen; } //7/29/2014 NS modified //else if (e.DataColumn.FieldName != "ServerName" && (e.CellValue.ToString() == "Fail" || e.CellValue.ToString() == "Failed")) else if (e.DataColumn.FieldName != "ServerName" && ((e.CellValue.ToString()).ToUpper()).Contains("FAIL")) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } string status = ""; status = e.GetValue("Status").ToString(); if (e.DataColumn.FieldName == "Status" && (e.CellValue.ToString() == "OK" || e.CellValue.ToString() == "Scanning" || e.CellValue.ToString() == "Telnet")) { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (e.DataColumn.FieldName == "Status" && e.CellValue.ToString() == "Not Responding") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.DataColumn.FieldName == "Status" && e.CellValue.ToString() == "Not Scanned") { e.Cell.BackColor = System.Drawing.Color.Blue; e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.DataColumn.FieldName == "Status" && e.CellValue.ToString() == "Disabled") { e.Cell.BackColor = System.Drawing.Color.FromName("#D0D0D0"); //e.Cell.BackColor = System.Drawing.Color.Gray; // e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.DataColumn.FieldName == "Status" && e.CellValue.ToString() == "Issue") { e.Cell.BackColor = System.Drawing.Color.Yellow; } else if (e.DataColumn.FieldName == "Status") { e.Cell.BackColor = System.Drawing.Color.Yellow; // e.DataColumn.GroupFooterCellStyle.ForeColor = System.Drawing.Color.Yellow; } }
protected void ActivPrefGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { int n = 0; bool isNumeric = false; string dbname = ""; dbname = e.GetValue("DatabaseName").ToString(); isNumeric = int.TryParse(e.DataColumn.FieldName, out n); DataRow[] dr = dtactive.Select("DatabaseName like '" + dbname + "'"); DataRow[] drh = dthealth.Select("DatabaseName like '" + dbname + "'"); if (e.DataColumn.FieldName != "DatabaseName" && dr[0][e.DataColumn.FieldName].ToString() == "Active") { if (drh[0][e.DataColumn.FieldName].ToString() == "Healthy") { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#2F9C02"); e.Cell.ForeColor = System.Drawing.Color.Black; } else { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.Black; } } else if (e.DataColumn.FieldName != "DatabaseName" && dr[0][e.DataColumn.FieldName].ToString() == "Passive") { if (drh[0][e.DataColumn.FieldName].ToString() == "Healthy") { if (e.DataColumn.FieldName == "1") { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f200"); e.Cell.ForeColor = System.Drawing.Color.Black; } else { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#90D175"); e.Cell.ForeColor = System.Drawing.Color.Black; } } else { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.Black; } } }
protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.VisibleIndex < 0) { return; } string item_type = e.GetValue("ITEM_TYPE").ToString(); //需要扫描的零件在零件号这一列显示洋红色 if (e.DataColumn.FieldName.ToString() == "COMP") { if (item_type == "A" || item_type == "B") { e.Cell.BackColor = System.Drawing.Color.Magenta; } return; } }
protected void servicesGrid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { string[] notAlwaysRunning = new string[] { "Daily Service", "DB Health" }; string[] OnlyPrimary = new String[] { "DB Health", "Alerting" }; string s = e.GetValue("IsPrimaryNode").ToString(); if (e.DataColumn.FieldName != "") { if (OnlyPrimary.Contains(e.DataColumn.FieldName) && e.GetValue("IsPrimaryNode").ToString() == "False") { //3/4/2016 NS modified for VSPLUS-2687 e.Cell.BackColor = System.Drawing.Color.LightGray; e.Cell.Text = "N/A"; } else { if (e.GetValue(e.DataColumn.FieldName) == null || e.GetValue(e.DataColumn.FieldName).ToString() == "" || e.GetValue(e.DataColumn.FieldName).ToString() == "0") { e.Cell.Text = "Not Found"; } if (notAlwaysRunning.Contains(e.DataColumn.FieldName) && e.Cell.Text != "Not Found" && e.GetValue("Alive").ToString() == "Yes") { //3/4/2016 NS modified for VSPLUS-2687 e.Cell.BackColor = System.Drawing.Color.LightGray; return; } if (e.GetValue("Alive").ToString() == "No") { //3/4/2016 NS modified for VSPLUS-2687 e.Cell.BackColor = System.Drawing.Color.LightGray; e.Cell.Text = "N/A"; } else if (e.GetValue(e.DataColumn.FieldName).ToString() == "Running") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } } } }
protected void gridThanhVien_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.Caption == "Cấp/xóa tài khoản") { LinkButton linkTaiKhoan = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "linkTaiKhoan") as LinkButton; if (linkTaiKhoan != null) { string username = e.GetValue("ma_thanhvien").ToString(); if (!IsUserExisted(username)) { linkTaiKhoan.Text = "Cấp"; linkTaiKhoan.OnClientClick = "taikhoan_nhanvien(0,'" + e.GetValue("ma_thanhvien") + ";" + e.GetValue("ten_thanhvien") + "');return false;"; } else { linkTaiKhoan.Text = "Xóa"; linkTaiKhoan.OnClientClick = "taikhoan_nhanvien(1,'" + e.GetValue("ma_thanhvien") + "');return false;"; } } } else if (e.DataColumn.Caption == "Mật khẩu") { LinkButton linkMatkhau = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "linkMatkhau") as LinkButton; if (linkMatkhau != null) { linkMatkhau.Text = "Phục hồi"; linkMatkhau.OnClientClick = "taikhoan_nhanvien(2,'" + e.GetValue("ma_thanhvien") + "');return false;"; } } else if (e.DataColumn.Caption == "Cấp quyền") { LinkButton linkCapQuyen = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "linkCapQuyen") as LinkButton; if (linkCapQuyen != null) { linkCapQuyen.Text = "Cấp"; linkCapQuyen.OnClientClick = "capquyen_taikhoan('" + e.GetValue("ma_thanhvien") + "');return false;"; } } else if (e.DataColumn.Caption == "Hủy thành viên") { LinkButton linkHuyThanhVien = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "linkHuyThanhVien") as LinkButton; if (linkHuyThanhVien != null) { linkHuyThanhVien.Text = "Hủy thành viên"; linkHuyThanhVien.OnClientClick = "taikhoan_nhanvien(3,'" + e.GetValue("ma_thanhvien") + "');return false;"; } } }
protected void FarmGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { string col = e.DataColumn.FieldName; if (!(col == "LogOnTest" || col == "UploadTest" || col == "SiteCollectionTest")) { return; } string status = e.GetValue(col).ToString(); if ((status.ToUpper()).Contains("FAIL")) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (status.ToUpper() == "PASS") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } }
protected void DAGGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { string status = ""; status = e.GetValue("Status").ToString(); switch (e.DataColumn.FieldName) { case "Status": if ((status.ToUpper()).Contains("FAIL")) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (status.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } else if (status.ToUpper() == "OK" || status.ToUpper() == "PASS" || status.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; } }
protected void DominoHealthGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "Status" && e.GetValue("Status").ToString() == "Not Responding") { //e.DataColumn.CellStyle.CssClass = "GridCss3"; e.Cell.CssClass = "GridCss3"; } //6/10/2013 NS modified - added Telnet status if (e.DataColumn.FieldName == "Status" && e.GetValue("Status").ToString() == "OK" || e.GetValue("Status").ToString() == "Scanning") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (e.DataColumn.FieldName == "Status" && e.GetValue("Status").ToString() == "Not Responding") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; //e.DataColumn.CellStyle.CssClass = "GridCss3"; } else if (e.DataColumn.FieldName == "Status" && e.GetValue("Status").ToString() == "Not Scanned") { e.Cell.BackColor = System.Drawing.Color.FromName("#87CEEB"); e.Cell.ForeColor = System.Drawing.Color.Black; } //3/1/2013 NS modified the value of text below - lower case disabled did not match the returned status with capital D else if (e.DataColumn.FieldName == "Status" && e.GetValue("Status").ToString() == "Disabled") { e.Cell.BackColor = System.Drawing.Color.FromName("#C8C8C8"); // e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.DataColumn.FieldName == "Status" && e.GetValue("Status").ToString() == "Maintenance") { e.Cell.BackColor = System.Drawing.Color.LightBlue; } else if (e.DataColumn.FieldName == "Status") { e.Cell.BackColor = System.Drawing.Color.Yellow; // e.DataColumn.GroupFooterCellStyle.ForeColor = System.Drawing.Color.Yellow; } }
protected void DiskHealthGrid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { string thresholdType = e.GetValue("ThresholdType").ToString(); //if (thresholdType == "") // thresholdType = "Percent"; double valThreshold; if (e.GetValue("Threshold").ToString() != "") { valThreshold = (double)e.GetValue("Threshold"); //if the threshold type is "%" then divide the value by 100 if (thresholdType == "Percent" && valThreshold > 0) { valThreshold = (valThreshold / 100); } } else { valThreshold = 0.0; } //3/9/2015 NS modified for VSPLUS-1464 //if (e.DataColumn.FieldName == "DiskName") if (e.DataColumn.FieldName == "PercentFree") { if (thresholdType == "Percent") { double valPercentFree; if (e.GetValue("PercentFree").ToString() != "") { valPercentFree = (double)e.GetValue("PercentFree"); } else { valPercentFree = 0.0; } //if (valPercentFree > valThreshold && (valPercentFree <= 1 - (0.8 * (1 - valThreshold)))) float topValue = (1 - (float.Parse(strDiskYellowTh) / 100)); if (valPercentFree > valThreshold && (valPercentFree <= 1 - (topValue * (1 - valThreshold)))) { e.Cell.BackColor = System.Drawing.Color.Yellow; } else if ((valPercentFree) <= valThreshold) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else { e.Cell.BackColor = System.Drawing.Color.Green; e.Cell.ForeColor = System.Drawing.Color.White; } } } //3/9/2015 NS modified for VSPLUS-1464 //if (e.DataColumn.FieldName == "DiskName") if (e.DataColumn.FieldName == "PercentFree") { if (thresholdType == "GB") { double valGBFree; if (e.GetValue("DiskFree").ToString() != "") { valGBFree = (double)e.GetValue("DiskFree"); } else { valGBFree = 0.0; } //double valPercentFree = (double)e.GetValue("PercentFree"); //if (valGBFree > valThreshold && (valPercentFree <= 1 - (0.8 * (1 - 0)))) //if (valGBFree > valThreshold && (valGBFree <= (valThreshold + ((20 * valThreshold) / 100)))) if (valGBFree > valThreshold && (valGBFree <= (valThreshold + ((float.Parse(strDiskYellowTh) * valThreshold) / 100)))) { e.Cell.BackColor = System.Drawing.Color.Yellow; } else if ((valGBFree) <= valThreshold) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else { e.Cell.BackColor = System.Drawing.Color.Green; e.Cell.ForeColor = System.Drawing.Color.White; } } } //if (e.DataColumn.FieldName == "AverageQueueLength") //{ // double valThreshold; // if (e.GetValue("Threshold").ToString() != "") // { // valThreshold = (double)e.GetValue("Threshold"); // } // else // { // valThreshold = 0.0; // } // if ((valThreshold) >= 0.3 && valThreshold < 1.0) // { // e.Cell.BackColor = System.Drawing.Color.Yellow; // } // else if ((valThreshold) >= 1.0) // { // e.Cell.BackColor = System.Drawing.Color.Red; // } // else // { // e.Cell.BackColor = System.Drawing.Color.Green; // e.Cell.ForeColor = System.Drawing.Color.White; // } //} //if (e.DataColumn.FieldName == "PercentUtilization") //{ // double valThreshold; // if (e.GetValue("Threshold").ToString() != "") // { // valThreshold = (double)e.GetValue("Threshold"); // } // else // { // valThreshold = 0.0; // } // if ((valThreshold) >= 0.8 && valThreshold < 1.0) // { // e.Cell.BackColor = System.Drawing.Color.Yellow; // } // else if ((valThreshold) >= 1.0) // { // e.Cell.BackColor = System.Drawing.Color.Red; // } // else // { // e.Cell.BackColor = System.Drawing.Color.Green; // e.Cell.ForeColor = System.Drawing.Color.White; // } //} }
/// <summary> /// hightlight where values have been changed? /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridOrder_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName != "CargoReady" && e.DataColumn.FieldName != "EstPallets" && e.DataColumn.FieldName != "EstWeight" && e.DataColumn.FieldName != "EstVolume") return; string _hfKey = "key" + e.GetValue("OrderID").ToString(); if (this.dxhfeditor.Contains(_hfKey)) e.Cell.BackColor = System.Drawing.Color.Green; }
protected void CASGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { string RPC = ""; string IMAP = ""; string OWA = ""; string POP3 = ""; string ActiveSync = ""; string SMTP = ""; string EWS = ""; string AutoDiscovery = ""; string Services = ""; RPC = e.GetValue("RPC").ToString(); IMAP = e.GetValue("IMAP").ToString(); OWA = e.GetValue("OWA").ToString(); POP3 = e.GetValue("POP3").ToString(); ActiveSync = e.GetValue("Active Sync").ToString(); SMTP = e.GetValue("SMTP").ToString(); EWS = e.GetValue("EWS").ToString(); AutoDiscovery = e.GetValue("Auto Discovery").ToString(); Services = e.GetValue("Services").ToString(); switch (e.DataColumn.FieldName) { case "RPC": if (RPC.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (RPC.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (RPC.ToUpper() == "OK" || RPC.ToUpper() == "PASS" || RPC.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "IMAP": if (IMAP.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (IMAP.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (IMAP.ToUpper() == "OK" || IMAP.ToUpper() == "PASS" || IMAP.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "OWA": if (OWA.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (OWA.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (OWA.ToUpper() == "OK" || OWA.ToUpper() == "PASS" || OWA.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "POP3": if (POP3.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (POP3.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (POP3.ToUpper() == "OK" || POP3.ToUpper() == "PASS" || POP3.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "Active Sync": if (ActiveSync.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (ActiveSync.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (ActiveSync.ToUpper() == "OK" || ActiveSync.ToUpper() == "PASS" || ActiveSync.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "SMTP": if (SMTP.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (SMTP.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (SMTP.ToUpper() == "OK" || SMTP.ToUpper() == "PASS" || SMTP.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "EWS": if (EWS.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (EWS.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (EWS.ToUpper() == "OK" || EWS.ToUpper() == "PASS" || EWS.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "Auto Discovery": if (AutoDiscovery.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (AutoDiscovery.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (AutoDiscovery.ToUpper() == "OK" || AutoDiscovery.ToUpper() == "PASS" || AutoDiscovery.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; case "Services": if (Services.ToUpper() == "FAIL") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (Services.ToUpper() == "ISSUE") { e.Cell.BackColor = System.Drawing.Color.Yellow; } //3/27/2014 NS modified else if (Services.ToUpper() == "OK" || Services.ToUpper() == "PASS" || Services.ToUpper() == "PASSED") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } break; } }
//用这种方法改变列颜色,取非0列时会报错 /*protected void ASPxGridView1_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) * { * if (e.VisibleIndex < 0) return; * * string sql; * DataTable dt; * string status; * * status = e.GetValue("SN_FLAG").ToString(); * if (status == "N") * { * e.Row.BackColor = System.Drawing.Color.Brown; * } * * status = e.GetValue("CONFIRM_FLAG").ToString(); * if (status == "N") * { * e.Row.BackColor = System.Drawing.Color.Yellow; * } * * status = e.GetValue("BOM_FLAG").ToString(); * if (status == "N") * { * e.Row.BackColor = System.Drawing.Color.Green; * } * * status = e.GetValue("ITEM_FLAG").ToString(); * switch (status) * { * case "N": * e.Row.BackColor = System.Drawing.Color.Chartreuse; * break; * //case "R": * // e.Row.BackColor = System.Drawing.Color.BurlyWood; * // break; * //case "Y": * // e.Row.BackColor = System.Drawing.Color.CadetBlue; * // break; * } * * //与THIRD_FLAG意义一样 * sql = " select plan_code from ms_sfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = '" + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "')" + " and plan_code='" + e.GetValue("PLAN_CODE").ToString() + "' "; + dc.setTheSql(sql); + dt = dc.GetTable(); + if (dt.Rows.Count > 0) + { + e.Row.BackColor = System.Drawing.Color.FromArgb(128, 128, 64); + } + + status = e.GetValue("RUN_FLAG").ToString(); + if (status == "N") + { + e.Row.BackColor = System.Drawing.Color.Red; + } + + //sql = "select plan_code from ms_kfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = '" + // + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "')" + // + " and plan_code='" + e.GetValue("PLAN_CODE").ToString() + "' "; + //dc.setTheSql(sql); + //dt = dc.GetTable(); + //if (dt.Rows.Count > 0) + //{ + // e.Row.BackColor = System.Drawing.Color.FromArgb(255, 0, 255); + //} + + sql = "select SO from atpusofjb where so='" + e.GetValue("PLAN_SO").ToString() + "'"; + dc.setTheSql(sql); + dt = dc.GetTable(); + if (dt.Rows.Count < 1) + { + e.Row.BackColor = System.Drawing.Color.FromArgb(0, 123, 123); + } + + string tJhso = e.GetValue("PLAN_SO").ToString(); + string tJhdm = e.GetValue("PLAN_CODE").ToString(); + sql = " SELECT PLAN_CODE,PLAN_SO,CREATE_DATE,REMARK FROM DATA_PLANLOG where PLAN_SO='" + tJhso + "' and PLAN_CODE='" + tJhdm + "' AND ROUNTING_SITE IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ' " + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " + " ORDER BY CREATE_DATE,PLAN_CODE "; + dc.setTheSql(sql); + dt = dc.GetTable(); + if (dt.Rows.Count > 0) + { + e.Row.BackColor = System.Drawing.Color.Cyan; + } + + }*/ //给列设置颜色要用这种方式 //但是页面加载会变得特别慢,因为要进行两重循环,每一行的所有列都要进行一次循环,即列表中的每一个单元格都要循环一次 protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { //若不是PLAN_CODE列,则不执行下面的代码 if (e.DataColumn.FieldName.ToString() != "PLAN_CODE" && e.DataColumn.FieldName.ToString() != "PRODUCT_MODEL") { return; } string tJhso = e.GetValue("PLAN_SO").ToString(); string tJhdm = e.GetValue("PLAN_CODE").ToString(); string sql = " SELECT PLAN_CODE,PLAN_SO,CREATE_DATE,REMARK FROM DATA_PLANLOG where PLAN_SO='" + tJhso + "' and PLAN_CODE='" + tJhdm + "' AND ROUNTING_SITE IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = '" + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " + " ORDER BY CREATE_DATE,PLAN_CODE "; dc.setTheSql(sql); DataTable dt = dc.GetTable(); //如果是机型列则只需判断计划是否有过变更 if (e.DataColumn.FieldName.ToString() == "PRODUCT_MODEL") { if (dt.Rows.Count > 0) { e.Cell.BackColor = System.Drawing.Color.Cyan; } return; } //下面的改变计划代码列的颜色 string status = e.GetValue("SN_FLAG").ToString(); if (status == "N") { //给需要设置颜色的列设置颜色 //流水号分配 e.Cell.BackColor = System.Drawing.Color.Brown; } status = e.GetValue("CONFIRM_FLAG").ToString(); if (status == "N") { //计划确认 e.Cell.BackColor = System.Drawing.Color.Yellow; } status = e.GetValue("BOM_FLAG").ToString(); if (status == "N") { //BOM转换 e.Cell.BackColor = System.Drawing.Color.Green; } status = e.GetValue("ITEM_FLAG").ToString(); if (status == "N") { //库房确认 e.Cell.BackColor = System.Drawing.Color.Chartreuse; } sql = " select plan_code from ms_sfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = '" + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " + " and plan_code='" + tJhdm + "' "; dc.setTheSql(sql); dt = dc.GetTable(); if (dt.Rows.Count > 0) { //三方物料计算 e.Cell.BackColor = System.Drawing.Color.FromArgb(128, 128, 64); } status = e.GetValue("RUN_FLAG").ToString(); if (status == "N") { //计划执行 e.Cell.BackColor = System.Drawing.Color.Red; //若计划未执行,则后面的都不再判断 return; } //sql = " select plan_code from ms_kfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = '" // + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " // + " and plan_code='" + tJhdm + "' "; //dc.setTheSql(sql); //dt = dc.GetTable(); //if (dt.Rows.Count > 0) //{ // e.Cell.BackColor = System.Drawing.Color.FromArgb(255, 0, 255); //} sql = " select SO from atpusofjb where so='" + tJhso + "' "; dc.setTheSql(sql); dt = dc.GetTable(); if (dt.Rows.Count < 1) { //随机带走件 e.Cell.BackColor = System.Drawing.Color.FromArgb(0, 123, 123); } /*string tJhso = e.GetValue("PLAN_SO").ToString(); * string tJhdm = e.GetValue("PLAN_CODE").ToString(); * string sql = " SELECT PLAN_CODE,PLAN_SO,CREATE_DATE,REMARK FROM DATA_PLANLOG where PLAN_SO='" + tJhso + "' and PLAN_CODE='" + tJhdm + "' AND ROUNTING_SITE IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ' " + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " + " ORDER BY CREATE_DATE,PLAN_CODE "; + dc.setTheSql(sql); + DataTable dt = dc.GetTable(); + if (dt.Rows.Count > 0) + { + //一些不需设置颜色的列 + //if (e.DataColumn.Caption.ToString() == "计划确认标识") return; + //if (e.DataColumn.Caption.ToString() == "BOM转换") return; + //if (e.DataColumn.Caption.ToString() == "库房确认标识") return; + //if (e.DataColumn.Caption.ToString() == "是否分配流水号") return; + //if (e.DataColumn.Caption.ToString() == "三方要料") return; + //if (e.DataColumn.Caption.ToString() == "库房要料") return; + //if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "生产确认标识") return; + //if (e.DataColumn.Caption.ToString() == "柳汽标识") return; + //if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return; + //也可以根据FieldName进行判断 + //if (e.DataColumn.FieldName.ToString() == "ORDER_CODE") return; + + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PLINE_CODE") + { + e.Cell.BackColor = System.Drawing.Color.Cyan; + return; + } + } + + string status = e.GetValue("RUN_FLAG").ToString(); + if (status == "N") + { + //一些不需设置颜色的列 + //if (e.DataColumn.Caption.ToString() == "计划确认标识") return; + //if (e.DataColumn.Caption.ToString() == "BOM转换") return; + //if (e.DataColumn.Caption.ToString() == "库房确认标识") return; + //if (e.DataColumn.Caption.ToString() == "是否分配流水号") return; + //if (e.DataColumn.Caption.ToString() == "三方要料") return; + //if (e.DataColumn.Caption.ToString() == "库房要料") return; + //if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "生产确认标识") return; + //if (e.DataColumn.Caption.ToString() == "柳汽标识") return; + //if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return; + + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PLINE_NAME") + { + e.Cell.BackColor = System.Drawing.Color.Red; + return; + } + } + + status = e.GetValue("CONFIRM_FLAG").ToString(); + if (status == "N") + { + //一些不需设置颜色的列 + //if (e.DataColumn.Caption.ToString() == "计划确认标识") return; + //if (e.DataColumn.Caption.ToString() == "BOM转换") return; + //if (e.DataColumn.Caption.ToString() == "库房确认标识") return; + //if (e.DataColumn.Caption.ToString() == "是否分配流水号") return; + //if (e.DataColumn.Caption.ToString() == "三方要料") return; + //if (e.DataColumn.Caption.ToString() == "库房要料") return; + //if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "生产确认标识") return; + //if (e.DataColumn.Caption.ToString() == "柳汽标识") return; + //if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return; + + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PLAN_BATCH") + { + e.Cell.BackColor = System.Drawing.Color.Yellow; + return; + } + } + + status = e.GetValue("BOM_FLAG").ToString(); + if (status == "N") + { + //一些不需设置颜色的列 + //if (e.DataColumn.Caption.ToString() == "计划确认标识") return; + //if (e.DataColumn.Caption.ToString() == "BOM转换") return; + //if (e.DataColumn.Caption.ToString() == "库房确认标识") return; + //if (e.DataColumn.Caption.ToString() == "是否分配流水号") return; + //if (e.DataColumn.Caption.ToString() == "三方要料") return; + //if (e.DataColumn.Caption.ToString() == "库房要料") return; + //if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return; + //if (e.DataColumn.Caption.ToString() == "生产确认标识") return; + //if (e.DataColumn.Caption.ToString() == "柳汽标识") return; + //if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return; + + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PLAN_SEQ") + { + e.Cell.BackColor = System.Drawing.Color.Green; + return; + } + } + + sql = " select plan_code from ms_sfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ' " + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " + " and plan_code='" + tJhdm + "' "; + dc.setTheSql(sql); + dt = dc.GetTable(); + if (dt.Rows.Count > 0) + { + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PLAN_CODE") + { + e.Cell.BackColor = System.Drawing.Color.FromArgb(128, 128, 64); + } + } + + sql = " select plan_code from ms_kfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ' " + theUserId + "' AND PROGRAM_CODE = '" + theProgramCode + "' AND COMPANY_CODE = '" + theCompanyCode + "') " + " and plan_code='" + tJhdm + "' "; + dc.setTheSql(sql); + dt = dc.GetTable(); + if (dt.Rows.Count > 0) + { + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PLAN_SO") + { + e.Cell.BackColor = System.Drawing.Color.FromArgb(255, 0, 255); + } + } + + sql = " select SO from atpusofjb where so='" + tJhso + "' "; + dc.setTheSql(sql); + dt = dc.GetTable(); + if (dt.Rows.Count < 0) + { + //给需要设置颜色的列设置颜色 + if (e.DataColumn.FieldName.ToString() == "PRODUCT_MODEL") + { + e.Cell.BackColor = System.Drawing.Color.FromArgb(0, 123, 123); + } + }*/ }
//17/3/2016 sowmya added for VSPLUS 2455 //5/9/2016 Sowjanya modified for VSPLUS-2931 protected void PotentialIssuesGrid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { int docCount1 = Convert.ToInt32(e.GetValue("DocCountA")); int docCount2 = Convert.ToInt32(e.GetValue("DocCountB")); int docCount3 = Convert.ToInt32(e.GetValue("DocCountC")); int dbsize1 = Convert.ToInt32(e.GetValue("DBSizeA")); int dbsize2 = Convert.ToInt32(e.GetValue("DBSizeB")); int Threshold = Convert.ToInt32(Session["Thresholdvalue"].ToString()); bool isMatched = (docCount1 != docCount2 && docCount3 != docCount2) ? ((docCount1 != docCount3) ? true : false) : false; if (Session["ServerCName"] != "") { //if (isMatched) //{ if (docCount1 == 0 || docCount2 == 0 || docCount3 == 0) { if (e.DataColumn.FieldName == "DocCountA" || e.DataColumn.FieldName == "DocCountB" || e.DataColumn.FieldName == "DocCountC") { if (!(docCount1 == 0 && docCount2 == 0 && docCount3 == 0)) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.Black; } } } if (docCount1 > 0 && docCount2 > 0 && docCount3 > 0) { if (Math.Abs(docCount1 - docCount2) < Threshold && Math.Abs(docCount2 - docCount3) < Threshold && Math.Abs(docCount3 - docCount1) < Threshold && (docCount1 != docCount2 || docCount1 != docCount3 || docCount2 != docCount3)) { if (e.DataColumn.FieldName == "DocCountA" || e.DataColumn.FieldName == "DocCountB" || e.DataColumn.FieldName == "DocCountC") { e.Cell.BackColor = System.Drawing.Color.Yellow; e.Cell.ForeColor = System.Drawing.Color.Black; } } if (Math.Abs(docCount1 - docCount2) >= Threshold && Math.Abs(docCount2 - docCount3) >= Threshold && Math.Abs(docCount3 - docCount1) >= Threshold) { if (e.DataColumn.FieldName == "DocCountA" || e.DataColumn.FieldName == "DocCountB" || e.DataColumn.FieldName == "DocCountC") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.Black; } } } } else { if (docCount1 == 0 || docCount2 == 0) { if (e.DataColumn.FieldName == "DocCountA" || e.DataColumn.FieldName == "DocCountB") { if (!(docCount1 == 0 && docCount2 == 0)) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.Black; } } } if (docCount1 > 0 && docCount2 > 0) { if (Math.Abs(docCount1 - docCount2) < Threshold && docCount1 != docCount2) { if (e.DataColumn.FieldName == "DocCountA" || e.DataColumn.FieldName == "DocCountB") { e.Cell.BackColor = System.Drawing.Color.Yellow; e.Cell.ForeColor = System.Drawing.Color.Black; } } if (Math.Abs(docCount1 - docCount2) >= Threshold) { if (e.DataColumn.FieldName == "DocCountA" || e.DataColumn.FieldName == "DocCountB") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.Black; } } } } }