Esempio n. 1
0
        public void RefreshDataBinding_ReadOnly(ThuePhongDTO thuePhong)
        {
            this.thuePhong = thuePhong;

            txtGioVao.Time = thuePhong.GioThuePhong;
            txtGioRa.Time  = (thuePhong.GioTraPhong == DateTime.MinValue) ? DateTime.Now : thuePhong.GioTraPhong;
            txtTienGio.Properties.NullText = thuePhong.TienGio.ToString("###,###,##0 VNĐ");
            TongTienGio = thuePhong.TienGio;

            txtTienGio.ReadOnly = true;
            gridView1.OptionsBehavior.ReadOnly = true;

            dichVuPhong = DichVuPhongBUS.LayTatCaDichVuPhong_DichVu(thuePhong);
            dichVuPhong.Columns.Add(new DataColumn("colType"));
            foreach (DataRow row in dichVuPhong.Rows)
            {
                if ((int)row["MaLDV"] == 3)
                {
                    row["colType"] = "Khuyến mãi";
                }
                else
                {
                    row["colType"] = "Dịch vụ";
                }
            }

            gridControl1.DataSource = dichVuPhong;
        }
Esempio n. 2
0
 public void LuuThongTinDichVuPhong(ThuePhongDTO tp)
 {
     foreach (DataRow dr in dichVuPhong.Rows)
     {
         DichVuPhongBUS.LuuThongTinDichVuPhong(new DichVuPhongDTO(DichVuPhongBUS.PhatSinhMaDichVuPhong(), tp.MaThuePhong, (int)dr["MaDichVu"], DateTime.Now, (double)dr["SoLuong"], (double)dr["Gia"]));
     }
 }
Esempio n. 3
0
        void DisplayChuyenPhongWithSelectedTile(ThuePhongDTO thuePhong = null)
        {
            //DTO.PhongDTO phongDTO = new DTO.PhongDTO((int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaPhong"), (string)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "TenPhong"), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaLoaiPhong"), tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "Tang").ToString(), tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "GhiChu").ToString(), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaTinhTrangPhong"));
            ThuePhongDTO thuePhongDto;

            if (thuePhong == null)
            {
                thuePhongDto = listPhongDangThue[(int)danhSachPhong.Rows[tileView1.GetFocusedDataSourceRowIndex()]["MaPhong"]];
            }
            else
            {
                thuePhongDto = thuePhong;
            }

            ChuyenPhong formChuyenPhong = new ChuyenPhong(thuePhongDto);

            if (FlyoutDialog.Show(this.FindForm(), formChuyenPhong) == DialogResult.OK)
            {
                DisplayTinhTrangPhongWithSelectedTile(formChuyenPhong.GetThuePhongMoi());
            }
            else
            {
            }

            //this.TinhtrangPagecontrol.SelectedPage = PageThanhtoan;
        }
Esempio n. 4
0
        public void HienThiThongTinPhong(ThuePhongDTO dto)
        {
            DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(WaitForm1));
            thongTinChiTietNhieuPhong1.RefreshDataBinding(dto, DisplayThanhToanPhongWithSelectedTile);



            DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
            this.TinhtrangPagecontrol.SelectedPage = PageXemphong;
        }
        //Dictionary<DichVuPhongDTO> listDichVuPhong;



        public ThongTinChiTietPhong()
        {
            InitializeComponent();

            phong     = null;
            khachHang = null;
            thuePhong = null;

            schedulerControl1.GoToToday();
        }
Esempio n. 6
0
        public ChuyenPhong(ThuePhongDTO phongCu) : this()
        {
            this.phongCu = phongCu;

            // this.onThuePhongSuccess = onThuePhongSuccess;

            RefreshDataBinding_ChuyenPhong();


            ValidateChildren();
        }
