Esempio n. 1
0
        void LoadBan()
        {
            dsBan = dbBan.LayDanhSachBan();
            foreach (Ban ban in dsBan)
            {
                Button btn = new Button()
                {
                    Width = 90, Height = 90
                };
                btn.Text      = ban.MaBan;
                btn.ForeColor = Color.Black;
                btn.FlatStyle = FlatStyle.Flat;
                btn.FlatAppearance.BorderSize = 1;
                btn.Click += btn_Click;
                btn.Tag    = ban.TinhTrang;

                if (ban.TinhTrang.Equals("Trống"))
                {
                    btn.BackColor = Color.Transparent;
                }
                else
                {
                    btn.BackColor = Color.Firebrick;
                }

                if (ban.MaKV.Trim() == "KV1")
                {
                    fpnlPhongLanh.Controls.Add(btn);
                }
                else
                {
                    fpnlSanVuon.Controls.Add(btn);
                }
            }
        }
Esempio n. 2
0
        private void LoadDataSource()
        {
            lkup_KhuVuc.DataSource    = Utils.Util.ConvertToDataTable <KHU_VUC>(_khuVucBLL.LayDanhSachKhuVuc());
            lkup_KhuVuc.DisplayMember = "Ten_Khu_Vuc";
            lkup_KhuVuc.ValueMember   = "ID_Khu_Vuc";

            dt = Utils.Util.ConvertToDataTable <BAN>(_banBLL.LayDanhSachBan());
            gridControl1.DataSource = dt;
            btn_Luu_Lai.Enabled     = false;

            _listUpdate.Clear();
        }
Esempio n. 3
0
        private void LoadDataToListView()
        {
            listView1.Clear();
            DataTable dtKhuVuc = Utils.Util.ConvertToDataTable <KHU_VUC>(_khuVucBLL.LayDanhSachKhuVuc());

            for (int i = 0; i < dtKhuVuc.Rows.Count; i++)
            {
                ListViewGroup group = new ListViewGroup(dtKhuVuc.Rows[i][0].ToString(), dtKhuVuc.Rows[i][1].ToString());
                DataTable     dtBan = Utils.Util.ConvertToDataTable <BAN>(_banBLL.LayDanhSachBan());
                listView1.Groups.Add(group);
                for (int j = 0; j < dtBan.Rows.Count; j++)
                {
                    if (dtBan.Rows[j]["ID_Khu_Vuc"].ToString() == dtKhuVuc.Rows[i][0].ToString())
                    {
                        if (dtBan.Rows[j]["Trang_Thai"].ToString() == Ban_Trong.ToString())
                        {
                            ListViewItem item = new ListViewItem(dtBan.Rows[j]["Ten_Ban"].ToString(), 0, group);
                            listView1.Items.Add(item);
                        }
                        else
                        {
                            if (dtBan.Rows[i]["Trang_Thai"].ToString() == Ban_Dang_Su_Dung.ToString())
                            {
                                ListViewItem item = new ListViewItem(dtBan.Rows[j]["Ten_Ban"].ToString(), 1, group);
                                listView1.Items.Add(item);
                            }
                            else
                            {
                                ListViewItem item = new ListViewItem(dtBan.Rows[j]["Ten_Ban"].ToString(), 2, group);
                                listView1.Items.Add(item);
                            }
                        }
                    }
                }
            }
        }