Beispiel #1
0
        private void InitlizeSafeType()
        {
            IdName.Clear();
            using (SQLiteConnection conn = new SQLiteConnection(DBConfigPath))
            {
                conn.Open();
                SQLiteCommand cmd = conn.CreateCommand();
                cmd.CommandText = "SELECT DISTINCT SafeTypeID FROM S_SENSOR_SET";
                SQLiteDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int id = reader.GetInt32(0);

                        if (TypeIdName.TypeAndName.ContainsKey(id))
                        {
                            IDandName v = new IDandName();
                            v.ID   = id;
                            v.Name = TypeIdName.TypeAndName[id];
                            IdName.Add(v);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void InitelizeFilDateComboBox()
        {
            filterComBoxList.Clear();
            var bll = new DataFilterTypeBll();

            filterList = bll.SelectList().ToList();
            IDandName temp = new IDandName();

            for (int i = 0; i < filterList.Count; i++)
            {
                temp.ID   = Convert.ToInt32(filterList[i].ID);
                temp.Name = filterList[i].FilterDesc;
                filterComBoxList.Add(temp);
            }
            filDateComboBox.Text = "";
        }
Beispiel #3
0
        //对safeTypeComboBox数据显示进行初始化
        public void InitlizeTypeComBox()
        {
            //IdName.Clear();
            safeTypeList.Clear();
            using (SQLiteConnection conn = new SQLiteConnection(DBConfigPath))
            {
                try
                {
                    conn.Open();
                    SQLiteCommand cmd = conn.CreateCommand();
                    cmd.CommandText = "SELECT DISTINCT SafeTypeID FROM S_SENSOR_SET";
                    SQLiteDataReader reader = cmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int id = reader.GetInt32(0);

                            if (TypeIdName.TypeAndName.ContainsKey(id))
                            {
                                IDandName v = new IDandName();
                                v.ID   = id;
                                v.Name = TypeIdName.TypeAndName[id];
                                IdName.Add(v);
                                safeTypeList.Add(v.Name);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(@"数据库连接失败");
                }
            }
            safeTypeSource.DataSource   = safeTypeList;
            safeTypeComboBox.DataSource = safeTypeSource;
            safeTypeSource.ResetBindings(true);
            safeTypeComboBox.SelectedIndex = -1;
        }