コード例 #1
0
ファイル: AddCustomer.cs プロジェクト: miwicki/MovieRentalApp
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            MovieRental m1 = new MovieRental();

            m1.Show();
            this.Hide();
        }
コード例 #2
0
ファイル: Splash screen.cs プロジェクト: madukafb/test
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         rectangleShape2.Width += 1;
         if (rectangleShape2.Width == 539)
         {
             timer1.Stop();
             this.Hide();
             MovieRental mr1 = new MovieRental();
             mr1.Show();
         }
     }
     catch {
         return;
     }
 }
コード例 #3
0
 //Handles the return function
 private void btn_Return_Click(object sender, EventArgs e)
 {
     if (txt_RuMovieName.Text != "")
     {
         try
         {
             Rent r = new Rent();
             r.Nic     = txt_RuCusNIC.Text;
             r.MovieNo = movno;
             r.BillVal = Int32.Parse(txt_RuTotal.Text);
             int ret = r.addReturn();
             if (ret == 0)
             {
                 MessageBox.Show("Something went wrong", "Warning");
             }
             else
             {
                 MessageBox.Show("Movie Renturned Succesfully", "Returned");
             }
             Customer c = new Customer();
             dataGridView2.DataSource = (c.searchCustomer(txt_RuCusNIC.Text));
             txt_RuMovieName.Text     = "";
             txt_RuMovieRent.Text     = "";
             txt_RuTotal.Text         = "";
             txt_fines.Text           = "";
         }
         catch (Exception)
         {
             MessageBox.Show("Click on a movie name", "Select Movie", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("No rented movies for this customer", "No Movie", MessageBoxButtons.OK, MessageBoxIcon.Error);
         mm = new MovieRental();
         this.Hide();
         mm.Show();
     }
 }
コード例 #4
0
        //Handles the Renting Function
        private void btn_ReRent_Click(object sender, EventArgs e)
        {
            string      m1 = "m1", m2 = "m2", m3 = "m3", g1 = "g1", g2 = "g2", g3 = "g3";
            ReceiptForm f1;
            int         val = 0;

            if (com_ReGen1.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a genre from genre list", "Select Genre", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (cmd_ReMov1.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a movie from movie list", "Select Movie", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (cmd_ReMov1.SelectedIndex != -1)
                {
                    val = 1;
                    m1  = this.cmd_ReMov1.GetItemText(this.cmd_ReMov1.SelectedItem);
                    g1  = this.com_ReGen1.GetItemText(this.com_ReGen1.SelectedItem);
                    Rent r = new Rent();
                    r.MovieNo = movno1;
                    r.Nic     = txt_ReCusNIC.Text.ToString();
                    r.Status  = 'n';
                    int ret = r.addRent();
                    if (ret == 0)
                    {
                        MessageBox.Show("Something went wrong", "Warning");
                    }
                }

                if (cmd_ReMov2.SelectedIndex != -1)
                {
                    val = 2;
                    m1  = this.cmd_ReMov1.GetItemText(this.cmd_ReMov1.SelectedItem);
                    m2  = this.cmd_ReMov2.GetItemText(this.cmd_ReMov2.SelectedItem);
                    g1  = this.com_ReGen1.GetItemText(this.com_ReGen1.SelectedItem);
                    g2  = this.com_ReGen2.GetItemText(this.com_ReGen2.SelectedItem);
                    Rent r1 = new Rent();
                    r1.MovieNo = movno2;
                    r1.Nic     = txt_ReCusNIC.Text.ToString();
                    r1.Status  = 'n';
                    //MessageBox.Show("Done");
                    int ret = r1.addRent();
                    if (ret == 0)
                    {
                        MessageBox.Show("Something went wrong", "Warning");
                    }
                }

                if (cmd_ReMov3.SelectedIndex != -1)
                {
                    val = 3;
                    Rent r2 = new Rent();
                    r2.MovieNo = movno3;
                    r2.Nic     = txt_ReCusNIC.Text.ToString();
                    r2.Status  = 'n';
                    //MessageBox.Show("Done");
                    int ret = r2.addRent();
                    if (ret == 0)
                    {
                        MessageBox.Show("Something went wrong", "Warning");
                    }
                    m1 = this.cmd_ReMov1.GetItemText(this.cmd_ReMov1.SelectedItem);
                    m2 = this.cmd_ReMov2.GetItemText(this.cmd_ReMov2.SelectedItem);
                    m3 = this.cmd_ReMov3.GetItemText(this.cmd_ReMov3.SelectedItem);
                    g1 = this.com_ReGen1.GetItemText(this.com_ReGen1.SelectedItem);
                    g2 = this.com_ReGen2.GetItemText(this.com_ReGen2.SelectedItem);
                    g3 = this.com_ReGen3.GetItemText(this.com_ReGen3.SelectedItem);
                }
            }
            this.Close();
            mm = new MovieRental();
            mm.Show();
            DialogResult dr1 = MessageBox.Show("Do you want to print a receipt", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dr1 == DialogResult.Yes)
            {
                switch (val)
                {
                case 1:
                    f1 = new ReceiptForm(customerName, txt_ReCusNIC.Text, DateTime.Now.ToString("mm/dd/yyyy"), txt_ReReturnDate.Text, m1, g1);
                    f1.Show(); break;

                case 2: f1 = new ReceiptForm(customerName, txt_ReCusNIC.Text, DateTime.Now.ToString("mm/dd/yyyy"), txt_ReReturnDate.Text, m1, g1, m2, g2);
                    f1.Show(); break;

                case 3: f1 = new ReceiptForm(customerName, txt_ReCusNIC.Text, DateTime.Now.ToString("mm/dd/yyyy"), txt_ReReturnDate.Text, m1, g1, m2, g2, m3, g3);
                    f1.Show(); break;

                case 0: MessageBox.Show("Select atleast a 1 movie", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); break;
                }
            }
            else
            {
                MessageBox.Show("You have sucessfully rented " + val + " movies", "Message");
            }
        }