private void btnSearchRental_Click(object sender, EventArgs e) { Rentals rentals = new Rentals(); DataSet ds = new DataSet(); grdSelectRental.DataSource = Rentals.getSearchRentIdbyName(ds, txtSearchName.Text.ToString().ToUpper()).Tables["ss"]; }
private void grdSelectRental_CellClick(object sender, DataGridViewCellEventArgs e) { //find Rental details Rentals selectRentals = new Rentals(); selectRentals.getRentals(Convert.ToInt32(grdSelectRental.Rows[grdSelectRental.CurrentCell.RowIndex].Cells[0].Value)); if (selectRentals.getRentalId().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //display Rentals Details txtRentId.Text = (Convert.ToInt32(grdSelectRental.Rows[grdSelectRental.CurrentCell.RowIndex].Cells[0].Value)).ToString(); txtMemName.Text = grdSelectRental.Rows[grdSelectRental.CurrentCell.RowIndex].Cells[1].Value.ToString(); txtMemberId.Text = (Convert.ToInt32(grdSelectRental.Rows[grdSelectRental.CurrentCell.RowIndex].Cells[2].Value)).ToString(); txtSearchName.Text = ""; }
private void frmExecuteRentals_Load(object sender, EventArgs e) { txtRentId.Text = Rentals.nextRentalId().ToString("0000"); txtTransactionId.Text = Rentals.nextTransactionId().ToString("0000"); }
private void btnDone_Click(object sender, EventArgs e) { //Validate Data if (txtRentId.Text.Equals("") || txtMemId.Equals("")) { MessageBox.Show("All field must be entered.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSearchName.Focus(); return; } string sd = DateTime.Now.ToString("d-MMM-yyyy"); string dd = DateTime.Now.AddDays(7).ToString("d-MMM-yyyy"); //Save Data to Rental file Rentals regExecute = new Rentals(); //Change Rent Status into DVD Table DVD rentDVDStatus = new DVD(); //Save Data to Transaction File Rentals regTransaction = new Rentals(); regExecute.setRentalId(Convert.ToInt32(txtRentId.Text)); regExecute.setName(txtMemName.Text); regExecute.setMemberId(Convert.ToInt32(txtMemId.Text)); regExecute.setRentDate(sd); regExecute.setDueDate(dd); regTransaction.setTransactionId(Convert.ToInt32(txtTransactionId.Text)); regTransaction.setMemberId(Convert.ToInt32(txtMemId.Text)); regTransaction.setRentalId(Convert.ToInt32(txtRentId.Text)); regTransaction.setTransactionType("Payment"); regTransaction.setTransactionDate(sd); regTransaction.setTransactionAmount(Convert.ToDecimal(txtPrice.Text)); //Insert Rental record into Rentals Table regExecute.setRentals(); //Insert Transaction record into Transaction Table regTransaction.setTransaction(); DVD dvdStatus = new DVD(); dvdStatus.setDVDId(Convert.ToInt32(grdSelectDVD.Rows[grdSelectDVD.CurrentCell.RowIndex].Cells[0].Value)); dvdStatus.setRentStatus(grdSelectDVD.Rows[grdSelectDVD.CurrentCell.RowIndex].Cells[2].Value.ToString()); dvdStatus.setRentStatus("R"); dvdStatus.ChangeRentDVD(); { //Display Confirmation Message MessageBox.Show("Rental is Executed.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } txtSearchName.Text = ""; txtSearchDVDTitle.Text = ""; txtRentId.Text = ""; txtTransactionId.Text = Rentals.nextTransactionId().ToString("0000"); txtRentId.Text = Rentals.nextRentalId().ToString("0000"); }
private void frmProcessReturn_Load(object sender, EventArgs e) { txtTransactionId.Text = Rentals.nextTransactionId().ToString("0000"); }