public void DangKyPhongCT_Update(DangKyPhongCT dk) { using (var cmd = new SqlCommand("SP_DangKyPhongCT_Update", GetConnection())) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@MaCTPDK", dk.MaCTPDK)); cmd.Parameters.Add(new SqlParameter("@MaPDK", dk.MaPDK)); cmd.Parameters.Add(new SqlParameter("@MaPhong", dk.MaPhong)); cmd.Parameters.Add(new SqlParameter("@SoLuongNguoi", dk.SoLuongNguoi)); cmd.ExecuteNonQuery(); } }
public static void DangKyPhongCT_Update(DangKyPhongCT dk) { db.DangKyPhongCT_Update(dk); }
public static void DangKyPhongCT_Insert(DangKyPhongCT dk) { db.DangKyPhongCT_Insert(dk); }
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 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); } } }