using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Pub_Class; namespace OAM { public partial class frmQMsg : Form { public const int picCol = 0; public const int czymcCol = 1; public const int logintimeCol = 2; public const int logintime2Col = 3; public frmQMsg() { InitializeComponent(); } public int lblQty = 0; public int lblQty2 = 0; TreeNode CurNode = new TreeNode(); public void Display() { //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //DataSet Ds; //string sSQL; ////select czymc,logintime from gy_czygl order by czymc //sSQL = "select czymc Ö°Ô±,logintime,getdate() logintime2 from gy_czygl order by czymc"; ////Select id hid,fromoperator Óû§,opdate ʱ¼ä,context ÄÚÈÝ from oa_msg where fromoperator='ÄÚÏú²¿¾­Àí' or fromoperator= '¾°»ÀÕÂ' and tooperator='¾°»ÀÕÂ' or tooperator='ÄÚÏú²¿¾­Àí' //Ds = oCn.RunProcReturn(sSQL, "gy_czygl", ref DBUtility.ClsPub.sExeReturnInfo); //if (Ds == null) //{ // MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + DBUtility.ClsPub.sExeReturnInfo); // return; //} //grdMain.DataSource = Ds.Tables[0].DefaultView; DisplayCSFJ(); //DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, "",0); for (int i = 0; i <= grdMain.Rows.Count - 1; i++) { if (DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[2].Value).AddMinutes(5) >= DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[3].Value)) { grdMain.Rows[i].Cells[1].Style.ForeColor = Color.Red;//Ñ¡Öиñ lblQty = lblQty + 1; } else { grdMain.Rows[i].Cells[1].Style.ForeColor = Color.Black;//Ñ¡Öиñ } lblQty2 = lblQty2 + 1; } } //ÏÔʾÁбí private void DisplayCSFJ()//huan { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet Ds; string sSQL; //select czymc,logintime from gy_czygl order by czymc sSQL = "select czymc Ö°Ô±,logintime,getdate() logintime2 from gy_czygl order by czymc"; //Select id hid,fromoperator Óû§,opdate ʱ¼ä,context ÄÚÈÝ from oa_msg where fromoperator='ÄÚÏú²¿¾­Àí' or fromoperator= '¾°»ÀÕÂ' and tooperator='¾°»ÀÕÂ' or tooperator='ÄÚÏú²¿¾­Àí' //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //DataSet Ds; Ds = oCn.RunProcReturn("select czymc Ö°Ô±,logintime,getdate() logintime2 from gy_czygl order by czymc", "gy_czygl"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { return; } for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { grdMain.Rows.Add(); grdMain.Rows[i].Cells[czymcCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["Ö°Ô±"]); grdMain.Rows[i].Cells[logintimeCol].Value = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[i]["logintime"]); grdMain.Rows[i].Cells[logintime2Col].Value = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[i]["logintime2"]); } } //¼ÓÔØÊ÷ÐÎ public static void LoadTree(TreeView tv, string Text)//Lock { try { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); tv.Nodes.Clear(); //tv.ImageList = imageList1; TreeNode sNode = tv.Nodes.Add("T0", Text, 0, 1); LoadAllNodes(sNode); } catch (Exception e) { MessageBox.Show("¼ÓÔØÊ÷ÐÍʧ°Ü£¡" + e.Message, "Ìáʾ"); } } public static void LoadAllNodes(TreeNode sNode) //Lock { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); if (sNode != null) { //sss = 0; try { //long sName = Convert.ToInt64(sNode.Name.Substring(1, sNode.Name.Length - 1)); sNode.Nodes.Clear(); //ofrm_add1.oDeptid = CurNode.Name.Replace("T", ""); DataSet Ds = oCn.RunProcReturn("select czymc,logintime from gy_czygl order by czymc", "czymc", ref ClsPub.sExeReturnInfo); for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { // Ds.Tables[0].Rows[i]["FileName"].ToString() + "-" + Ds.Tables[0].Rows[i]["HName"].ToString(), //if() TreeNode oNode = sNode.Nodes.Add("T" + Ds.Tables[0].Rows[i]["logintime"].ToString(), Ds.Tables[0].Rows[i]["czymc"].ToString(), 0, 1); //sss = sss + 1; } sNode.Expand(); } catch (Exception e) { MessageBox.Show("¼ÓÔØ×ÓÏîĿʧ°Ü£¡" + e.Message, "Ìáʾ"); } } } private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { CurNode = e.Node; if (CurNode != null) { //Display(); //if (CurNode.Nodes.Count == 0) // LoadAllNodes(CurNode); ////ÕÒµ½Ñ¡Öнáµã } } private void frmQMsg_Load(object sender, EventArgs e) { initGridFJ(); Display(); //initGridFJ(); //LoadTree(treeView1, this.Text); txtlblQty.Text = lblQty.ToString(); txtlblQty2.Text = lblQty2.ToString(); } private void treeView1_MouseDoubleClick(object sender, MouseEventArgs e) { frmSMsg ofrmSMsg = new frmSMsg(); string oDeptid = CurNode.Text; if (oDeptid == "") { oDeptid = "Deptid"; } ofrmSMsg.fromoperator = DBUtility.ClsPub.CurUserName; ofrmSMsg.tooperator = oDeptid; ofrmSMsg.Show(); } private void initGridFJ()//huan { grdMain.ColumnCount = 4; //×ÜÁÐÊý DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name + "grdMain"); grdMain.ReadOnly = true; grdMain.RowCount = 0; //= grdMain.Columns[picCol].HeaderText = "ÐòºÅ"; grdMain.Columns[czymcCol].HeaderText = "Ö°Ô±"; //grdMain.Columns[logintimeCol].HeaderText = "sj"; grdMain.Columns[logintimeCol].Visible = false; grdMain.Columns[logintime2Col].Visible = false; grdMain.Columns[picCol].Visible = false; DBUtility.ClsPub.GetGridView(grdMain, this.Name + "grdMain", DBUtility.ClsPub.AppPath); } private void grdMain_DoubleClick(object sender, EventArgs e) { //frmSMsg ofrmSMsg = new frmSMsg(); //string oDeptid = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[czymcCol].Value); //if (oDeptid == "") //{ // oDeptid = "Deptid"; //} //ofrmSMsg.fromoperator = DBUtility.ClsPub.CurUserName; //ofrmSMsg.tooperator = oDeptid; //ofrmSMsg.Show(); } private void label3_Click(object sender, EventArgs e) { } private void txtlblQty_Click(object sender, EventArgs e) { } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (textBox1.Text == "") { MessageBox.Show("ÇëÌîд²éѯÄÚÈÝ"); } else { //sSQL = "select czymc from gy_czygl where czymc='" + textBox1.Text + "'"; SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); DataSet DSet; string sSql = ""; string sWhere = ""; sSql = "select czymc Ö°Ô± from gy_czygl where czymc like '%" + textBox1.Text + "%' "; //Ö´ÐÐSQL DSet = SubCn.RunProcReturn(sSql, "gy_czygl", ref DBUtility.ClsPub.sExeReturnInfo); // if (DSet == null) { MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + DBUtility.ClsPub.sExeReturnInfo); return; } grdMain.DataSource = DSet.Tables[0].DefaultView; DBUtility.Gy_BaseFun.DisplayGrid(grdMain, this.Name); } } } private void grdMain_CellContentClick(object sender, DataGridViewCellEventArgs e) { } } }