private void gv_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { int hand = e.RowHandle; if (hand < 0) { return; } DataRow dr = this.gv.GetDataRow(hand); if (dr == null) { return; } int cha = CommonInfo.DateDiff(Convert.ToDateTime(dr["insDate"]), DateTime.Now); switch (dr["State"].ToString().Trim()) { case "作废": e.Appearance.ForeColor = Color.White; //白色字体 e.Appearance.BackColor = Color.DarkGray; // 灰黑背景 break; case "进行中": e.Appearance.BackColor = Color.LightYellow; // 浅黄背景 if (cha >= 15 && cha < 20) { e.Appearance.ForeColor = Color.Red; //红色字体 e.Appearance.BackColor = Color.Yellow; // 黄背景 } if (cha >= 20) { e.Appearance.ForeColor = Color.White; //白色字体 e.Appearance.BackColor = Color.Red; // 红背景 } break; case "已结算": e.Appearance.BackColor = Color.PaleGreen; // 深绿背景 break; } }
private void FrmMain_Load(object sender, EventArgs e) { try { if (Program.sOperID.Trim() == "admin") { barQx.Enabled = true; brahw.Enabled = true; } else { barQx.Enabled = false; brahw.Enabled = false; } barInfo.Caption = "部门:" + Program.sDeptName + " 登陆人:" + Program.sOperID + " | " + Program.sOperName; try { this.treeView1.Nodes[0].Expand(); this.treeView1.Nodes[3].Expand(); } catch { } Form1 childForm = new Form1(); childForm.MdiParent = this; childForm.Text = "我的桌面"; childForm.Show(); string sError = ""; string sql = $"select AnQingDate,insDate from T_AnQing where DeftName='{ Program.sDeptName}' and OperName='{Program.sOperName}' and State='进行中'"; string sumdate = ""; string _sumdate = ""; DataTable tbDate = SqlHelper.RunQuery(CommandType.Text, sql, null, out sError); if (tbDate.Rows.Count != 0) { int cha = 0; for (int i = 0; i < tbDate.Rows.Count; i++) { cha = CommonInfo.DateDiff(Convert.ToDateTime(tbDate.Rows[i]["insDate"]), DateTime.Now); if (cha >= 20) { sumdate = Convert.ToDateTime(tbDate.Rows[i]["AnQingDate"]).ToString("M月"); if (sumdate != _sumdate) { MessageBox.Show(sumdate + "有正在进行中的检测项以超过20天,请尽快处理!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); _sumdate = sumdate; } } } } if (Program.sRoleID == "003") { FrmBaoFeiEdit bf = new FrmBaoFeiEdit(); bf.ShowDialog(); } //菜单权限读取 string sRoleID = Program.sRoleID; string strSql = "SELECT *,TQx_Menu.TreeNodeName FROM TQx_RoleQx left join TQx_Menu on TQx_Menu.MenuID=TQx_RoleQx.MenuID WHERE IsQx=1 and TQx_Menu.TreeNodeName<>'' and RoleID='" + sRoleID + "' order by TQx_Menu.SortID "; DataTable dtQx = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError); if (Program.sOperID.Trim() != "admin") { LoadTreeViewQx(treeView1.Nodes[0], dtQx.DefaultView, CommonInfo.CLng(treeView1.Nodes[0].Tag)); LoadTreeViewQx(treeView1.Nodes[1], dtQx.DefaultView, CommonInfo.CLng(treeView1.Nodes[1].Tag)); } else { //treeView1.Nodes.Clear(); } } catch { } try { string sError = ""; string strSql = "select * from T_BanBen where 1=1"; DataTable dtInit = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError); barButtonItem9.Caption = dtInit.Rows[0]["BanBenDesc"].ToString(); if (dtInit.Rows[0]["BanBenDesc"].ToString().Trim() != Program.sVersion) { MessageBox.Show("您的当前版本不是最新版本,请更新到最新版本[" + dtInit.Rows[0]["BanBenDesc"].ToString().Trim() + "]!", "提示"); this.Close(); } } catch { barButtonItem9.Caption = " "; } }