예제 #1
0
 public void LoadModule1(ListViewEx lsv, string str)
 {
     lsv.Items.Clear();
     if (contendt != null && contendt.Rows.Count > 0)
     {
         DataTable dt1 = null;
         if (str.Trim().Length > 0)
         {
             try {
                 string s = "TITLE like '%" + str + "%'";
                 dt1 = contendt.Select(s).CopyToDataTable();
             } catch {
                 dt1 = null;
             }
             if (dt1 == null || dt1.Rows.Count <= 0)
             {
                 return;
             }
             foreach (DataRow dr in dt1.Rows)
             {
                 ListViewItem lvi     = new ListViewItem();
                 string       type    = dr["CoType"].ToString();
                 string       code    = dr["Code"].ToString();
                 string       title   = dr["Title"].ToString();
                 string       titlelx = dr["TitleLx"].ToString();
                 lvi.Text = code;
                 lvi.SubItems.AddRange(new string[] { title, titlelx, type });
                 lsv.BeginInvoke(new Action(() => { lsv.Items.Add(lvi); }));
             }
         }
     }
 }
예제 #2
0
        public void LoadModule(ListViewEx lsv)
        {
            lsv.Items.Clear();
            DataTable dt = Common.GetcontenModule();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ListViewItem lvi     = new ListViewItem();
                    string       type    = dr["CoType"].ToString();
                    string       code    = dr["Code"].ToString();
                    string       title   = dr["Title"].ToString();
                    string       titlelx = dr["TitleLx"].ToString();
                    lvi.Text = code;
                    lvi.SubItems.AddRange(new string[] { title, titlelx, type });
                    lsv.BeginInvoke(new Action(() => { lsv.Items.Add(lvi); }));
                }
            }
        }
예제 #3
0
        public void UpdateStudent(CStuDevlist student)
        {
            if (devlistViewEx.InvokeRequired)
            {
                devlistViewEx.BeginInvoke(new ViewUpdatelinvoke(UpdateStudent), student);
            }
            else
            {
                devlistViewEx.Items.Clear();
                if (student.StudentList.Count > 0)
                {
                    ListViewItem Item0 = new ListViewItem();
                    Item0.SubItems.Clear();
                    Item0.SubItems[0].Text = "0";
                    Item0.SubItems.Add(((CStudent)student.StudentList[0]).xm);
                    Item0.SubItems.Add(((CStudent)student.StudentList[0]).zkzmbh);
                    if (Status == DevStatus.身份验证 || Status == DevStatus.正在考试)
                    {
                        Item0.ForeColor = Color.SeaShell;
                        Item0.SubItems[1].ForeColor = Color.SeaShell;
                        Item0.SubItems[2].ForeColor = Color.SeaShell;

                        Item0.BackColor = Color.Tan;
                        Item0.SubItems[1].BackColor = Color.Tan;
                        Item0.SubItems[2].BackColor = Color.Tan;
                    }
                    else
                    {
                        Item0.BackColor = Color.White;
                    }
                    Item0.ForeColor = Color.FromArgb(255, 69, 98, 135);
                    Item0.SubItems[1].ForeColor = Color.FromArgb(255, 69, 98, 135);
                    Item0.SubItems[2].ForeColor = Color.FromArgb(255, 69, 98, 135);
                    devlistViewEx.Items.Add(Item0);

                    for (int i = 1; i < student.StudentList.Count; i++)
                    {
                        ListViewItem Item = new ListViewItem();
                        Item.SubItems.Clear();
                        Item.SubItems[0].Text = i.ToString();
                        Item.SubItems.Add(((CStudent)student.StudentList[i]).xm);
                        Item.SubItems.Add(((CStudent)student.StudentList[i]).zkzmbh);
                        if ((i % 2) == 0)
                        {
                            Item.BackColor = Color.White;
                        }
                        else
                        {
                            Item.BackColor = Color.FromArgb(255, 214, 224, 236);
                            Item.SubItems[1].BackColor = Color.FromArgb(255, 214, 224, 236);
                            Item.SubItems[2].BackColor = Color.FromArgb(255, 214, 224, 236);

                        }
                        Item.ForeColor = Color.FromArgb(255, 69, 98, 135);
                        Item.SubItems[1].ForeColor = Color.FromArgb(255, 69, 98, 135);
                        Item.SubItems[2].ForeColor = Color.FromArgb(255, 69, 98, 135);
                        devlistViewEx.Items.Add(Item);
                    }
                }
            }
        }