private void button3_Click(object sender, EventArgs e)
        {
            MovieBooking obj = new MovieBooking();
            DataTable    tbl = new DataTable();

            tbl = obj.Sql_Record("select * from RentalTable");
            dgvTable.DataSource = tbl;
            record = "rental";
        }
        private void btn_BookVideo_Click(object sender, EventArgs e)
        {
            MovieBooking obj = new MovieBooking(Convert.ToInt32(txt_CustomerID.Text), Convert.ToInt32(txt_MovieID.Text), dtp_IssueDate.Text);

            txt_CustomerID.Text = "";
            txt_MovieID.Text    = "";

            tarun_CustomerAddress.Text = "";
            tarun_CustomerFName.Text   = "";
            tarun_CustomerLName.Text   = "";
            tarun_CustomerMobile.Value = 0;
            tarun_VideoTitle.Text      = "";
            tarun_VideoRatting.Text    = "";
            tarun_movie_year.Text      = "";
            tarun_VideoCopies.Value    = 0;
            tarun_VideoCost.Value      = 0;
            tarun_VideoPlot.Text       = "";
            tarun_VideoGenre.Text      = "";
        }
        private void btn_DeleteVideo_Click(object sender, EventArgs e)
        {
            // delete the movie to delete
            MovieBooking obj = new MovieBooking(rentId);


            txt_CustomerID.Text        = "";
            txt_MovieID.Text           = "";
            tarun_CustomerAddress.Text = "";
            tarun_CustomerFName.Text   = "";
            tarun_CustomerLName.Text   = "";
            tarun_CustomerMobile.Value = 0;
            tarun_VideoTitle.Text      = "";
            tarun_VideoRatting.Text    = "";
            tarun_movie_year.Text      = "";
            tarun_VideoCopies.Value    = 0;
            tarun_VideoCost.Value      = 0;
            tarun_VideoPlot.Text       = "";
            tarun_VideoGenre.Text      = "";
            rentId = 0;
        }
        private void btn_ReturnVideo_Click(object sender, EventArgs e)
        {
            /* try
             * {
             */
            MovieBooking obj = new MovieBooking(rentId, Convert.ToInt32(txt_CustomerID.Text), Convert.ToInt32(txt_MovieID.Text), dtp_IssueDate.Text, dtp_ReturnDate.Text);

            DateTime new_date = DateTime.Now;


            Movie objct = new Movie();



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


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


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


            string    query1 = "select * from MovieTable where Movie_Pk=" + Convert.ToInt32(txt_MovieID.Text) + "";
            DataTable tbl1   = new DataTable();

            tbl1 = objct.Sql_Record(query1);
            int cost = Convert.ToInt32(tbl1.Rows[0]["Movie_Cost"]);



            int Price = Convert.ToInt32(DaysInterval) * cost;

            MessageBox.Show("Your bill is: " + Price);


            /*
             * }
             * catch (Exception ex)
             * {
             *  MessageBox.Show("select the video to return ");
             * }
             * finally {*/
            txt_CustomerID.Text = "";
            txt_MovieID.Text    = "";

            tarun_CustomerAddress.Text = "";
            tarun_CustomerFName.Text   = "";
            tarun_CustomerLName.Text   = "";
            tarun_CustomerMobile.Value = 0;
            tarun_VideoTitle.Text      = "";
            tarun_VideoRatting.Text    = "";
            tarun_movie_year.Text      = "";
            tarun_VideoCopies.Value    = 0;
            tarun_VideoCost.Value      = 0;
            tarun_VideoPlot.Text       = "";
            tarun_VideoGenre.Text      = "";


            // }
        }