Exemple #1
0
 private void LoadCheckedListBox1Content()
 {
     if (checkedListBox1.InvokeRequired == false)
     {
         checkedListBox1.Items.Clear();
         DataTable dt = new DataTable();
         dt = BLL.GetMuHaoList("a");
         if (dt != null && dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 checkedListBox1.Items.Add(dt.Rows[i]["muhao"].ToString());
             }
         }
         //默认全选
         if (checkedListBox1.Items.Count > 0)
         {
             for (int i = 0; i < checkedListBox1.Items.Count; i++)
             {
                 checkedListBox1.SetItemChecked(i, true);
             }
         }
     }
     else
     {
         NPDelegate myDelegate = new NPDelegate(LoadCheckedListBox1Content);
         this.Invoke(myDelegate);
     }
 }
Exemple #2
0
        private void LoadCheckedListBox1Content()
        {
            if (checkedListBox1.InvokeRequired == false)
            {
                checkedListBox1.Items.Clear();
                DataTable dt = new DataTable();
                dt = BLL.GetMuHaoList("b");
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        checkedListBox1.Items.Add(dt.Rows[i]["muhao"].ToString());
                    }
                }
                //默认全选
                if (checkedListBox1.Items.Count > 0)
                {
                    for (int i = 0; i < checkedListBox1.Items.Count; i++)
                    {
                        checkedListBox1.SetItemChecked(i, true);
                    }
                }
                //if (taskList[selectedTaskIndex].sensorList != "")
                //{
                //    string[] sources = taskList[selectedTaskIndex].sensorList.Split(',');
                //    for (int i = 0; i < sources.Length; i++)
                //    {
                //        checkedListBox1.Items.Add("Prober " + sources[i]);
                //    }
                //}

                //string proberIndexStr = Properties.Settings.Default.proberIndexStr;
                //if (proberIndexStr != "")
                //{
                //    string[] strs = proberIndexStr.Split('#');
                //    for (int i = 0; i < strs.Length; i++)
                //    {
                //        int index = int.Parse(strs[i]);
                //        if (index > checkedListBox1.Items.Count - 1)
                //            break;
                //        checkedListBox1.SetItemChecked(index, true);
                //    }
                //}
            }
            else
            {
                NPDelegate myDelegate = new NPDelegate(LoadCheckedListBox1Content);
                this.Invoke(myDelegate);
            }
        }
Exemple #3
0
        private void LoadCheckedListBox3Content(int type)
        {
            string timeStart = dtpStart.Value.ToString("yyyy-MM-dd");
            string timeEnd   = dtpEnd.Value.ToString("yyyy-MM-dd");
            string strTemp   = string.Empty;
            double temp      = 0;

            if (checkedListBox3.InvokeRequired == false)
            {
                checkedListBox3.Items.Clear();
                DataTable dt = new DataTable();
                dt = BLL.GetLiuChengPiaoList(timeStart, timeEnd, "b");
                switch (type)
                {
                case 0:
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            strTemp = dt.Rows[i]["liuchengpiaobianhao"].ToString();
                            if (double.TryParse(strTemp, out temp))
                            {
                                checkedListBox3.Items.Add(strTemp);
                            }
                        }
                    }
                    break;

                case 1:
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            strTemp = dt.Rows[i]["liuchengpiaobianhao"].ToString();
                            if (strTemp.ToLower().IndexOf("p") >= 0 || strTemp.ToLower().IndexOf("f") >= 0)
                            {
                                checkedListBox3.Items.Add(strTemp);
                            }
                        }
                    }
                    break;

                case 2:
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            strTemp = dt.Rows[i]["liuchengpiaobianhao"].ToString();
                            if ((strTemp.ToLower().IndexOf("p") < 0 && strTemp.ToLower().IndexOf("f") < 0) && !double.TryParse(strTemp, out temp))
                            {
                                checkedListBox3.Items.Add(strTemp);
                            }
                        }
                    }
                    break;

                default:
                    break;
                }

                //默认全选
                if (checkedListBox3.Items.Count > 0)
                {
                    for (int i = 0; i < checkedListBox3.Items.Count; i++)
                    {
                        checkedListBox3.SetItemChecked(i, true);
                    }
                }
            }
            else
            {
                NPDelegate myDelegate = new NPDelegate(LoadCheckedListBox1Content);
                this.Invoke(myDelegate);
            }
        }