private void HuySanToolStripMenuItem_Click(object sender, EventArgs e) { // ' Get the current cell location. int currentRowIndex = DGVFieldSchedule.CurrentCellAddress.Y;// 'current row selected //'Verify that indexing OK if (-1 < currentRowIndex && currentRowIndex < DGVFieldSchedule.RowCount) { PhieuDatSanDTO pds = new PhieuDatSanDTO(); ChiTietDatSanDTO ct = new ChiTietDatSanDTO(); DataGridViewRow selectedRow = DGVFieldSchedule.Rows[currentRowIndex]; pds.MaPhieuDatSan = int.Parse(selectedRow.Cells[0].Value.ToString()); ct.MaPhieuDatSan = int.Parse(selectedRow.Cells[0].Value.ToString()); ct.MaSan = int.Parse(selectedRow.Cells[1].Value.ToString()); ct.ThoiLuong = DateTime.Parse(selectedRow.Cells[5].Value.ToString()); ct.NgayDat = DateTime.Parse(selectedRow.Cells[3].Value.ToString()); ct.GioDat = DateTime.Parse(selectedRow.Cells[4].Value.ToString()); bool kq1 = false, kq2 = false; if (ct != null) { kq1 = ctBus.huychitietdatsan(ct); } if (pds != null) { kq2 = pdsBus.huysan(pds); } if (kq1 == false && kq2 == false) { MessageBox.Show("Hủy sân thất bại. Vui lòng kiểm tra lại dũ liệu"); } else { MessageBox.Show("Hủy sân thành công"); this.load_dataGridView(); } } }
private void btnReserveField_Click(object sender, EventArgs e) { //1. Map data from GUI PhieuDatSanDTO pds = new PhieuDatSanDTO(); pds.MaPhieuDatSan = pdsBus.autogenerate_maPDS(); pds.MaNhanVien = 1; List <KhachHangDTO> listKH = khBus.select(); foreach (KhachHangDTO kh in listKH) { if (cbCusPhone.Text == kh.SoDT) { pds.MaKH = kh.MaKH; } } ChiTietDatSanDTO ct = new ChiTietDatSanDTO(); ct.MaPhieuDatSan = pds.MaPhieuDatSan; ct.MaSan = int.Parse(cbFieldName.Text); ct.NgayDat = dTPReservationDate.Value; ct.ThoiLuong = dTPlength.Value; ct.GioDat = dTPTime.Value; //2. Insert into DB bool kq1 = pdsBus.datsan(pds); bool kq2 = ctBus.themchitietdatsan(ct); if (kq1 == false || kq2 == false) { MessageBox.Show("Đặt sân thất bại. Vui lòng kiểm tra lại dũ liệu"); } else { MessageBox.Show("Đặt sân thành công"); } load_dataGridView(); btnAdd.Enabled = true; }
private void getMaPDS() { PhieuDatSanDTO pds = new PhieuDatSanDTO(); ParaMaPDS = pdsBus.autogenerate_maPDS(); }
public bool huysan(PhieuDatSanDTO pds) { bool re = pdsDAL.huysan(pds); return(re); }
public bool datsan(PhieuDatSanDTO pds) { bool re = pdsDAL.datsan(pds); return(re); }