// Return Movie Button (This button used for return movie details) private void ReturnMovies_Click(object sender, EventArgs e) { con.Open();// Connection Open comm = new SqlCommand("update RentalMovies set ReturnDate= '" + RentalReturnDate.Text + "' where RentalMoviesId = '" + RentalMovieID.Text + "' ", con); try { comm.ExecuteNonQuery(); MessageBox.Show("Movie Return"); con.Close();// Connection Close ShowRentalMoviesRecord(); RentalMovieID.Clear(); RentalCustomerID.Clear(); RentalsMovieID.Clear(); RentalIssueDate.Clear(); RentalReturnDate.Clear(); } catch (Exception) { MessageBox.Show("Movie Not Return"); } finally { con.Close();// Connection Close } }
// Issue Movies Button (This button used for Issue Movie) private void IssueMovies_Click(object sender, EventArgs e) { con.Open();// Connection Open comm = new SqlCommand("insert into RentalMovies values('" + RentalMovieID.Text + "','" + RentalsMovieID.Text + "','" + RentalCustomerID.Text + "','" + RentalIssueDate.Text + "','" + RentalReturnDate.Text + "')", con); try { comm.ExecuteNonQuery(); MessageBox.Show("Rental Movie Saved"); con.Close();// Connection Close ShowRentalMoviesRecord(); RentalMovieID.Clear(); RentalCustomerID.Clear(); RentalsMovieID.Clear(); RentalIssueDate.Clear(); RentalReturnDate.Clear(); } catch (Exception) { MessageBox.Show("Rental Movie Not Saved"); } finally { con.Close();// Connection Close } }
public override string ToString() { return(string.Format("BookRental: {{ PrimaryKey: \"{0}\", RentalDate: \"{1}\", RentalDueDate: \"{2}\", RentalReturnDate: \"{3}\", User: \"{4}\" }}", PrimaryKey, RentalDate.ToShortDateString(), RentalDueDate.ToShortDateString(), RentalReturnDate.ToShortDateString(), User.PrimaryKey)); }