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 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 frmDiscontinueDVD_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            grdDVD.DataSource = DVD.getDVD(ds).Tables["ss"];

            grdDVD.AllowUserToAddRows = false;
        }
        private void frmUpdateDVD_Load(object sender, EventArgs e)
        {
            //load combo with DVD ID and other details
            DataSet ds = new DataSet();

            ds = DVD.getDVD(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboDVD.Items.Add(ds.Tables[0].Rows[i][0].ToString().PadLeft(3, '0') + " " + ds.Tables[0].Rows[i][1].ToString());
            }
        }
        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();
        }
Exemplo n.º 6
0
        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 = "";
        }