Пример #1
0
        private void phiếuThuêToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormPhieuThuePhong frmPhieuThuePhong = new FormPhieuThuePhong();

            frmPhieuThuePhong.frmMain = this;
            frmPhieuThuePhong.ShowDialog();
        }
Пример #2
0
        private void dịchVụToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (lsvMain.SelectedItems.Count <= 0)
            {
                MessageBox.Show("chon mot phong!!!");
                return;
            }

            PhongDTO pDTO = client.getPhongByID(lsvMain.SelectedItems[0].Text);

            if (pDTO.Danhan == true)
            {
                string mpt = "";

                IList <ChiTietDatPhongDTO> listctdp = client1.getListChiTietDatPhongByName(pDTO.Maphong);
                foreach (ChiTietDatPhongDTO ctdp in listctdp)
                {
                    PhieuDatPhongDTO          pdp = client2.getPhieuDatPhongByID(ctdp.Maphieudat);
                    IList <PhieuThuePhongDTO> ptp = client3.getListPhieuThuePhongByMaPhieuDat(pdp.Maphieudat);
                    if (ptp != null)
                    {
                        foreach (PhieuThuePhongDTO pt in ptp)
                        {
                            mpt = pt.Maphieuthue;
                        }
                    }
                }
                FormPhieuThuePhong frmPTP = new FormPhieuThuePhong();
                frmPTP.frmMain     = this;
                frmPTP.maphong     = pDTO.Maphong;
                frmPTP.maphieuthue = mpt;
                frmPTP.ShowDialog();
            }
            else
            {
                MessageBox.Show("Phòng chưa có người!");
                return;
            }
        }
Пример #3
0
 private void phiếuThuêToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormPhieuThuePhong frmPhieuThuePhong = new FormPhieuThuePhong();
     frmPhieuThuePhong.frmMain = this;
     frmPhieuThuePhong.ShowDialog();
 }
Пример #4
0
        private void dịchVụToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (lsvMain.SelectedItems.Count <= 0)
            {
                MessageBox.Show("chon mot phong!!!");
                return;
            }

            PhongDTO pDTO = client.getPhongByID(lsvMain.SelectedItems[0].Text);
            if (pDTO.Danhan == true)
            {
                string mpt="";

                IList<ChiTietDatPhongDTO> listctdp = client1.getListChiTietDatPhongByName(pDTO.Maphong);
                foreach (ChiTietDatPhongDTO ctdp in listctdp)
                {

                    PhieuDatPhongDTO pdp = client2.getPhieuDatPhongByID(ctdp.Maphieudat);
                    IList<PhieuThuePhongDTO> ptp = client3.getListPhieuThuePhongByMaPhieuDat(pdp.Maphieudat);
                    if (ptp != null)
                    {
                        foreach (PhieuThuePhongDTO pt in ptp)
                        {
                            mpt = pt.Maphieuthue;
                        }
                    }
                }
                FormPhieuThuePhong frmPTP = new FormPhieuThuePhong();
                frmPTP.frmMain = this;
                frmPTP.maphong = pDTO.Maphong;
                frmPTP.maphieuthue = mpt;
                frmPTP.ShowDialog();

            }
            else
            {
                MessageBox.Show("Phòng chưa có người!");
                return;
            }
        }
        //Xử lý nhận phòng
        private void button1_NhanPhong_Click(object sender, EventArgs e)
        {
            if (lsvDSPhieuDatPhong.SelectedItems.Count <= 0)
                 MessageBox.Show("Chọn một phiếu đặt phòng!!!");
            else
                if (DateTime.Parse(lsvDSPhieuDatPhong.SelectedItems[0].SubItems[3].Text) == DateTime.Now.Date)
                {
                    if (lsvDSPhieuDatPhong.SelectedItems[0].SubItems[5].Text == "waitting")
                    {
                        string maphieudat = lsvDSPhieuDatPhong.SelectedItems[0].SubItems[0].Text;

                        PhieuDatPhongDTO listpdp = pdp .getPhieuDatPhongByID(maphieudat);
                        pdpDTO = new PhieuDatPhongDTO();
                        pdpDTO.Maphieudat = listpdp.Maphieudat;
                        pdpDTO.Makhachhang = listpdp.Makhachhang;
                        pdpDTO.Ngayden = listpdp.Ngayden;
                        pdpDTO.Ngaydi = listpdp.Ngaydi;
                        pdpDTO.Songuoi = listpdp.Songuoi;
                        pdpDTO.Sotiendatcoc = listpdp.Sotiendatcoc;
                        pdpDTO.Tinhtrang = "busy";
                        pdp.updatePhieuDatPhong(pdpDTO);

                        IList<ChiTietDatPhongDTO> listctdp = ctp.getChiTietDatPhongByID(maphieudat);
                        foreach (ChiTietDatPhongDTO ctpd in listctdp)
                        {

                            PhongDTO listp = phong .getPhongByID(ctpd.Maphong);
                            pDTO = new PhongDTO();
                            pDTO.Maphong = listp.Maphong;
                            pDTO.Maloai = listp.Maloai;
                            pDTO.Dadat = false;
                            pDTO.Danhan = true;
                            phong.updatePhong(pDTO);
                        }

                        show_lsvPDP();

                        frmPThuePhong = new FormPhieuThuePhong();
                        frmPThuePhong.frmPDatPhong = this;
                        frmPThuePhong.frmMain = frmMain;
                        frmPThuePhong.maphieudat = maphieudat;
                        frmPThuePhong.ShowDialog();
                        chang = false;
                        Nochangden = false;
                        Nochangdi = false;
                        labMaPD.Text = "PDP00" + newid();
                        lsvChiTiet.Groups[1].Items[0].SubItems[1].Text = "";
                        lsvChiTiet.Groups[1].Items[1].SubItems[1].Text = "";
                        lsvChiTiet.Groups[1].Items[2].SubItems[1].Text = "";
                        txtSonguoi.Clear();
                        lsvViewPhong.Items.Clear();
                        frmMain.capnhatphong();
                    }
                    else
                    {
                        MessageBox.Show("Lỗi! Chỉ có thể Nhận các Phiếu WAITTING!!!");
                        labMaPD.Text = "PDP00" + newid();
                        chang = false;
                        Nochangden = false;
                        Nochangdi = false;
                        labMaPD.Text = "PDP00" + newid();
                        lsvChiTiet.Groups[1].Items[0].SubItems[1].Text = "";
                        lsvChiTiet.Groups[1].Items[1].SubItems[1].Text = "";
                        lsvChiTiet.Groups[1].Items[2].SubItems[1].Text = "";
                        txtSonguoi.Clear();
                        lsvViewPhong.Items.Clear();
                        return;
                    }
                }
                else
                {
                    chang = false;
                    Nochangden = false;
                    Nochangdi = false;
                    labMaPD.Text = "PDP00" + newid();
                    lsvChiTiet.Groups[1].Items[0].SubItems[1].Text = "";
                    lsvChiTiet.Groups[1].Items[1].SubItems[1].Text = "";
                    lsvChiTiet.Groups[1].Items[2].SubItems[1].Text = "";
                    txtSonguoi.Clear();
                    lsvViewPhong.Items.Clear();
                    labMaPD.Text = "PDP00" + newid();
                    MessageBox.Show("Chưa đến thời gian nhận phòng!");
                    return;
                }
        }