Exemplo n.º 1
0
        public void hienthiPKS(int j)
        {
            CPhong phong = arrPKS[j];

            txtSoPhong.Text   = phong.Sophong.ToString();
            cbxLoaiphong.Text = phong.Loaiphong;
            cbxTrangthai.Text = phong.Trangthai;
            txtGia.Text       = phong.Gia.ToString();
        }
Exemplo n.º 2
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            CPhong phong = (CPhong)arrPKS[i];

            phong.Sophong   = Convert.ToInt32(txtSoPhong.Text);
            phong.Loaiphong = cbxLoaiphong.Text;
            phong.Trangthai = cbxTrangthai.Text;
            phong.Gia       = txtGia.Text;
            hienthi();
        }
Exemplo n.º 3
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            CPhong phong = (CPhong)frmmng.Data.ArrPKS[i];

            phong.Sophong   = Convert.ToInt32(txtSoPhong.Text);
            phong.Loaiphong = cbxLoaiphong.Text;
            phong.Trangthai = cbxTrangthai.Text;
            phong.Gia       = int.Parse(txtGia.Text);
            setupGiaPhong(phong.Loaiphong, phong.Gia);
            syncGiaPhong(phong.Loaiphong);
            hienthi();
        }
Exemplo n.º 4
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            CPhong phong = new CPhong();

            phong.Sophong   = Convert.ToInt32(txtSoPhong.Text);
            phong.Loaiphong = cbxLoaiphong.Text;
            phong.Trangthai = cbxTrangthai.Text;
            phong.Gia       = txtGia.Text;
            arrPKS.Add(phong);
            i++;
            hienthi();
        }
Exemplo n.º 5
0
 private void PhongKS_Load(object sender, EventArgs e)
 {
     arrPKS = new List <CPhong>();
     OpenP("dsp.txt");
     if (arrPKS.Count > 0)
     {
         hienthi();
         CPhong pdon = TimpDon();
         setupGiaPhong(pdon.Loaiphong, pdon.Gia);
         CPhong pdoi = TimpDoi();
         setupGiaPhong(pdoi.Loaiphong, pdoi.Gia);
         CPhong pcc = TimpCC();
         setupGiaPhong(pcc.Loaiphong, pcc.Gia);
     }
 }
Exemplo n.º 6
0
        private CPhong TimpDoi()
        {
            CPhong pdoi = null;

            if (arrPKS.Count > 0)
            {
                foreach (CPhong p  in arrPKS)
                {
                    if (string.Compare(p.Loaiphong, "Đôi") == 0)
                    {
                        pdoi = p;
                        break;
                    }
                }
            }
            return(pdoi);
        }
Exemplo n.º 7
0
        private CPhong TimpCC()
        {
            CPhong pCC = null;

            if (arrPKS.Count > 0)
            {
                foreach (CPhong p in arrPKS)
                {
                    if (string.Compare(p.Loaiphong, "Cao cấp") == 0)
                    {
                        pCC = p;
                        break;
                    }
                }
            }
            return(pCC);
        }
Exemplo n.º 8
0
        private CPhong TimpDon()
        {
            CPhong pdon = null;

            if (frmmng.Data.ArrPKS.Count > 0)
            {
                foreach (CPhong p  in frmmng.Data.ArrPKS)
                {
                    if (string.Compare(p.Loaiphong, "Đơn") == 0)
                    {
                        pdon = p;
                        break;
                    }
                }
            }
            return(pdon);
        }
Exemplo n.º 9
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            CPhong phong = new CPhong();

            if (checkSoPhong(Convert.ToInt32(txtSoPhong.Text)))
            {
                return;
            }
            phong.Sophong   = Convert.ToInt32(txtSoPhong.Text);
            phong.Loaiphong = cbxLoaiphong.Text;
            phong.Trangthai = cbxTrangthai.Text;
            phong.Gia       = int.Parse(txtGia.Text);
            arrPKS.Add(phong);
            i++;
            setupGiaPhong(phong.Loaiphong, phong.Gia);
            syncGiaPhong(phong.Loaiphong);
            hienthi();
        }
Exemplo n.º 10
0
 private void PhongKS_Load(object sender, EventArgs e)
 {
     frmmng.Data.OpenP("dsp.txt");
     if (frmmng.Data.ArrPKS.Count > 0)
     {
         hienthi();
         CPhong pdon = TimpDon();
         if (pdon != null)
         {
             setupGiaPhong(pdon.Loaiphong, pdon.Gia);
         }
         CPhong pdoi = TimpDoi();
         if (pdoi != null)
         {
             setupGiaPhong(pdoi.Loaiphong, pdoi.Gia);
         }
         CPhong pcc = TimpCC();
         if (pcc != null)
         {
             setupGiaPhong(pcc.Loaiphong, pcc.Gia);
         }
     }
 }
Exemplo n.º 11
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (radSetup.Checked == true)
            {
                bool tontai_kh_old = false;
                if (txtSoPhong.Text == "")
                {
                    MessageBox.Show("Các TH:\n" +
                                    "- NV chưa chọn Loại Phòng để có số Phòng\n" +
                                    "- Loại Phòng đó đã Hết", "Error");
                    return;
                }
                layTenKHvaCMND(cbxHoten.Text);
                string hotenkh   = sTenKH;
                int    socmnd    = iCMND;
                int    sophong   = int.Parse(txtSoPhong.Text);
                string loaiphong = cbxLoaiphong.Text;
                if (frmmng.Data.ArrDP.Count > 0)
                {
                    foreach (CDatPhong item in frmmng.Data.ArrDP)
                    {
                        if (item.Kh.CMND == iCMND)
                        {
                            tontai_kh_old = true;
                            CPhong p = new CPhong();
                            p.Sophong   = sophong;
                            p.Loaiphong = loaiphong;
                            p.Gia       = timGiaPhong(p.Loaiphong);

                            item.Phong.Add(p);

                            txtSoNgayO.Text = item.SoNgayO().ToString();

                            txtThanhTien.Text = item.ThanhTien(loaiphong).ToString();
                            setupBookedP(sophong, loaiphong);

                            CleanDP();
                            hienthi();

                            foreach (CBill bill in frmmng.Data.ArrBill)
                            {
                                if (bill.Kh.CMND == iCMND)
                                {
                                    bill.Dp = item;
                                    break;
                                }
                            }
                            break;
                        }
                    }
                }
                if (!tontai_kh_old)
                {
                    DateTime ngayden = dtpNgayden.Value;
                    DateTime ngaydi  = dtpNgaydi.Value;

                    CDatPhong dp = new CDatPhong();
                    dp.Kh.Hoten = hotenkh;
                    dp.Kh.CMND  = socmnd;
                    dp.Ngayden  = ngayden;
                    dp.Ngaydi   = ngaydi;

                    CPhong Phong = new CPhong();
                    Phong.Sophong   = sophong;
                    Phong.Loaiphong = loaiphong;
                    Phong.Gia       = timGiaPhong(Phong.Loaiphong);

                    dp.Phong.Add(Phong);

                    frmmng.Data.ArrDP.Add(dp);
                    txtSoNgayO.Text = dp.SoNgayO().ToString();

                    txtThanhTien.Text = dp.ThanhTien(loaiphong).ToString();
                    setupBookedP(sophong, loaiphong);

                    i++;
                    CleanDP();
                    hienthi();

                    foreach (CBill item in frmmng.Data.ArrBill)
                    {
                        if (item.Kh.CMND == dp.Kh.CMND)
                        {
                            item.Dp = dp;
                            break;
                        }
                    }
                }
                lvwChooseP.Items.Clear();
            }
        }