Пример #1
0
        public void RefreshDataBinding(int maLoaiKH)
        {
            this.loaiKhachHangDTO = LoaiKhachHangBUS.LayLoaiKhachHang(maLoaiKH);

            txtMaLoaiKhachHang.EditValue           = loaiKhachHangDTO.MaLoaiKH;
            txtTenLoaiKhachHang.Text               = loaiKhachHangDTO.TenLoaiKH;
            txtSoDiemDeDatDuoc.EditValue           = loaiKhachHangDTO.SoDiemDeDatDuoc;
            txtPhanTramGiamGia.EditValue           = loaiKhachHangDTO.PhanTramGiamGia;
            txtSoTienGiamGia_Min.EditValue         = loaiKhachHangDTO.SoTienGiamGia_Min;
            txtSoTienGiamGia_Max.EditValue         = loaiKhachHangDTO.SoTienGiamGia_Max;
            txtPhanTramGiamGiaSinhNhat.EditValue   = loaiKhachHangDTO.PhanTramGiamGiaSinhNhat;
            txtSoTienGiamGiaSinhNhat_Min.EditValue = loaiKhachHangDTO.SoTienGiamGiaSinhNhat_Min;
            txtSoTienGiamGiaSinhNhat_Max.EditValue = loaiKhachHangDTO.SoTienGiamGiaSinhNhat_Max;

            ValidateChildren();
        }
        private void btnThayDoiKhachHang_Click(object sender, EventArgs e)
        {
            folderKhachHang.ChonKhachHang chonKhachHang = new folderKhachHang.ChonKhachHang(false);
            XtraDialogArgs args = new XtraDialogArgs(caption: "Caption", content: chonKhachHang, buttons: new DialogResult[] { DialogResult.OK, DialogResult.Cancel });

            args.Showing += Args_Showing_ChonKH;
            args.Caption  = "Default Text";
            args.Buttons  = new DialogResult[] { DialogResult.OK, DialogResult.Cancel };


            switch (XtraDialog.Show(args))
            {
            case DialogResult.OK:
                khachHang = chonKhachHang.LayKhachHangDaChon();


                txtMaKH.EditValue     = khachHang.MaKH;
                txtLoaiKH.EditValue   = LoaiKhachHangBUS.LayLoaiKhachHang(khachHang.MaLoaiKH).TenLoaiKH;
                txtEmail.EditValue    = khachHang.Email;
                txtSDT.EditValue      = khachHang.SDT;
                txtTenKH.EditValue    = khachHang.TenKH;
                txtDiaChi.EditValue   = khachHang.DiaChi;
                txtNgaySinh.EditValue = khachHang.NgaySinh;

                DatPhongBUS.UpdateKhachHang(datPhong.MaDatPhong, khachHang.MaKH);
                break;

            case DialogResult.Cancel:


                break;

            default:
                break;
            }
        }
        public void RefreshDataBinding(int maDatPhong)
        {
            //Lấy tất cả tinh trang phong vào cmb
            listTinhTrangDatPhong = DatPhongBUS.LayTatCaTinhTrangDatPhong_List();
            //combobox tinh trang phong
            txtTinhTrangDat.Properties.Items.Clear();

            foreach (TinhTrangDatPhongDTO tinhtrang in listTinhTrangDatPhong)
            {
                txtTinhTrangDat.Properties.Items.Add(new MyComboBoxItem(tinhtrang.TinhTrangDatPhong, tinhtrang.MaTinhDatTrangPhong));
            }


            this.datPhong             = DatPhongBUS.LayThongTinDatPhong(maDatPhong);
            txtMaDatPhong.EditValue   = maDatPhong;
            txtTienTraTruoc.EditValue = datPhong.SoTienDatTruoc;
            txtThoiGian.EditValue     = datPhong.ThoiGianDatPhong;
            txtGhiChu.EditValue       = datPhong.GhiChu;
            dateNgayLapPhieu.DateTime = datPhong.NgayLapPhieuDat;
            txtTinhTrangDat.EditValue = DatPhongBUS.LayTinhTrangPhong(datPhong.MaTinhTrangDatPhong).TinhTrangDatPhong;

            khachHang             = KhachHangBUS.LayKhachHang(datPhong.MaKH);
            txtMaKH.EditValue     = khachHang.MaKH;
            txtLoaiKH.EditValue   = LoaiKhachHangBUS.LayLoaiKhachHang(khachHang.MaLoaiKH).TenLoaiKH;
            txtEmail.EditValue    = khachHang.Email;
            txtSDT.EditValue      = khachHang.SDT;
            txtTenKH.EditValue    = khachHang.TenKH;
            txtDiaChi.EditValue   = khachHang.DiaChi;
            txtNgaySinh.EditValue = khachHang.NgaySinh;

            txtTenNhanVien.EditValue = NhanVienBUS.LayNhanVien(datPhong.MaNhanVien).TenNhanVien;

            this.TabControl.TabPages.Clear();
            foreach (ChiTietDatPhongDTO chiTiet in DatPhongBUS.LayTatCaCacChiTietDatPhong(datPhong.MaDatPhong))
            {
                ThongTinChiTietDatPhong thongTinChiTietDatPhong = new ThongTinChiTietDatPhong(datPhong);
                thongTinChiTietDatPhong.RefreshDataBinding(chiTiet);
                DevExpress.XtraTab.XtraTabPage xtraTab = new DevExpress.XtraTab.XtraTabPage();

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

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

            if (datPhong.MaTinhTrangDatPhong == 3)
            {
                txtTienTraTruoc.ReadOnly = true;
                txtGhiChu.ReadOnly       = true;
            }
        }
Пример #4
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();
        }