コード例 #1
0
        public void HienThi(ListView list, ComboBox day, ComboBox trangthai)
        {
            PhongData phong = new PhongData();

            list.Items.Clear();
            DataTable table = phong.LayDSPhong();

            foreach (DataRow row in table.Rows)
            {
                PhongInfo    info = RowToInfo(row);
                ListViewItem item = new ListViewItem();
                item.Text = info.MaPhong;
                item.SubItems.Add(info.TenPhong);
                item.SubItems.Add(info.Day.TenDay);
                item.SubItems.Add(info.SoLuongToiDa.ToString());
                item.SubItems.Add(info.TrangThai.TenTrangThai);
                item.SubItems.Add((info.PhongNam == true?"Nam":"Nữ"));
                item.Tag = info;
                list.Items.Add(item);
            }

            //----------------
            DayCtrl dayctrl = new DayCtrl();

            dayctrl.LayDuLieuLenComboBox(day);
            TrangThaiPhongCtrl dayctrl1 = new TrangThaiPhongCtrl();

            dayctrl1.LayDuLieuLenComboBox(trangthai);
        }
コード例 #2
0
        public void LayDuLieuLenComboBox(ComboBoxEx cmb)
        {
            PhongData hd    = new PhongData();
            DataTable table = hd.LayDSPhong();

            cmb.DataSource    = table;
            cmb.DisplayMember = "TENPHG";
            cmb.ValueMember   = "MAPHG";
        }
コード例 #3
0
        public void LayDuLieuLenComboBoxItem(ComboBoxItem cmb)
        {
            PhongData hd    = new PhongData();
            DataTable table = hd.LayDSPhong();

            foreach (DataRow row in table.Rows)
            {
                cmb.Items.Add(row["TenPHG"]);
            }
            //cmb.DisplayMember = "TENPHG";
            //cmb.ValueMember = "MAPHG";
        }