yangle
2023-03-03 c2a9a460e38c7c196fe98a94e29e6330eac3626f
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
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)
        {
 
        }
 
     
      
        
    }
}