private void btnUpdateMovie_Click(object sender, EventArgs e) { int a, b; if (!int.TryParse(txtYear.Text, out a) || !(int.TryParse(txtCopies.Text, out b))) { MessageBox.Show("Year and Copies must be a valid integer"); } else { int rental = 0; if ((DateTime.Now.Year - a) > 5) { rental = 2; } else { rental = 5; } DatabaseQueries database = new DatabaseQueries(); database.editmovie(txtRating.Text, txtTitle.Text, txtYear.Text, txtCopies.Text, rental.ToString(), txtPlot.Text, txtGenre.Text, txtMovieID.Text); MessageBox.Show("Movie Updated"); Dispose(); } }
private void btnAddMovie_Click(object sender, EventArgs e) { int a, b; if (txtRating.Text == "" || txtTitle.Text == "" || txtYear.Text == "" || txtCopies.Text == "" || txtPlot.Text == "" || txtGenre.Text == "") { MessageBox.Show("All fields are required"); } else if (!int.TryParse(txtYear.Text, out a) || !(int.TryParse(txtCopies.Text, out b))) { MessageBox.Show("Year and Copies must be a valid integer"); } else { int rental = 0; if ((DateTime.Now.Year - a) > 5) { rental = 2; } else { rental = 5; } DatabaseQueries database = new DatabaseQueries(); database.addnewmovie(txtRating.Text, txtTitle.Text, txtYear.Text, rental.ToString(), txtCopies.Text, txtPlot.Text, txtGenre.Text); MessageBox.Show("Movie Added"); } }
private void btnDeleteMovie_Click(object sender, EventArgs e) { DatabaseQueries database = new DatabaseQueries(); database.deletemovie(txtMovieID.Text); MessageBox.Show("Movie Deleted"); Dispose(); }
private void btnDaleteCustomer_Click(object sender, EventArgs e) { DatabaseQueries database = new DatabaseQueries(); database.deletecustomer(txtCustID.Text); MessageBox.Show("Customer Deleted"); Dispose(); }
private void btnUpdateCustomer_Click(object sender, EventArgs e) { DatabaseQueries database = new DatabaseQueries(); database.editcustomer(txtFirstName.Text, txtLastName.Text, txtAddress.Text, txtPhoneNo.Text, txtCustID.Text); MessageBox.Show("Customer Updated"); Dispose(); }
private void btnAddCustomer_Click(object sender, EventArgs e) { if (txtFirstName.Text == "" || txtLastName.Text == "" || txtAddress.Text == "" || txtPhoneNo.Text == "") { MessageBox.Show("All fields are required"); } else { DatabaseQueries database = new DatabaseQueries(); database.addnewcustomer(txtFirstName.Text, txtLastName.Text, txtAddress.Text, txtPhoneNo.Text); MessageBox.Show("Customer Added"); Dispose(); } }
private void returnToolStripMenuItem1_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure to return this rental?", "Return Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { //string Date = DateTime.Now.ToString("MM/dd/yyyy") + " " + DateTime.Now.ToShortTimeString(); DatabaseQueries database = new DatabaseQueries(); database.updatereturnrecord(Convert.ToDateTime(DateTime.Now.ToString()), dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); MessageBox.Show("Movie Returned"); dataGridView1.DataSource = new DatabaseQueries().getpendingrentals(); } }
private void btnIssue_Click(object sender, EventArgs e) { if (lastname.Text == "") { MessageBox.Show("Enter valid Customer ID"); } else { //string Date = DateTime.Now.ToString("MM/dd/yyyy") + " " + DateTime.Now.ToShortTimeString(); DatabaseQueries database = new DatabaseQueries(); database.addrentalrecord(Convert.ToInt32(comboBox1.SelectedValue), Convert.ToInt32(comboBox2.SelectedValue.ToString()), Convert.ToDateTime(dateTimePicker1.Text)); MessageBox.Show("Movie Rented"); //Dispose(); } }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { firstname.Text = ""; lastname.Text = ""; address.Text = ""; phoneno.Text = ""; DataTable table = new DatabaseQueries().findcustomerbyid(comboBox2.SelectedValue.ToString()); if (table.Rows.Count > 0) { firstname.Text = table.Rows[0]["FirstName"].ToString(); lastname.Text = table.Rows[0]["LastName"].ToString(); address.Text = table.Rows[0]["Address"].ToString(); phoneno.Text = table.Rows[0]["Phone"].ToString(); } }