Esempio n. 7
0
        public static ThongTinThanhToan TinhTienThuePhong(ThuePhongDTO thuePhongDTO, DateTime gioKetThuc)
        {
            ThongTinThanhToan thongTinThanhToan  = new ThongTinThanhToan();
            List <ThongTinThanhToanTheoNgay> res = new List <ThongTinThanhToanTheoNgay>();

            int maLoaiPhong = PhongBUS.LayThongTinPhong(thuePhongDTO.MaPhong).MaLoaiPhong;
            //ThuePhongDTO thuePhongDTO = ThuePhongBUS.LayThongTinPhongDangThue(phong);

            List <Ngay> listNgay = new List <Ngay>();

            for (var day = thuePhongDTO.GioThuePhong.Date; day.Date <= gioKetThuc.Date; day = day.AddDays(1))
            {
                if (thuePhongDTO.GioThuePhong.Date == gioKetThuc.Date)
                {
                    listNgay.Add(new Ngay(day.DayOfWeek.ToString(), new Gio(thuePhongDTO.GioThuePhong), new Gio(gioKetThuc), day));
                    break;
                }

                if (listNgay.Count == 0)
                {
                    listNgay.Add(new Ngay(day.DayOfWeek.ToString(), new Gio(thuePhongDTO.GioThuePhong), new Gio(24, 0, 0), day));
                }
                else if (day.AddDays(1) <= DateTime.Now.Date)
                {
                    listNgay.Add(new Ngay(day.DayOfWeek.ToString(), new Gio(0, 0, 0), new Gio(24, 0, 0), day));
                }
                else
                {
                    listNgay.Add(new Ngay(day.DayOfWeek.ToString(), new Gio(0, 0, 0), new Gio(gioKetThuc), day));
                }
            }

            List <NgayLeDTO> listNgayLe = NgayLeBUS.LayTatCaNgayLe_List();

            for (int i = 0; i < listNgay.Count; i++)
            {
                foreach (NgayLeDTO ngayLe in listNgayLe)
                {
                    if (listNgay[i].date.Day == ngayLe.NgayLe.Day && listNgay[i].date.Month == ngayLe.NgayLe.Month)
                    {
                        listNgay[i].Thu = "Ngày lễ";
                        break;
                    }
                }

                res.Add(TinhTienTheoNgay(listNgay[i], maLoaiPhong));
                thongTinThanhToan.TongThanhTien += res[i].TongThanhTien;
            }


            thongTinThanhToan.listThongTin = res;

            return(thongTinThanhToan);
        }
Esempio n. 8
0
        private void windowsUIButtonPanel1_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            switch (e.Button.Properties.Tag.ToString())
            {
            case "Hủy":
                ((FlyoutDialog)this.Parent).Hide();
                break;

            case "Thuê":


                //NOTE Tài khoản thanh toán
                //BÌNH

                foreach (PhongDTO phong in selectedPhong.Values)
                {
                    if (PhongBUS.LayThongTinPhong(phong.MaPhong).MaTinhTrangPhong != 0)
                    {
                        XtraMessageBox.Show("Phòng " + phong.TenPhong + " hiện không có sẵn! Vui lòng chọn lại phòng khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);


                        txtPhong.Properties.DataSource = dtPhong = PhongBUS.LayTatCaPhong_TinhTrangPhong_LoaiPhong_CoSan();


                        selectedPhong.Clear();
                        txtPhong.Refresh();
                        return;
                    }
                }


                ThuePhongDTO tp = null;
                foreach (PhongDTO phong in selectedPhong.Values)
                {
                    tp = new ThuePhongDTO(ThuePhongBUS.PhatSinhMaThuePhong(), phong.MaPhong, (DateTime)txtGioVao.EditValue, DateTime.MinValue, hoaDon.MaHoaDon, double.NaN);
                    ThuePhongBUS.LuuThongTinThuePhong(tp);
                    PhongBUS.CapNhatTinhTrangPhong(phong, 1);
                }



                //Thông báo thành công
                onThuePhongSuccess();

                ((FlyoutDialog)this.Parent).Hide();



                break;

            default:
                break;
            }
        }
