private void BtnUpdateMovie_Click(object sender, EventArgs e)//method for updating ther movie
        {
            int a;

            if (!int.TryParse(txtYear.Text, out a))
            {
                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;
                }
                DatabaseFunctions database = new DatabaseFunctions();
                database.editmovie(txtRating.Text, txtTitle.Text, txtYear.Text, txtCopies.Text, rental.ToString(), txtPlot.Text, txtGenre.Text, txtMovieID.Text);
                MessageBox.Show("Movie Updated");
                Dispose();
            }
        }
示例#2
0
        private void BtnDaleteCustomer_Click(object sender, EventArgs e)//Method for deleting the customer
        {
            DatabaseFunctions database = new DatabaseFunctions();

            database.deletecustomer(txtCustID.Text);
            MessageBox.Show("Customer Deleted");
            Dispose();
        }
示例#3
0
        private void BtnUpdateCustomer_Click(object sender, EventArgs e)//method for updating the customer
        {
            DatabaseFunctions database = new DatabaseFunctions();

            database.editcustomer(txtFirstName.Text, txtAddress.Text, txtPhoneNo.Text, txtCustID.Text);
            MessageBox.Show("Customer Updated");
            Dispose();
        }
        private void BtnDeleteMovie_Click(object sender, EventArgs e)//method for deleting the movie
        {
            DatabaseFunctions database = new DatabaseFunctions();

            database.deletemovie(txtMovieID.Text);
            MessageBox.Show("Movie Deleted");
            Dispose();
        }
        private void Button1_Click(object sender, EventArgs e)//This method for returning the movie
        {
            DialogResult result = MessageBox.Show("Are you sure to return this rental?", "Return Confirmation", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                DatabaseFunctions database = new DatabaseFunctions();
                string            rmid     = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                database.updatereturnrecord(Convert.ToDateTime(DateTime.Now.ToString()), rmid);
                MessageBox.Show("Movie Returned");
                dataGridView1.DataSource = new DatabaseFunctions().getpendingrentals();
            }
        }
示例#6
0
 private void BtnIssue_Click(object sender, EventArgs e)//This method for issuing the movie
 {
     if (firstname.Text == "")
     {
         MessageBox.Show("Enter valid Customer ID");
     }
     else
     {
         DatabaseFunctions database = new DatabaseFunctions();
         database.addrentalrecord(Convert.ToInt32(comboBox1.SelectedValue), Convert.ToInt32(comboBox2.SelectedValue.ToString()), Convert.ToDateTime(dateTimePicker1.Text));
         MessageBox.Show("Movie Rented");
     }
 }
示例#7
0
 private void SaveButton_Click(object sender, EventArgs e)//This is add customer method
 {
     if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
     {
         MessageBox.Show("All fields are required");
     }
     else
     {
         DatabaseFunctions database = new DatabaseFunctions();
         database.addnewcustomer(textBox1.Text, textBox2.Text, textBox3.Text);
         MessageBox.Show("Customer Added");
         Dispose();
     }
 }
示例#8
0
        private void ComboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            firstname.Text = "";
            address.Text   = "";
            phoneno.Text   = "";

            DataTable table = new DatabaseFunctions().findcustomerbyid(comboBox2.SelectedValue.ToString());

            if (table.Rows.Count > 0)
            {
                firstname.Text = table.Rows[0]["Name"].ToString();
                address.Text   = table.Rows[0]["Address"].ToString();
                phoneno.Text   = table.Rows[0]["Phone"].ToString();
            }
        }