Example #1
0
        private void del_btn_Click(object sender, EventArgs e)
        {
            if (RID > 0 && rental_mov_name.Text.Equals("") && rental_cs_name.Text.Equals(""))
            {
                MessageBox.Show("Must need to select the video and Customer");
            }
            else
            {
                Controller.DatabaseClass db = new Controller.DatabaseClass();
                if (db.delRentalVideo(RID))
                {
                    MessageBox.Show("rental video is deleted ");
                    RID                 = 0;
                    cname.Text          = "";
                    rental_cs_name.Text = "";
                    cAge.Text           = "";
                    cPhone.Text         = "";
                    caddress.Text       = "";

                    rental_mov_name.Text = "";
                    vName.Text           = "";
                    year.Text            = "";
                    plot.Text            = "";
                    Cost_txt.Text        = "";
                    copies.Text          = "";
                    genre.Text           = "";
                    rating.Text          = "";
                }
                else
                {
                    MessageBox.Show("Must select the data ");
                }
            }
        }
Example #2
0
        private void update_cs_btn_Click(object sender, EventArgs e)
        {
            if (rental_cs_name.Text.Equals("") && cname.Text.Equals("") && cAge.Text.Equals("") && cPhone.Text.Equals("") && caddress.Text.Equals(""))
            {
                MessageBox.Show("You must need to fill all details ");
            }
            else
            {
                Controller.DatabaseClass dbClient = new Controller.DatabaseClass();
                if (dbClient.editClient(Convert.ToInt32(rental_cs_name.Text), cname.Text, cAge.Text, cPhone.Text, caddress.Text))
                {
                    MessageBox.Show("Client record is updated ");

                    cname.Text          = "";
                    rental_cs_name.Text = "";
                    cAge.Text           = "";
                    cPhone.Text         = "";
                    caddress.Text       = "";
                }
                else
                {
                    MessageBox.Show("check the details once ");
                }
            }
        }
Example #3
0
        private void add_cs_btn_Click(object sender, EventArgs e)
        {
            if (cname.Text.Equals("") && cAge.Text.Equals("") && cPhone.Text.Equals("") && caddress.Text.Equals(""))
            {
                MessageBox.Show("You must need to fill all details ");
            }
            else
            {
                Controller.DatabaseClass dbClient = new Controller.DatabaseClass();
                if (dbClient.addClient(cname.Text, cAge.Text, cPhone.Text, caddress.Text))
                {
                    MessageBox.Show("Client is registered ");

                    cname.Text          = "";
                    rental_cs_name.Text = "";
                    cAge.Text           = "";
                    cPhone.Text         = "";
                    caddress.Text       = "";
                }
                else
                {
                    MessageBox.Show("check the details once ");
                }
            }
        }
Example #4
0
        private void Issue_btn_Click(object sender, EventArgs e)
        {
            if (rental_mov_name.Text.Equals("") && rental_cs_name.Text.Equals(""))
            {
                MessageBox.Show("Must need to select the video and Customer");
            }
            else
            {
                Controller.DatabaseClass db = new Controller.DatabaseClass();
                if (db.bookVideo(Convert.ToInt32(rental_mov_name.Text), Convert.ToInt32(rental_cs_name.Text), dateTimePicker1.Text.ToString()))
                {
                    MessageBox.Show("video is booked ");
                    RID                 = 0;
                    cname.Text          = "";
                    rental_cs_name.Text = "";
                    cAge.Text           = "";
                    cPhone.Text         = "";
                    caddress.Text       = "";

                    rental_mov_name.Text = "";
                    vName.Text           = "";
                    year.Text            = "";
                    plot.Text            = "";
                    Cost_txt.Text        = "";
                    copies.Text          = "";
                    genre.Text           = "";
                    rating.Text          = "";
                }
                else
                {
                    MessageBox.Show("Must select the data ");
                }
            }
        }
Example #5
0
 private void del_mov_Click(object sender, EventArgs e)
 {
     if (rental_mov_name.Text.Equals("") && vName.Text.Equals("") && rating.Text.Equals("") && year.Text.Equals("") && plot.Text.Equals("") && Cost_txt.Text.Equals("") && copies.Text.Equals("") && genre.Text.Equals(""))
     {
         MessageBox.Show("Must need to fill the details ");
     }
     else
     {
         Controller.DatabaseClass db = new Controller.DatabaseClass();
         if (db.delVideo(Convert.ToInt32(rental_mov_name.Text)))
         {
             MessageBox.Show("Video recoord is deleted ");
             rental_mov_name.Text = "";
             vName.Text           = "";
             year.Text            = "";
             plot.Text            = "";
             Cost_txt.Text        = "";
             copies.Text          = "";
             genre.Text           = "";
             rating.Text          = "";
         }
         else
         {
             MessageBox.Show("Check the Video ");
         }
     }
 }
