Example #1
0
        private void QuanLyBan_Load(object sender, EventArgs e)
        {
            using (HangHoaBUS bus = new HangHoaBUS())
                dataGridView2.DataSource = bus.ListHangHoa2();

            using (KhuVucBUS bus = new KhuVucBUS())
            {
                foreach (DataRow row in bus.ListKhuVuc().Rows)
                {
                    var group = new ListViewGroup(row["TenKhuVuc"].ToString());
                    listView1.Groups.Add(group);

                    foreach (DataRow r in bus.ListBan(row["TenKhuVuc"].ToString()).Rows)
                    {
                        listView1.Items.Add(new ListViewItem(r["TenBan"].ToString(),
                                                             bus.IsAvailable(r["MaSoBan"].ToString()) ? 0 : 1, group)).Tag = r["MaSoBan"];
                    }

                    listView1.Items[0].Selected = true;
                }
            }

            using (QuanLyBanBUS bus = new QuanLyBanBUS())
                txtSoHoaDon.Text = bus.GetSoHoaDon().ToString();
        }