Exemple #1
0
        private void hienThiDanhSachPhong()
        {
            indexHienTai = -1;
            flowPhongLayout.Controls.Clear();
            if (dictionaryAvailableLayout.ContainsKey(pageNumber) == false)
            {
                listAllPhong    = BUS.PhongBUS.XemPhong(0, pageSize, pageNumber);
                listPhongLayout = new List <PhongLayout>();
                for (int i = 0; i < listAllPhong.Count; i++)
                {
                    DTO.Phong item = listAllPhong[i];

                    PhongLayout phongLayout = new PhongLayout()
                    {
                        Phong = item, IndexList = i
                    };
                    phongLayout.Ten = item.Ten;

                    phongLayout.BackColor = Color.ForestGreen;

                    phongLayout.setClick((sender, e) =>
                    {
                        indexTruoc = indexHienTai;
                        if (indexTruoc != -1)
                        {
                            listPhongLayout[indexTruoc].BackColor = Color.ForestGreen;
                        }
                        indexHienTai = phongLayout.IndexList;

                        PhongHienTai = phongLayout.Phong;

                        phongLayout.BackColor = Color.Blue;
                    });
                    flowPhongLayout.Controls.Add(phongLayout);

                    listPhongLayout.Add(phongLayout);
                }
                dictionaryAvailableLayout.Add(pageNumber, listPhongLayout);
            }
            else
            {
                listPhongLayout = dictionaryAvailableLayout[pageNumber];
                for (int i = 0; i < listPhongLayout.Count; i++)
                {
                    flowPhongLayout.Controls.Add(listPhongLayout[i]);
                }
            }
        }
Exemple #2
0
        private void hienThiTatCaPhong()
        {
            indexHienTai = -1;
            flowPhongLayout.Controls.Clear();
            if (dictionaryLayout.ContainsKey(pageNumber) == false)
            {
                listAllPhong    = BUS.PhongBUS.XemPhong(-1, pageSize, pageNumber);
                listPhongLayout = new List <PhongLayout>();
                for (int i = 0; i < listAllPhong.Count; i++)
                {
                    DTO.Phong item = listAllPhong[i];

                    PhongLayout phongLayout = new PhongLayout()
                    {
                        Phong = item, IndexList = i
                    };
                    phongLayout.Ten  = item.Ten;
                    phongLayout.Loai = item.TenLoai;
                    if (item.TinhTrang == 0)
                    {
                        phongLayout.BackColor = Color.ForestGreen;
                    }
                    else
                    {
                        phongLayout.BackColor = Color.DarkRed;
                    }

                    phongLayout.setClick((sender, e) =>
                    {
                        if (!dictionaryDatTiec.ContainsKey(phongLayout.Phong.Ten))
                        {
                            listPhieuDatTiec = PhieuDatTiecBUS.XemPhieuDatCho(phongLayout.Phong.Ten, 1, totalPage);
                            dictionaryDatTiec.Add(phongLayout.Phong.Ten, listPhieuDatTiec);
                        }
                        else
                        {
                            listPhieuDatTiec = dictionaryDatTiec[phongLayout.Phong.Ten];
                        }

                        bindingSource.DataSource = listPhieuDatTiec;

                        indexTruoc = indexHienTai;
                        if (indexTruoc != -1)
                        {
                            if (listPhongLayout[indexTruoc].Phong.TinhTrang == 0)
                            {
                                listPhongLayout[indexTruoc].BackColor = Color.ForestGreen;
                            }
                            else
                            {
                                listPhongLayout[indexTruoc].BackColor = Color.DarkRed;
                            }
                        }
                        indexHienTai = phongLayout.IndexList;

                        PhongHienTai = phongLayout.Phong;

                        phongLayout.BackColor = Color.Blue;

                        //if (PhongHienTai.TinhTrang == 0)
                        //{
                        //    txtTenKhachHang.ReadOnly = false;
                        //    txtSDT.ReadOnly = false;
                        //}
                        //else
                        //{
                        //    txtTenKhachHang.ReadOnly = true;
                        //    txtSDT.ReadOnly = true;
                        //}
                    });
                    flowPhongLayout.Controls.Add(phongLayout);

                    listPhongLayout.Add(phongLayout);
                }
                dictionaryLayout.Add(pageNumber, listPhongLayout);
            }
            else
            {
                listPhongLayout = dictionaryLayout[pageNumber];
                for (int i = 0; i < listPhongLayout.Count; i++)
                {
                    flowPhongLayout.Controls.Add(listPhongLayout[i]);
                }
            }
        }
Exemple #3
0
        private void hienThiTatCaPhong()
        {
            indexHienTai = -1;
            flowPhongLayout.Controls.Clear();
            if (dictionaryHienTai.ContainsKey(pageNumber) == false)
            {
                listAllPhong    = BUS.PhongBUS.XemPhong((int)trangThai, pageSize, pageNumber);
                listPhongLayout = new List <PhongLayout>();
                for (int i = 0; i < listAllPhong.Count; i++)
                {
                    DTO.Phong item = listAllPhong[i];

                    PhongLayout phongLayout = new PhongLayout()
                    {
                        Phong = item, IndexList = i
                    };
                    phongLayout.Ten = item.Ten;
                    if (item.TinhTrang == 0)
                    {
                        phongLayout.BackColor = Color.ForestGreen;
                    }
                    else
                    {
                        phongLayout.BackColor = Color.DarkRed;
                    }

                    phongLayout.setClick((sender, e) =>
                    {
                        indexTruoc = indexHienTai;
                        if (indexTruoc != -1)
                        {
                            if (listPhongLayout[indexTruoc].Phong.TinhTrang == 0)
                            {
                                listPhongLayout[indexTruoc].BackColor = Color.ForestGreen;
                            }
                            else
                            {
                                listPhongLayout[indexTruoc].BackColor = Color.DarkRed;
                            }
                        }
                        indexHienTai = phongLayout.IndexList;

                        PhongHienTai = phongLayout.Phong;

                        phongLayout.BackColor = Color.Blue;

                        if (PhongHienTai.TinhTrang == 0)
                        {
                            txtTenKhachHang.ReadOnly = false;
                            txtSDT.ReadOnly          = false;
                        }
                        else
                        {
                            txtTenKhachHang.ReadOnly = true;
                            txtSDT.ReadOnly          = true;
                        }
                    });
                    flowPhongLayout.Controls.Add(phongLayout);

                    listPhongLayout.Add(phongLayout);
                }
                dictionaryHienTai.Add(pageNumber, listPhongLayout);
            }
            else
            {
                listPhongLayout = dictionaryHienTai[pageNumber];
                for (int i = 0; i < listPhongLayout.Count; i++)
                {
                    flowPhongLayout.Controls.Add(listPhongLayout[i]);
                }
            }
        }