Example #6
0
        private void add_mov_Click(object sender, EventArgs e)
        {
            if (vName.Text.Equals("") && rating.Text.Equals("") && year.Text.Equals("") && plot.Text.Equals("") && Cost_txt.Text.Equals("") && copies.Text.Equals("") && genre.Text.Equals(""))
            {
                MessageBox.Show("Must need to fill the details ");
            }
            else
            {
                Controller.DatabaseClass db = new Controller.DatabaseClass();
                if (db.addVideo(vName.Text, rating.Text, year.Text, plot.Text, Cost_txt.Text, copies.Text, genre.Text))
                {
                    MessageBox.Show("Video is record ");

                    vName.Text    = "";
                    year.Text     = "";
                    plot.Text     = "";
                    Cost_txt.Text = "";
                    copies.Text   = "";
                    genre.Text    = "";
                    rating.Text   = "";
                }
                else
                {
                    MessageBox.Show("Check the Video ");
                }
            }
        }
Example #7
0
 private void allrented_CheckedChanged(object sender, EventArgs e)
 {
     if (allrented.Checked == true)
     {
         Controller.DatabaseClass db = new Controller.DatabaseClass();
         DataTable tbl = new DataTable();
         tbl = db.SelectQuery("select * from Rental");
         dataGridView1.DataSource = tbl;
     }
 }
Example #8
0
        private void pop_cs_CheckedChanged(object sender, EventArgs e)
        {
            if (pop_cs.Checked == true)
            {
                Controller.DatabaseClass db = new Controller.DatabaseClass();
                DataTable tbl = new DataTable();

                tbl = db.SelectQuery("select * from Client");
                int    x = 0, y = 0, c**t = 0;
                String Title = "";
                for (x = 0; x < tbl.Rows.Count; x++)
                {
                    DataTable tblData1 = new DataTable();
                    tblData1 = db.SelectQuery("select * from rental where C_ID='" + tbl.Rows[x]["id"].ToString() + "'");

                    if (tblData1.Rows.Count > c**t)
                    {
                        Title = tbl.Rows[x]["Name"].ToString();
                        c**t  = tblData1.Rows.Count;
                    }
                }
                MessageBox.Show("Popular Video is " + Title);
            }
        }
Example #9
0
        private void return_btn_Click(object sender, EventArgs e)
        {
            if (RID > 0 && rental_mov_name.Text.Equals("") && rental_cs_name.Text.Equals(""))
            {
                MessageBox.Show("Must need to select the video and Customer");
            }
            else
            {
                Controller.DatabaseClass db = new Controller.DatabaseClass();
                if (db.returnVideo(RID, Convert.ToInt32(rental_mov_name.Text), Convert.ToInt32(rental_cs_name.Text), dateTimePicker1.Text.ToString(), dateTimePicker2.Text.ToString()))
                {
                    DataTable tbl = new DataTable();
                    tbl = db.SelectQuery("select * from Video where id=" + Convert.ToInt32(rental_mov_name.Text) + "");
                    int Cost = Convert.ToInt32(tbl.Rows[0]["Cost"].ToString());

                    DataTable tbl1 = new DataTable();
                    tbl1 = db.SelectQuery("select * from Rental where id=" + RID + "");
                    String olDate = tbl1.Rows[0]["BookDate"].ToString();



                    DateTime current_date = DateTime.Now;

                    //convert the old date from string to Date fromat
                    DateTime prev_date = Convert.ToDateTime(olDate);


                    //get the difference in the days fromat
                    String Daysdiff = (current_date - prev_date).TotalDays.ToString();


                    // calculate the round off value
                    Double DaysInterval = Math.Round(Convert.ToDouble(Daysdiff));


                    int Bill = Cost * Convert.ToInt32(DaysInterval);



                    MessageBox.Show("video is returned and bill is $" + Bill);
                    RID                 = 0;
                    cname.Text          = "";
                    rental_cs_name.Text = "";
                    cAge.Text           = "";
                    cPhone.Text         = "";
                    caddress.Text       = "";

                    rental_mov_name.Text = "";
                    vName.Text           = "";
                    year.Text            = "";
                    plot.Text            = "";
                    Cost_txt.Text        = "";
                    copies.Text          = "";
                    genre.Text           = "";
                    rating.Text          = "";
                }
                else
                {
                    MessageBox.Show("Must select the data ");
                }
            }
        }