Esempio n. 9
0
        static public bool IsExist(ThuePhongDTO tp)
        {
            string sql = "select * from ThuePhong where MaPhong = " + tp.MaPhong + " and MaKhach = " + tp.MaKhach +
                         " and NgayBatDauThue = '" + tp.NgayBatDauThue.ToString("MM-dd-yyyy HH:mm:ss.fff") + "'";
            DataTable table = xldulieu.LoadData(sql);

            if (table.Rows.Count < 1)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 10
0
        public List <ThuePhongDTO> GetThuePhong()
        {
            List <ThuePhongDTO> list = new List <ThuePhongDTO>();
            DataTable           data = DataProvider.Instance.ExecuteQuery("dbo.USP_GetDSThuePhong");

            foreach (DataRow item in data.Rows)
            {
                ThuePhongDTO thuephong = new ThuePhongDTO(item);
                list.Add(thuephong);
            }
            return(list);
        }
Esempio n. 11
0
        public List <ThuePhongDTO> SearchThuePhong(string str)
        {
            List <ThuePhongDTO> ThuePhongList = new List <ThuePhongDTO>();
            DataTable           data          = DataProvider.Instance.ExecuteQuery("EXEC USP_SearchThuePhong @search ", new object[] { str });

            foreach (DataRow item in data.Rows)
            {
                ThuePhongDTO ThuePhong = new ThuePhongDTO(item);
                ThuePhongList.Add(ThuePhong);
            }
            return(ThuePhongList);
        }
Esempio n. 12
0
        static public int Insert(ThuePhongDTO tp)
        {
            if (IsExist(tp))
            {
                return(0);
            }
            string sql = string.Format("Insert into ThuePhong(MaPhong, MaKhach, NgayBatDauThue, SoNgayThue) " +
                                       "Values({0}, {1}, '{2}', {3})", tp.MaPhong, tp.MaKhach,
                                       tp.NgayBatDauThue.ToString("MM-dd-yyyy HH:mm:ss.fff"), tp.SoNgayThue);

            return(xldulieu.Execute(sql));
        }
Esempio n. 13
0
        static public ThuePhongDTO LoadOne(int maPhong)
        {
            string    sql   = "select * from ThuePhong where MaPhong = " + maPhong;
            DataTable table = xldulieu.LoadData(sql);

            if (table.Rows.Count < 1)
            {
                return(null);
            }
            ThuePhongDTO tp = new ThuePhongDTO(table.Rows[0].Field <int>(0), table.Rows[0].Field <int>(1),
                                               table.Rows[0].Field <DateTime>(2), table.Rows[0].Field <int>(3));

            return(tp);
        }
        public void RefreshDataBinding(ThuePhongDTO thuePhongDTO, Action <ThuePhongDTO> goToThanhToan)
        {
            this.goToThanhToan = goToThanhToan;
            this.thuePhongDTO  = thuePhongDTO;

            TabControl.TabPages.Clear();

            this.hoaDon = BUS.HoaDonBUS.LayThongTinHoaDonDangThue(thuePhongDTO.MaHoaDon);


            foreach (ThuePhongDTO thuePhong in HoaDonBUS.LayTatCaCacThuePhong(hoaDon.MaHoaDon))
            {
                ThongTinChiTietPhong thongTinChiTietPhong = new ThongTinChiTietPhong();
                thongTinChiTietPhong.RefreshDataBinding(PhongBUS.LayThongTinPhong(thuePhong.MaPhong), thuePhong);
                thongTinChiTietPhong.SetActionThanhToanButton(goToThanhToan);
                DevExpress.XtraTab.XtraTabPage xtraTab = new DevExpress.XtraTab.XtraTabPage();

                //
                // thongTinChiTietPhong1
                //
                thongTinChiTietPhong.Appearance.BackColor            = System.Drawing.Color.White;
                thongTinChiTietPhong.Appearance.Options.UseBackColor = true;
                thongTinChiTietPhong.Dock     = System.Windows.Forms.DockStyle.Fill;
                thongTinChiTietPhong.Location = new System.Drawing.Point(0, 0);
                thongTinChiTietPhong.Name     = "thongTinChiTietPhong1";
                thongTinChiTietPhong.Size     = new System.Drawing.Size(989, 591);
                thongTinChiTietPhong.TabIndex = 0;
                thongTinChiTietPhong.Load    += new System.EventHandler(this.thongTinChiTietPhong1_Load);

                //
                // tab1
                //
                xtraTab.Controls.Add(thongTinChiTietPhong);
                xtraTab.Name = thongTinChiTietPhong.phong.MaPhong.ToString();
                xtraTab.Size = new System.Drawing.Size(989, 591);
                xtraTab.Text = thongTinChiTietPhong.phong.TenPhong;
                xtraTab.Tag  = thongTinChiTietPhong.phong.MaPhong;
                //
                this.TabControl.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { xtraTab });
            }

            foreach (XtraTabPage tab in this.TabControl.TabPages)
            {
                if ((int)tab.Tag == thuePhongDTO.MaPhong)
                {
                    this.TabControl.SelectedTabPage = tab;
                    break;
                }
            }
        }
        public void NhanPhong()
        {
            foreach (ChiTietDatPhongDTO chiTiet in DatPhongBUS.LayTatCaCacChiTietDatPhong(datPhong.MaDatPhong))
            {
                PhongDTO phongDto = PhongBUS.LayThongTinPhong(chiTiet.MaPhong);
                if (phongDto.MaTinhTrangPhong == 1 || phongDto.MaTinhTrangPhong == 7)
                {
                    XtraMessageBox.Show("Phòng " + phongDto.TenPhong + " đang được sử dụng nên không thể nhận được!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else if (phongDto.MaTinhTrangPhong == 5 || phongDto.MaTinhTrangPhong == 6)
                {
                    XtraMessageBox.Show("Phòng " + phongDto.TenPhong + " đang chờ dọn dẹp! Hãy dọn dẹp trước khi nhận phòng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else if (phongDto.MaTinhTrangPhong == 2)
                {
                    XtraMessageBox.Show("Phòng " + phongDto.TenPhong + " đang sửa chữa! Vui lòng chuyển đặt phòng sang phòng khác hoặc chuyển tình trạng phòng sang bình thường!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else if (phongDto.MaTinhTrangPhong == 3)
                {
                    XtraMessageBox.Show("Phòng " + phongDto.TenPhong + " đã bị xóa, không thể nhận phòng! Vui lòng chuyển đặt phòng sang phòng khác! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            //Phát sinh hóa đơn

            HoaDonDTO hoaDon = new HoaDonDTO(HoaDonBUS.PhatSinhMaHoaDon(), (this.ParentForm as MainForm).nhanVien.MaNhanVien, Double.NaN, datPhong.SoTienDatTruoc, DateTime.MinValue, Double.NaN, datPhong.GhiChu, khachHang.MaKH, datPhong.MaDatPhong);

            HoaDonBUS.LuuThongTinHoaDon(hoaDon);

            ThuePhongDTO tp = null;



            foreach (XtraTabPage xtraTab in this.TabControl.TabPages)
            {
                tp = new ThuePhongDTO(ThuePhongBUS.PhatSinhMaThuePhong(), (xtraTab.Tag as ThongTinChiTietDatPhong).chiTietDatPhong.MaPhong, DateTime.Now, DateTime.MinValue, hoaDon.MaHoaDon, double.NaN);
                ThuePhongBUS.LuuThongTinThuePhong(tp);
                PhongBUS.CapNhatTinhTrangPhong((xtraTab.Tag as ThongTinChiTietDatPhong).chiTietDatPhong.MaPhong, 1);


                (xtraTab.Tag as ThongTinChiTietDatPhong).LuuThongTinDichVuPhong(tp);
            }

            DatPhongBUS.CapNhatTinhTrangDatPhong(2, datPhong.MaDatPhong);
            (this.ParentForm as MainForm).HienThiThongTinPhong(tp);
        }
Esempio n. 16
0
        public static Dictionary <int, ThuePhongDTO> LayThongTinPhongDangDuocThue()
        {
            Dictionary <int, ThuePhongDTO> res = new Dictionary <int, ThuePhongDTO>();

            DataTable dt = DAL.DataProvider.ExecuseQuery("SELECT * FROM thuephong WHERE thuephong.MaHoaDon IN (SELECT hoadon.MaHoaDon FROM hoadon WHERE hoadon.TongTienThanhToan IS NULL) AND  (thuephong.GioTraPhong  IS NULL )");

            foreach (DataRow row in dt.Rows)
            {
                ThuePhongDTO thuePhongDTO = new ThuePhongDTO((int)row["MaThuePhong"], (int)row["MaPhong"], DateTime.Parse(row["GioThuePhong"].ToString()), (row["GioTraPhong"].ToString() == "") ?(DateTime.MinValue):DateTime.Parse(row["GioTraPhong"].ToString()), (int)row["MaHoaDon"], (dt.Rows[0]["TienGio"].ToString() == "") ? (Double.NaN) : ((double)dt.Rows[0]["TienGio"]));


                res.Add(thuePhongDTO.MaPhong, thuePhongDTO);
            }

            return(res);
        }
Esempio n. 17
0
        private void BtnThuePhong_Click(object sender, RoutedEventArgs e)
        {
            string ngayThue = txtNgayThue.Text;

            int maPhong = Int32.Parse(txtMaPhong.Text);

            if (ngayThue.Equals(""))
            {
                MessageBox.Show("Hãy chọn Ngày thuê phòng", "Thông báo");
                return;
            }
            DateTime dateTime = Convert.ToDateTime(ngayThue);

            if (dgDanhSach.Items.Count < 1)
            {
                MessageBox.Show("Hãy thêm khách hàng", "Thông báo");
                return;
            }
            if (MessageBox.Show("Xác nhận thuê phòng?", "Thông báo", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                return;
            }
            for (int i = 0; i < dgDanhSach.Items.Count; i++)
            {
                TextBlock    a  = dgDanhSach.Columns[0].GetCellContent(dgDanhSach.Items[i]) as TextBlock;
                ThuePhongDTO tp = new ThuePhongDTO(maPhong, Int32.Parse(a.Text), dateTime, 0);
                ThuePhongDAO.Insert(tp);
            }
            if (ThuePhongDAO.LoadByMaPhong(maPhong).Rows.Count < 1)
            {
                MessageBox.Show("Đã có lỗi xảy ra\r\nXin mời thử lại", "Thông báo");
                this.Close();
                return;
            }
            PhongDAO.SetTinhTrangPhong(maPhong, 2);
            PhongDAO.SetTrangThaiPhong(maPhong, 1);

            DatPhong dp = DatPhongDAO.LoadOne(maPhong);

            if (dp != null)
            {
                DatPhongDAO.Delete(maPhong);
            }

            MessageBox.Show("Đăng ký thuê phòng thành công!\r\nHãy bấm Cập nhật để tải lại danh sách phòng!", "Thông báo");
            this.Close();
        }
Esempio n. 18
0
        void DisplayThanhToanPhongWithSelectedTile(ThuePhongDTO thuePhong = null)
        {
            //DTO.PhongDTO phongDTO = new DTO.PhongDTO((int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaPhong"), (string)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "TenPhong"), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaLoaiPhong"), tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "Tang").ToString(), tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "GhiChu").ToString(), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaTinhTrangPhong"));

            DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(WaitForm1));
            if (thuePhong == null)
            {
                thanhToan1.RefreshDataBinding(listPhongDangThue[(int)danhSachPhong.Rows[tileView1.GetFocusedDataSourceRowIndex()]["MaPhong"]]);
            }
            else
            {
                thanhToan1.RefreshDataBinding(thuePhong);
            }
            DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();

            this.TinhtrangPagecontrol.SelectedPage = PageThanhtoan;
        }
Esempio n. 19
0
        private void BtnLuu_Click(object sender, RoutedEventArgs e)
        {
            int          maPhong      = Int32.Parse(txtPhong.Text);
            ThuePhongDTO thuePhongDTO = ThuePhongDAO.LoadOne(maPhong);
            int          maKhach      = thuePhongDTO.MaKhach;

            if (MessageBox.Show("Xác nhận lưu?", "Thông báo", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                return;
            }
            ChiTietDichVuDAO.DeleteByMaPhong(maPhong);
            foreach (DataRow dr in dtGioHang.Rows)
            {
                int maDV    = dr.Field <int>("MaDV");
                int soLuong = dr.Field <int>("SoLuong");
                ChiTietDichVuDAO.Insert(maDV, maKhach, soLuong, maPhong);
            }
            MessageBox.Show("Lưu thành công!", "Thông báo");
        }
Esempio n. 20
0
        public static bool LuuThongTinThuePhong(ThuePhongDTO thuephongDTO)
        {
            try
            {
                StringBuilder strSQL = new StringBuilder("INSERT INTO quanlykaraoke.thuephong (MaThuePhong, MaPhong,  GioThuePhong, GioTraPhong, MaHoaDon, TienGio) VALUES('$0','$1','$2',$3,'$4',$5)");
                strSQL.Replace("$0", thuephongDTO.MaThuePhong.ToString());
                strSQL.Replace("$1", thuephongDTO.MaPhong.ToString());
                strSQL.Replace("$2", thuephongDTO.GioThuePhong.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                strSQL.Replace("$3", (DateTime.Equals(DateTime.MinValue, thuephongDTO.GioTraPhong) ? ("NULL") : ("'" + thuephongDTO.GioTraPhong.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'")));
                strSQL.Replace("$4", thuephongDTO.MaHoaDon.ToString());
                strSQL.Replace("$5", double.IsNaN(thuephongDTO.TienGio)?"NULL": ("'" + thuephongDTO.TienGio.ToString() + "'"));
                DAL.DataProvider.ExecuseNonQuery(strSQL.ToString());

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Esempio n. 21
0
        void DisplayTinhTrangPhongWithSelectedTile(ThuePhongDTO thuePhong = null)
        {
            DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(WaitForm1));
            if (thuePhong == null)
            {
                if (listPhongDangThue.ContainsKey((int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaPhong")))
                {
                    thongTinChiTietNhieuPhong1.RefreshDataBinding(listPhongDangThue[(int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaPhong")], DisplayThanhToanPhongWithSelectedTile);
                }

                else
                {
                    thongTinChiTietNhieuPhong1.RefreshDataBinding(new DTO.PhongDTO((int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaPhong"), (string)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "TenPhong"), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaLoaiPhong"), (string)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "Tang"), tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "GhiChu").ToString(), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "MaTinhTrangPhong"), (int)tileView1.GetRowCellValue(tileView1.GetSelectedRows()[0], "SucChua")), DisplayThanhToanPhongWithSelectedTile);
                }
            }
            else
            {
                thongTinChiTietNhieuPhong1.RefreshDataBinding(thuePhong, DisplayThanhToanPhongWithSelectedTile);
            }


            DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
            this.TinhtrangPagecontrol.SelectedPage = PageXemphong;
        }
Esempio n. 22
0
 public static bool XoaThuePhong(ThuePhongDTO thuePhongDTO)
 {
     return(DAL.ThuePhongDAL.XoaThuePhong(thuePhongDTO));
 }
Esempio n. 23
0
 public static bool CapNhatThongTinThuePhong(ThuePhongDTO thuePhongDTO)
 {
     return(DAL.ThuePhongDAL.CapNhatThongTinThuePhong(thuePhongDTO));
 }
Esempio n. 24
0
 public static bool LuuThongTinThuePhong(ThuePhongDTO thuePhongDTO)
 {
     return(DAL.ThuePhongDAL.LuuThongTinThuePhong(thuePhongDTO));
 }
Esempio n. 25
0
 public static void ThuePhong(ThuePhongDTO thueDTO)
 {
 }
Esempio n. 26
0
        private void windowsUIButtonPanel1_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            switch (e.Button.Properties.Tag.ToString())
            {
            case "Hủy":
                ((FlyoutDialog)this.Parent).DialogResult = DialogResult.Cancel;
                ((FlyoutDialog)this.Parent).Hide();
                break;

            case "Chuyển":
                if (chiTietDatPhong == null)    //Chuyển phong đang thuê
                {
                    if (PhongBUS.LayThongTinPhong(phongMoi.MaPhong).MaTinhTrangPhong != 0)
                    {
                        XtraMessageBox.Show("Phòng " + PhongBUS.LayThongTinPhong((int)txtMaPhong.EditValue).TenPhong + " hiện không có sẵn! Vui lòng chọn lại phòng khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);


                        txtPhong.Properties.DataSource = dtPhong = PhongBUS.LayTatCaPhong_TinhTrangPhong_LoaiPhong_CoSan();

                        txtPhong.EditValue = "";
                        gridView1.ClearSelection();
                        txtPhong.Refresh();

                        txtPhong.ErrorText     = "Không có phòng nào được chọn";
                        txtMaPhong.EditValue   = "";
                        txtLoaiPhong.EditValue = "";
                        txtTang.EditValue      = "";
                        txtGhiChu.EditValue    = "";
                        windowsUIButtonPanel1.Buttons[0].Properties.Visible = false;

                        return;
                    }

                    ThuePhongBUS.CapNhatThongTinThuePhong(new ThuePhongDTO(phongCu.MaThuePhong, phongCu.MaPhong, phongCu.GioThuePhong, DateTime.Now, phongCu.MaHoaDon, Double.NaN));
                    switch (PhongBUS.LayThongTinPhong(phongCu.MaPhong).MaTinhTrangPhong)
                    {
                    case 1:
                        if (ThamSoBUS.LayChuyenSangChoDonDepSauKhiThanhToan())
                        {
                            PhongBUS.CapNhatTinhTrangPhong(phongCu.MaPhong, 5);
                        }
                        else
                        {
                            PhongBUS.CapNhatTinhTrangPhong(phongCu.MaPhong, 0);
                        }
                        break;

                    case 7:
                        if (ThamSoBUS.LayChuyenSangChoDonDepSauKhiThanhToan())
                        {
                            PhongBUS.CapNhatTinhTrangPhong(phongCu.MaPhong, 6);
                        }
                        else
                        {
                            PhongBUS.CapNhatTinhTrangPhong(phongCu.MaPhong, 4);
                        }
                        break;
                    }


                    phongMoi = new ThuePhongDTO(ThuePhongBUS.PhatSinhMaThuePhong(), (int)txtMaPhong.EditValue, DateTime.Now, DateTime.MinValue, phongCu.MaHoaDon, Double.NaN);
                    ThuePhongBUS.LuuThongTinThuePhong(phongMoi);
                    PhongBUS.CapNhatTinhTrangPhong(phongMoi.MaPhong, 1);
                }
                else     //Chuyển phòng đặt
                {
                    if (PhongBUS.LayThongTinPhong(chiTietDatPhong.MaPhong).MaTinhTrangPhong == 4)
                    {
                        PhongBUS.CapNhatTinhTrangPhong(chiTietDatPhong.MaPhong, 0);
                    }
                    else if (PhongBUS.LayThongTinPhong(chiTietDatPhong.MaPhong).MaTinhTrangPhong == 6)
                    {
                        PhongBUS.CapNhatTinhTrangPhong(chiTietDatPhong.MaPhong, 5);
                    }
                    else if (PhongBUS.LayThongTinPhong(chiTietDatPhong.MaPhong).MaTinhTrangPhong == 7)
                    {
                        PhongBUS.CapNhatTinhTrangPhong(chiTietDatPhong.MaPhong, 1);
                    }
                    ChiTietDatPhongBUS.CapNhatThongTinDatPhong(new ChiTietDatPhongDTO(chiTietDatPhong.MaChiTietDatPhong, (int)txtMaPhong.EditValue, chiTietDatPhong.MaDatPhong));
                }

                ((FlyoutDialog)this.Parent).DialogResult = DialogResult.OK;
                ((FlyoutDialog)this.Parent).Hide();
                break;

            default:
                break;
            }
        }
Esempio n. 27
0
        public void RefreshDataBinding(ThuePhongDTO thuePhongDTO, KhachHangDTO khachHangDTO)
        {
            txtTienGio.ReadOnly = false;
            gridView1.OptionsBehavior.ReadOnly = false;

            this.thuePhong = thuePhongDTO;

            txtGioVao.Time = thuePhong.GioThuePhong;
            txtGioRa.Time  = (thuePhong.GioTraPhong == DateTime.MinValue) ?DateTime.Now : thuePhong.GioTraPhong;

            thuePhong.GioTraPhong = txtGioRa.Time;

            listKhuyenMai = new Dictionary <int, DichVuPhongDTO>();

            RefreshDataBindingTienGio();


            loaiKhachHang = LoaiKhachHangBUS.LayLoaiKhachHang(khachHangDTO);


            DichVuPhongDTO dichVuPhongDTO;

            //Kiểm tra các ngày đặt biệt
            foreach (DTO.ThongTinThanhToanTheoNgay ngay in ThanhToanBUS.TinhTienThuePhong(thuePhong, DateTime.Now).listThongTin)
            {
                //Sinh nhật
                if (ngay.ngay.date.Day == khachHangDTO.NgaySinh.Day && ngay.ngay.date.Month == khachHangDTO.NgaySinh.Month && khachHangDTO.MaKH != 0)
                {
                    if (TongTienGio * loaiKhachHang.PhanTramGiamGiaSinhNhat > loaiKhachHang.SoTienGiamGiaSinhNhat_Max)
                    {
                        dichVuPhongDTO = new DichVuPhongDTO(-1, thuePhong.MaThuePhong, 1, DateTime.Now, 1.0, -loaiKhachHang.SoTienGiamGiaSinhNhat_Max);
                    }
                    else if ((TongTienGio * loaiKhachHang.PhanTramGiamGiaSinhNhat < loaiKhachHang.SoTienGiamGiaSinhNhat_Min))
                    {
                        dichVuPhongDTO = new DichVuPhongDTO(-1, thuePhong.MaThuePhong, 1, DateTime.Now, 1.0, -loaiKhachHang.SoTienGiamGiaSinhNhat_Min);
                    }
                    else
                    {
                        dichVuPhongDTO = new DichVuPhongDTO(-1, thuePhong.MaThuePhong, 1, DateTime.Now, 1.0, -(TongTienGio * loaiKhachHang.PhanTramGiamGiaSinhNhat));
                    }

                    if (dichVuPhongDTO.DonGia != 0)
                    {
                        listKhuyenMai.Add(dichVuPhongDTO.MaDVP, dichVuPhongDTO);
                    }
                }
            }

            //KM Loại KH
            if (TongTienGio * loaiKhachHang.PhanTramGiamGia > loaiKhachHang.SoTienGiamGia_Max)
            {
                dichVuPhongDTO = new DichVuPhongDTO(-(listKhuyenMai.Count + 1), thuePhong.MaThuePhong, 2, DateTime.Now, 1.0, -loaiKhachHang.SoTienGiamGia_Max);
            }
            else if ((TongTienGio * loaiKhachHang.PhanTramGiamGia < loaiKhachHang.SoTienGiamGia_Min))
            {
                dichVuPhongDTO = new DichVuPhongDTO(-(listKhuyenMai.Count + 1), thuePhong.MaThuePhong, 2, DateTime.Now, 1.0, -loaiKhachHang.SoTienGiamGia_Min);
            }
            else
            {
                dichVuPhongDTO = new DichVuPhongDTO(-(listKhuyenMai.Count + 1), thuePhong.MaThuePhong, 2, DateTime.Now, 1.0, -(TongTienGio * loaiKhachHang.PhanTramGiamGia));
            }

            if (dichVuPhongDTO.DonGia != 0 && khachHangDTO.MaKH != 0)
            {
                listKhuyenMai.Add(dichVuPhongDTO.MaDVP, dichVuPhongDTO);
            }

            RefreshDataBindingDichVuPhong();
        }
Esempio n. 28
0
 public static bool XoaCacDichVuPhong(ThuePhongDTO thuePhongDTO)
 {
     DAL.DataProvider.ExecuseNonQuery("DELETE FROM dichvuphong WHERE dichvuphong.MaThuePhong = '" + thuePhongDTO.MaThuePhong + "';");
     return(true);
 }
Esempio n. 29
0
        public void RefreshDataBinding(PhongDTO phongDTO, ThuePhongDTO thuePhongDTO = null)
        {
            phong = phongDTO;

            txtMaPhong.EditValue   = phongDTO.MaPhong;
            txtTenPhong.EditValue  = phongDTO.TenPhong;
            txtLoaiPhong.EditValue = BUS.LoaiPhongBUS.LayLoaiPhong(phongDTO).TenLoaiPhong;
            txtTang.EditValue      = phongDTO.Tang;

            RefreshDataBindingDatPhong();

            //Phòng trống
            if (thuePhongDTO == null)
            {
                DisplayControlForRented(false);
                for (int i = 0; i < wbntQuanlyphong.Buttons.Count; i++)
                {
                    wbntQuanlyphong.Buttons[i].Properties.Visible = false;
                }
            }
            else
            {
                DisplayControlForRented(true);

                if (HoaDonBUS.LayThongTinHoaDon(thuePhongDTO.MaHoaDon).MaDatPhong == -1)
                {
                    wbntQuanlyphong.Buttons[7].Properties.Visible = false;
                    wbntQuanlyphong.Buttons["Thông tin đặt phòng"].Properties.Visible = false;
                }

                else
                {
                    wbntQuanlyphong.Buttons["Thông tin đặt phòng"].Properties.Visible = true;
                }

                thuePhong = thuePhongDTO;
                hoaDon    = BUS.HoaDonBUS.LayThongTinHoaDonDangThue(thuePhong.MaHoaDon);
                khachHang = BUS.KhachHangBUS.LayKhachHang(hoaDon.MaKH);

                txtMaKH.EditValue        = khachHang.MaKH;
                txtTenKH.EditValue       = khachHang.TenKH;
                txtLoaiKH.EditValue      = BUS.LoaiKhachHangBUS.LayLoaiKhachHang(khachHang).TenLoaiKH;
                txtSDT.EditValue         = khachHang.SDT;
                txtDiemTichLuy.EditValue = khachHang.DiemTichLuy;


                txtNgayGioVao.EditValue   = thuePhong.GioThuePhong.ToString("dd-MM-yyyy hh:mm:ss");
                txtGioTraPhong.EditValue  = (thuePhong.GioTraPhong == DateTime.MinValue) ? "Chưa có" : thuePhong.GioTraPhong.ToString("dd-MM-yyyy hh:mm:ss");
                txtTienTraTruoc.EditValue = hoaDon.TienTraTruoc;

                txtMaHoaDon.EditValue = hoaDon.MaHoaDon;
                txtGhiChu.EditValue   = hoaDon.GhiChu;

                //Phòng đang được thuê
                if (thuePhongDTO.GioTraPhong == DateTime.MinValue)
                {
                    txtSoGio.EditValue = ToCustomString((DateTime.Now - thuePhong.GioThuePhong));
                }
                else //Phòng đã được trả
                {
                    txtSoGio.EditValue = ToCustomString((thuePhong.GioTraPhong - thuePhong.GioThuePhong));
                    wbntQuanlyphong.Buttons["Chuyển Phòng"].Properties.Visible = false;
                    wbntQuanlyphong.Buttons["Trả Phòng"].Properties.Visible    = false;
                }


                RefreshDataBindingDichVuPhong();
            }
        }
Esempio n. 30
0
 public static bool LuuThongTinThuePhong(ThuePhongDTO thuePhongDTO, HoaDonDTO hoaDonDTO)
 {
     return(HoaDonDAL.LuuThongTinHoaDon(hoaDonDTO) && ThuePhongBUS.LuuThongTinThuePhong(thuePhongDTO));
 }