Пример #1
0
        //Generate the report according to the selected fucntion
        private void btn_Generate_Click(object sender, EventArgs e)
        {
            if (rbn_allCusRent.Checked || rbn_allCusRange.Checked)
            {
                if (string.IsNullOrEmpty(txt_nic.Text))
                {
                    MessageBox.Show("Enter NIC", "Alert1", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    while (dataGridView1.Rows.Count > 0)
                    {
                        dataGridView1.Rows.RemoveAt(0);
                    }
                    txt_nic.Focus();
                }
            }
            string d1 = "", d2 = "", nic = txt_nic.Text;
            int    value1 = 3;

            if (rbn_allCusRent.Checked)
            {
                value1 = 0;
            }

            if (rbn_allCusRange.Checked)
            {
                value1 = 1;
                d1     = dateTimePicker1.Value.ToShortDateString();
                d2     = dateTimePicker2.Value.ToShortDateString();
            }

            if (rbn_notReturned.Checked)
            {
                value1 = 2;
            }

            if (rbn_allCus.Checked)
            {
                value1 = 3;
            }

            db = new DBconnection();
            dataGridView1.DataSource = db.repcus(value1, d1, d2, nic);

            if (dataGridView1.RowCount == 0)
            {
                MessageBox.Show("No Data", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        private void deleteR_Click(object sender, EventArgs e)
        {
            DialogResult r1 = MessageBox.Show("This customer may have some transactions\nAre you sure?", "Delete", MessageBoxButtons.YesNo);

            if (r1 == DialogResult.Yes)
            {
                dbc1 = new DBconnection();
                dbc1.deleteCust(nicI.Text);
                MessageBox.Show("Sucessfully deleted customer data related to nic no : " + nicI.Text, "Completed");
                customerSearch_Load(this, null);
            }
            else
            {
                this.Show();
                animationLoad(false, 255, 255, 255);
            }
        }
Пример #3
0
        private void com_ReGen2_SelectedIndexChanged(object sender, EventArgs e)
        {
            //cmd_ReMov2.Enabled = true;
            cmd_ReMov2.Items.Clear();
            List <string> list1 = new List <string>();
            DBconnection  db1   = new DBconnection();

            list1.AddRange(db1.searchByGenre(com_ReGen2.SelectedItem.ToString()));
            foreach (string s in list1)
            {
                if (s == mov1)
                {
                    list1.Remove(s);
                    break;
                }
            }
            cmd_ReMov2.Items.AddRange(list1.ToArray());
        }
Пример #4
0
 private void button_del_Click(object sender, EventArgs e)//Delete a movie
 {
     if (movieI.Text == "")
     {
         movieI.Text      = "Enter a movie";
         movieI.ForeColor = System.Drawing.Color.Red;
     }
     else
     {
         DialogResult r1 = MessageBox.Show("Do you sure about this movie deletion?", "Warning", MessageBoxButtons.YesNo);
         if (r1 == DialogResult.Yes)
         {
             dbc1 = new DBconnection();
             dbc1.deleteMovie(movieI.Text);
             movieNameMsgBox_Load(this, null);//reload form again to refresh auto complete
         }
     }
 }
Пример #5
0
        private void btn_load_Click(object sender, EventArgs e)
        {
            int    maxCount = 0;
            String maxMovie = "";


            String fromDate = dtp_From.Value.ToShortDateString();
            String toDate   = dtp_To.Value.ToShortDateString();

            int    reportType = 2;
            String s          = "Most Popular Genre ";

            if (rbn_customer.Checked)
            {
                reportType = 0;
                s          = "The Best Customer ";
            }
            else if (rbn_movie.Checked)
            {
                reportType = 1;
                s          = "Most Popular Movie ";
            }


            DBconnection     db     = new DBconnection();
            OracleDataReader reader = db.DetailsForChart(fromDate, toDate, reportType);


            while (reader.Read())
            {
                if (maxCount < Convert.ToInt32(reader[1]))
                {
                    maxCount = Convert.ToInt32(reader[1]);
                    maxMovie = reader[0].ToString();
                }

                this.chart1.Series["Number of times rented"].Points.AddXY(reader[0], reader[1]);
            }

            lbl_summary.Text = s + " for the Period : " + maxMovie;
            lbl_summary.Show();

            btn_load.Enabled = false;
        }
Пример #6
0
 private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         var item = dataGridView2.Rows[e.RowIndex].Cells[0].Value;
         txt_RuMovieName.Text = item.ToString();
         DBconnection db1 = new DBconnection();
         Movie        m   = db1.searchMovie(txt_RuMovieName.Text);
         movno = m.Movie_Id;
         txt_RuMovieRent.Text = m.Price.ToString();
         Rent r1      = new Rent();
         int  fineval = r1.getfines(m.Movie_Id, txt_RuCusNIC.Text);
         txt_fines.Text   = fineval.ToString();
         txt_RuTotal.Text = ((m.Price) + fineval).ToString();
     }
     catch (Exception)
     {
         MessageBox.Show("Click on a movie name", "Select Movie", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #7
0
        private void EditMovie_Load(object sender, EventArgs e)
        {
            cmb_genre.Enabled  = false;
            txt_movieName.Text = movieNameCurrent;
            dbc1 = new DBconnection();
            AutoCompleteStringCollection at1 = dbc1.dataLoadToSuggestion("movie_name", "movie");

            txt_movieName.AutoCompleteCustomSource = at1;


            Movie movie = new Movie();

            movie = movie.searchMovie(movieNameCurrent);

            id = movie.Movie_Id;
            txt_movieName.Text     = movie.Movie_Name;
            cmb_genre.SelectedItem = movie.Genre;
            txt_price.Text         = movie.Price.ToString();
            txt_noCopies.Text      = movie.No_Of_Copies.ToString();
        }
Пример #8
0
        //Search movies according to the selected genre
        private void com_ReGen3_SelectedIndexChanged(object sender, EventArgs e)
        {
            //cmd_ReMov3.Enabled = true;
            cmd_ReMov3.Items.Clear();
            List <string> list2 = new List <string>();
            DBconnection  db2   = new DBconnection();

            list2.AddRange(db2.searchByGenre(com_ReGen3.SelectedItem.ToString()));
            foreach (string s in list2.ToList())
            {
                if (s == mov1)
                {
                    list2.Remove(s);
                    continue;
                }
                if (s == mov2)
                {
                    list2.Remove(s);
                    continue;
                }
            }
            cmd_ReMov3.Items.AddRange(list2.ToArray());
        }
Пример #9
0
        public DataTable searchCustomer(string nic)
        {
            DBconnection db = new DBconnection();

            return(db.seachCustomer(nic));
        }
Пример #10
0
        public Movie searchMovie(String name)
        {
            DBconnection db = new DBconnection();

            return(db.searchMovie(name));
        }