示例#1
0
 public void DangKyPhong_UpdateTongTien(PhieuDangKyPhong dk)
 {
     using (var cmd = new SqlCommand("SP_DangKyPhong_UpdateTongTien", GetConnection()))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@MaPDK", dk.MaPDK));
         cmd.Parameters.Add(new SqlParameter("@TongTien", dk.TongTien));
         cmd.ExecuteNonQuery();
     }
 }
示例#2
0
 public void DangKyPhong_Update(PhieuDangKyPhong dk)
 {
     using (var cmd = new SqlCommand("SP_DangKyPhong_Update", GetConnection()))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@MaPDK", dk.MaPDK));
         cmd.Parameters.Add(new SqlParameter("@MaKH", dk.MaKH));
         cmd.Parameters.Add(new SqlParameter("@MaNV", dk.MaNV));
         cmd.Parameters.Add(new SqlParameter("@SoLuongPhong", dk.SoLuongphong));
         cmd.Parameters.Add(new SqlParameter("@NgayDangKy", dk.NgayDangKy));
         cmd.Parameters.Add(new SqlParameter("@NgayNhanPhong", dk.NgayNhanPhong));
         cmd.Parameters.Add(new SqlParameter("@NgayTraPhong", dk.NgayTraPhong));
         cmd.ExecuteNonQuery();
     }
 }
示例#3
0
        private PhieuDangKyPhong TinhTienPhong(string MaPDK)
        {
            double s = 0;
            List<string> DanhSachPhong = DangKyPhongCTBUS.NhanPhong(MaPDK);
            double hour = ChuyenThanhGio(MaPDK);
            double day = ChuyenThanhNgay(MaPDK);
            PhieuDangKyPhong Ph = new PhieuDangKyPhong();
            Ph.MaPDK = MaPDK;
            if (PhieuDangKyPhongBUS.GetPhuongThuc(MaPDK).Equals("Giờ"))
            {
                foreach(string phong in DanhSachPhong)
                {
                    s += LoaiPhongBUS.GetGia(phong);
                }
                Ph.TongTien = s + TienGiamTheoGio((int)hour) * DanhSachPhong.Count;
                return Ph;
            }
            else
            {
                foreach (string phong in DanhSachPhong)
                {
                    s += LoaiPhongBUS.GetGia(phong)  ;
                }
                Ph.TongTien = s + day * DanhSachPhong.Count * ThamSoBUS.TienNgay();
                return Ph;
            }

        }
示例#4
0
        private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (KiemTraLuu() && DkDangKyPhong1())
            {
                PhieuDangKyPhong PDK = new PhieuDangKyPhong();
                DangKyPhongCT DKP = new DangKyPhongCT();
                PDK.MaPDK = gridView1.GetFocusedRowCellValue(colMaPDK).ToString();
                PDK.MaKH = gridView1.GetFocusedRowCellValue(colMaKH).ToString();
                PDK.MaNV = gridView1.GetFocusedRowCellValue(colMaNV).ToString();
                PDK.SoLuongphong = int.Parse(gridView1.GetFocusedRowCellValue(colSoLuongPhong).ToString());
                PDK.NgayDangKy = (DateTime)gridView1.GetFocusedRowCellValue(colNgayDangKy);
                PDK.NgayNhanPhong = (DateTime)gridView1.GetFocusedRowCellValue(colNgayDen);
                PDK.NgayTraPhong = (DateTime)gridView1.GetFocusedRowCellValue(colNgayDi);
                PDK.PhuongThucTinhTien = gridView1.GetFocusedRowCellValue(colPhuongThucTinhTien).ToString();
                DKP.MaCTPDK = gridView1.GetFocusedRowCellValue(colMaCTPDK).ToString();
                DKP.MaPDK = gridView1.GetFocusedRowCellValue(colMaPDK).ToString();
                DKP.MaPhong = gridView1.GetFocusedRowCellValue(colMaPhong).ToString();
                DKP.SoLuongNguoi = gridView1.GetFocusedRowCellValue(colSoLuongNguoi).ToString();

                PhieuDangKyPhongBUS.DangKyPhong_Update(PDK);
                PhieuDangKyPhongBUS.UpdatePhuongThuc(PDK);
                DangKyPhongCTBUS.DangKyPhongCT_Update(DKP);

                gridControl1.DataSource = PhieuDangKyPhongBUS.GetAll();
                MessageBox.Show("Lưu thành công.", "Thông báo");
            }     
        }
示例#5
0
        private void btnChinhSua_Click(object sender, EventArgs e)
        {
            if (KiemTraCS())
            {   
                try
                {
                    PhieuDangKyPhong PDK = new PhieuDangKyPhong();
                    PDK.MaPDK = cbbMaPDK.Text;
                    PDK.MaKH = luMaKH.Text;
                    PDK.SoLuongphong = int.Parse(cbbSLP.Text);
                    PDK.NgayDangKy = deNgayDangKy.DateTime;
                    PDK.NgayNhanPhong = deNgayDen.DateTime;
                    PDK.NgayTraPhong = deNgayDi.DateTime;
                    PDK.MaNV = this.MaNV;
                    PhieuDangKyPhongBUS.DangKyPhong_Update(PDK);

                    gridControl1.DataSource = PhieuDangKyPhongBUS.GetAll();
                    MessageBox.Show("Chỉnh sửa thành công.", "Thông báo");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
示例#6
0
        private void btnDangKyPhong_Click(object sender, EventArgs e)
        {
            if (KiemTra() && DKDangKyPhong())
            {
                try
                {
                    DangKyPhongCT CTPDK = new DangKyPhongCT();
                    PhieuDangKyPhong PDK = new PhieuDangKyPhong();
                    CTPDK.MaCTPDK = DangKyPhongCTBUS.XuLyMa();
                    CTPDK.MaPDK = cbbMaPDK.Text;
                    CTPDK.MaPhong = luMaPhong.Text;
                    CTPDK.SoLuongNguoi = cbbSoLuongNguoi.Text;
                    PDK.MaPDK = cbbMaPDK.Text;
                    PDK.PhuongThucTinhTien = cbbPhuongThuc.Text;
                    DangKyPhongCTBUS.DangKyPhongCT_Insert(CTPDK);
                    PhieuDangKyPhongBUS.UpdatePhuongThuc(PDK);

                    gridControl1.DataSource = PhieuDangKyPhongBUS.GetAll();
                    MessageBox.Show("Đăng ký phòng thành công.", "Thông báo");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
示例#7
0
 public static void UpdatePhuongThuc(PhieuDangKyPhong dk)
 {
     db.DangKyPhong_UpdatePhuongThuc(dk);
 }
示例#8
0
 public static void UpdateTongTien(PhieuDangKyPhong dk)
 {
     db.DangKyPhong_UpdateTongTien(dk);
 }
示例#9
0
 public static void DangKyPhong_Update(PhieuDangKyPhong dk)
 {
     db.DangKyPhong_Update(dk);
 }
示例#10
0
 public static void DangKyPhong_Insert(PhieuDangKyPhong dk)
 {
     db.DangKyPhong_Insert(dk);
 }