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(); } }
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(); } }
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; } }
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"); } }
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); } } }
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); } } }
public static void UpdatePhuongThuc(PhieuDangKyPhong dk) { db.DangKyPhong_UpdatePhuongThuc(dk); }
public static void UpdateTongTien(PhieuDangKyPhong dk) { db.DangKyPhong_UpdateTongTien(dk); }
public static void DangKyPhong_Update(PhieuDangKyPhong dk) { db.DangKyPhong_Update(dk); }
public static void DangKyPhong_Insert(PhieuDangKyPhong dk) { db.DangKyPhong_Insert(dk); }