private void btnDiscontinue_Click(object sender, EventArgs e) { if (txtDVDId.Text.Equals("")) { MessageBox.Show("Field Must Not Be Empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDVDId.Focus(); return; } DVD dvd = new DVD(); dvd.setDVDId(Convert.ToInt32(grdDVD.Rows[grdDVD.CurrentCell.RowIndex].Cells[0].Value)); dvd.setStatus(cbotxtStatus.Text); dvd.DiscontinueDVD(); if (cbotxtStatus.Text == "A") { dvd.setStatus("A"); } else { dvd.setStatus("NA"); } //Display Confirmation Message MessageBox.Show(grdDVD.Rows[grdDVD.CurrentCell.RowIndex].Cells[1].Value + " status has been changed", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); txtDVDId.Text = ""; cbotxtStatus.Text = ""; DataSet ds = new DataSet(); grdDVD.DataSource = DVD.getDVD(ds).Tables["ss"]; }
private void btnRegDVD_Click(object sender, EventArgs e) { //Validate Data if (txtDVDTitle.Text.Equals("") || txtDVDDescription.Text.Equals("") || txtDVDYearRelease.Text.Equals("") || txtRate.Text.Equals("")) { MessageBox.Show("All field must be entered.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDVDTitle.Focus(); return; } //Validates Rate Code if (Rate.DVDRateCodeExists(txtRate.Text)) { MessageBox.Show("Rate Code doesnt exist"); return; } //Save Data to Registerd DVD file DVD myRegDVD = new DVD(); myRegDVD.setDVDId(Convert.ToInt32(txtDVDId.Text)); myRegDVD.setTitle(txtDVDTitle.Text); myRegDVD.setDescription(txtDVDDescription.Text); myRegDVD.setYear(Convert.ToInt32(txtDVDYearRelease.Text)); myRegDVD.setRateCode(txtRate.Text); myRegDVD.setStatus("A"); myRegDVD.setRentStatus("NR"); //Insert DVD record into DVD Table myRegDVD.setRegisterDVD(); { //Display Confirmation Message MessageBox.Show("DVD is Registered.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } //Reset UI txtDVDId.Text = ""; txtDVDTitle.Text = ""; txtDVDDescription.Text = ""; txtDVDYearRelease.Text = ""; txtRate.Text = ""; txtDVDId.Text = DVD.nextDVDId().ToString("0000"); txtDVDTitle.Focus(); }