private void cboDVD_SelectedIndexChanged(object sender, EventArgs e) { //if resetting combo, ignore if (cboDVD.SelectedIndex == -1) { return; } //find DVD Details DVD updDVD = new DVD(); updDVD.getDVD(Convert.ToInt32(cboDVD.Text.Substring(0, 3))); if (updDVD.getDVDId().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDVDId.Focus(); return; } //display DVD details txtDVDId.Text = updDVD.getDVDId().ToString("000"); txtDVDTitle.Text = updDVD.getTitle(); txtDVDDescription.Text = updDVD.getDescription(); txtDVDYearRelease.Text = updDVD.getYear().ToString(); txtRateCode.Text = updDVD.getRateCode(); //display details grpDVD.Visible = true; }
private void grdDVD_CellClick(object sender, DataGridViewCellEventArgs e) { //find DVD details DVD dicontinueDVD = new DVD(); dicontinueDVD.getDVD(Convert.ToInt32(grdDVD.Rows[grdDVD.CurrentCell.RowIndex].Cells[0].Value)); if (dicontinueDVD.getDVDId().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //display DVD Details txtDVDId.Text = (Convert.ToInt32(grdDVD.Rows[grdDVD.CurrentCell.RowIndex].Cells[0].Value)).ToString(); cbotxtStatus.Text = grdDVD.Rows[grdDVD.CurrentCell.RowIndex].Cells[5].Value.ToString(); }
private void btnRent_Click(object sender, EventArgs e) { //find DVD details DVD selectDVD = new DVD(); selectDVD.getDVD(Convert.ToInt32(grdSelectDVD.Rows[grdSelectDVD.CurrentCell.RowIndex].Cells[0].Value)); if (selectDVD.getDVDId().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (int i = 0; i < grdSelectDVD.SelectedRows.Count; i++) { //display DVD Details //Font f = new Font("monospace",10); //listBoxRentDVD.Font = f; lstRentDVD.Items.Add(grdSelectDVD.CurrentRow.Cells[0].Value.ToString() + " " + String.Format("{0:00.00}", grdSelectDVD.CurrentRow.Cells[4].Value) + " " + grdSelectDVD.CurrentRow.Cells[1].Value.ToString().PadRight(50)); txtPrice.Text = (Convert.ToDecimal(txtPrice.Text) + (Convert.ToDecimal(String.Format("{0:00.00}", grdSelectDVD.CurrentRow.Cells[4].Value)))).ToString(); //+ (Convert.ToDecimal(String.Format("{0:00.00}", grdSelectDVD.CurrentRow.Cells[3].Value)))).ToString(); } grpDVDRented.Visible = true; txtSearchDVDTitle.Text = ""; }