Exemplo n.º 1
0
        private void LoadHouse()
        {
            try {
                cboHouseType.Text    = "";
                txtHoseName.Text     = "";
                txtHouseBoxjuan.Text = "";
                DataTable dt = T_Sysset.GetHouseInfo();
                if (dt != null && dt.Rows.Count > 0)
                {
                    this.lsvHouse.Items.Clear();
                    int    i            = 1;
                    string tmpHouseType = string.Empty;
                    string tmpHouse     = string.Empty;
                    string tmpMaxBox    = string.Empty;
                    string tmpHouseID   = string.Empty;

                    foreach (DataRow dr in dt.Rows)
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.Text     = i.ToString();
                        tmpHouseType = dr["HouseType"].ToString();
                        tmpHouse     = dr["HouseName"].ToString();
                        tmpMaxBox    = dr["MaxBoxNum"].ToString();
                        tmpHouseID   = dr["id"].ToString();
                        lvi.SubItems.AddRange(new string[] { tmpHouseType, tmpHouse, tmpMaxBox, tmpHouseID });
                        this.lsvHouse.Items.Add(lvi);
                        i++;
                    }
                }
            } catch (Exception ee) {
                MessageBox.Show(ee.ToString());
            }
        }
Exemplo n.º 2
0
 private void InitHouse()
 {
     try {
         List <V_HouseSet> HouseEc = new List <V_HouseSet>();
         DataTable         dt      = T_Sysset.GetHouseInfo();
         if (dt == null || dt.Rows.Count <= 0)
         {
             return;
         }
         cboHouse.Items.Clear();
         foreach (DataRow dr in dt.Rows)
         {
             V_HouseSet House = new V_HouseSet();
             House.HouseName = dr["HOUSENAME"].ToString();
             House.HouseID   = Convert.ToInt32(dr["id"].ToString());
             House.HouseBox  = Convert.ToInt32(dr["MaxBoxNum"].ToString());
             HouseEc.Add(House);
         }
         cboHouse.BeginUpdate();
         cboHouse.Items.Clear();
         cboHouse.Items.AddRange(HouseEc.ToArray());
         cboHouse.EndUpdate();
         cboHouse.SelectedItem = HouseEc;
     } catch (Exception ee) {
         MessageBox.Show(ee.ToString());
     }
 }