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 btnUpdate_Click(object sender, EventArgs e)
        {
            //Validate Data
            if (txtDVDId.Text.Equals("") || txtDVDTitle.Text.Equals("") || txtDVDDescription.Text.Equals("") || txtDVDYearRelease.Text.Equals("") || txtRateCode.Text.Equals(""))
            {
                MessageBox.Show("All field must be entered.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDVDId.Focus();

                return;
            }

            //instantiate Rate Object
            DVD myDVD = new DVD();

            myDVD.setDVDId(Convert.ToInt32(txtDVDId.Text));
            myDVD.setTitle(txtDVDTitle.Text);
            myDVD.setDescription(txtDVDDescription.Text);
            myDVD.setYear(Convert.ToInt32(txtDVDYearRelease.Text));
            myDVD.setRateCode(txtRateCode.Text);

            //INSERT DVD record into table
            myDVD.updDVD();

            //Display Confirmation Message
            MessageBox.Show("DVD has been Updated.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);



            //Reset UI
            grpDVD.Visible = false;

            cboDVD.SelectedIndex = -1;
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            //Validate Data
            if (txtRentId.Text.Equals("") || txtMemId.Equals(""))
            {
                MessageBox.Show("All field must be entered.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtSearchName.Focus();

                return;
            }

            string sd = DateTime.Now.ToString("d-MMM-yyyy");

            string dd = DateTime.Now.AddDays(7).ToString("d-MMM-yyyy");

            //Save Data to Rental file
            Rentals regExecute = new Rentals();

            //Change Rent Status into DVD Table
            DVD rentDVDStatus = new DVD();
            //Save Data to Transaction File
            Rentals regTransaction = new Rentals();

            regExecute.setRentalId(Convert.ToInt32(txtRentId.Text));
            regExecute.setName(txtMemName.Text);
            regExecute.setMemberId(Convert.ToInt32(txtMemId.Text));
            regExecute.setRentDate(sd);
            regExecute.setDueDate(dd);



            regTransaction.setTransactionId(Convert.ToInt32(txtTransactionId.Text));
            regTransaction.setMemberId(Convert.ToInt32(txtMemId.Text));
            regTransaction.setRentalId(Convert.ToInt32(txtRentId.Text));
            regTransaction.setTransactionType("Payment");
            regTransaction.setTransactionDate(sd);
            regTransaction.setTransactionAmount(Convert.ToDecimal(txtPrice.Text));


            //Insert Rental record into Rentals Table
            regExecute.setRentals();

            //Insert Transaction record into Transaction Table
            regTransaction.setTransaction();

            DVD dvdStatus = new DVD();

            dvdStatus.setDVDId(Convert.ToInt32(grdSelectDVD.Rows[grdSelectDVD.CurrentCell.RowIndex].Cells[0].Value));

            dvdStatus.setRentStatus(grdSelectDVD.Rows[grdSelectDVD.CurrentCell.RowIndex].Cells[2].Value.ToString());

            dvdStatus.setRentStatus("R");

            dvdStatus.ChangeRentDVD();

            {
                //Display Confirmation Message
                MessageBox.Show("Rental is Executed.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }


            txtSearchName.Text     = "";
            txtSearchDVDTitle.Text = "";
            txtRentId.Text         = "";



            txtTransactionId.Text = Rentals.nextTransactionId().ToString("0000");

            txtRentId.Text = Rentals.nextRentalId().ToString("0000");
        }