Esempio n. 1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length != 0 && textBox2.Text.Length != 0 && comboBox1.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0 && textBox6.Text.Length != 0 && textBox7.Text.Length != 0 && comboBox1.Text.Length != 0)
     {
         try
         {
             QueryDataBase qb = new QueryDataBase();
             qb.InsertData("INSERT INTO `cinema`.`film` (`name_film`, `lasting`, `producer`, `description`, `limitation`, `genre`, `Main_male_role`, `Main_female_role`) VALUES ('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox7.Text + "', '" + textBox6.Text + "', '" + comboBox1.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "');");
             MessageBox.Show("Добавление прошло успешно");
         }
         catch (MySql.Data.MySqlClient.MySqlException) { MessageBox.Show("Неправильный формат данных"); }
     }
     else
     {
         MessageBox.Show("Заполните поля");
     }
 }
Esempio n. 2
0
        public Form4()
        {
            InitializeComponent();
            QueryDataBase qb = new QueryDataBase();

            string[] Rows = qb.GetData("SELECT surname FROM cinema.employees where id_employees='" + Form2.ind + " '   ;");
            foreach (string line in Rows)
            {
                string[] columns = line.Split(';');
                textBox1.Text = line;
            }
            QueryDataBase qb1 = new QueryDataBase();

            string[] Rows1 = qb.GetData("SELECT name_employees FROM cinema.employees where id_employees='" + Form2.ind + " '   ;");
            foreach (string line in Rows1)
            {
                string[] columns = line.Split(';');
                textBox2.Text = line;
            }
            QueryDataBase qb2 = new QueryDataBase();

            string[] Rows2 = qb.GetData("SELECT patronicym FROM cinema.employees where id_employees='" + Form2.ind + " '   ;");
            foreach (string line in Rows2)
            {
                string[] columns = line.Split(';');
                textBox3.Text = line;
            }
            QueryDataBase qb3 = new QueryDataBase();

            string[] Rows3 = qb.GetData("SELECT p.position FROM employees  e join position p on e.id_position=p.id_position  where id_employees='" + Form2.ind + " '   ;");
            foreach (string line in Rows3)
            {
                string[] columns = line.Split(';');
                comboBox1.Text = line;
            }
            QueryDataBase qb4 = new QueryDataBase();

            string[] Rows4 = qb.GetData("SELECT phone FROM cinema.employees where id_employees='" + Form2.ind + " '   ;");
            foreach (string line in Rows4)
            {
                string[] columns = line.Split(';');
                maskedTextBox1.Text = line;
            }
        }
Esempio n. 3
0
        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            QueryDataBase qb = new QueryDataBase();

            string[] Rows6 = qb.GetData("SELECT id_timetable FROM ((timetable t join seance s on t.id_seance=s.id_seance) join film f on f.id_film=s.id_film) join hall h on s.id_hall=h.id_hall where t.date_timetable='" + comboBox2.Text + "' and f.name_film='" + comboBox1.Text + "' and s.time_seance='" + comboBox3.Text + "' and h.name_hall='" + comboBox4.Text + "';");
            foreach (string line in Rows6)
            {
                string[] columns = line.Split(';');
                dataGridView6.Rows.Add(columns);
            }


            ind = dataGridView6[0, 0].Value.ToString();
            if (comboBox4.Text == "Gold")
            {
                Gold R = new Gold();
                R.Show();
            }
        }
Esempio n. 4
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox3.Items.Clear();
            dataGridView4.Rows.Clear();
            comboBox3.Text = "";
            comboBox4.Text = "";
            textBox3.Text  = "";
            textBox4.Text  = "";
            try

            {
                if (comboBox2.Text != "")
                {
                    if (comboBox2.Text == DateTime.Now.ToString("yyyy-MM-dd"))
                    {
                        QueryDataBase qb1   = new QueryDataBase();
                        string[]      Rows1 = qb1.GetData("SELECT  s.time_seance FROM cinema.timetable t join seance s on t.id_seance=s.id_seance  where date_timetable = '" + comboBox2.Text + "' and time_seance>='" + DateTime.Now.ToShortTimeString() + "';");
                        foreach (string line in Rows1)
                        {
                            string[] columns = line.Split(';');
                            dataGridView4.Rows.Add(columns);
                        }
                    }
                    else
                    {
                        QueryDataBase qb   = new QueryDataBase();
                        string[]      Rows = qb.GetData("SELECT  s.time_seance FROM cinema.timetable t join seance s on t.id_seance=s.id_seance  where date_timetable = '" + comboBox2.Text + "' ;");
                        foreach (string line in Rows)
                        {
                            string[] columns = line.Split(';');
                            dataGridView4.Rows.Add(columns);
                        }
                    }
                    for (int i = 0; i < dataGridView4.Rows.Count - 1; i++)
                    {
                        comboBox3.Items.Add(dataGridView4[0, i].Value.ToString());
                    }
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException) { }
            catch (NullReferenceException) { }
        }
Esempio n. 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            QueryDataBase qb = new QueryDataBase();

            try
            {
                string[] Rows = qb.GetData("DELETE FROM `cinema`.`employees` WHERE `id_employees`=" + dataGridView1.CurrentRow.Cells[0].Value + ";");
                dataGridView1.Rows.Clear();
                MessageBox.Show("Пользователь удален");
            }
            catch (MySql.Data.MySqlClient.MySqlException)
            { MessageBox.Show("Нельзя удалить пользователя"); }
            dataGridView1.Rows.Clear();
            string[] Rows1 = qb.GetData("Select e.id_employees,e.surname,e.name_employees,e.patronicym,p.position,e.phone FROM employees e join position p on(e.id_position = p.id_position); ");
            foreach (string line in Rows1)
            {
                string[] columns = line.Split(';');
                dataGridView1.Rows.Add(columns);
            }
        }
Esempio n. 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text.Length != 0 && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && comboBox1.Text.Length != 0 && textBox5.Text.Length != 0 && textBox6.Text.Length != 0 && textBox7.Text.Length != 0)
                {
                    QueryDataBase qb = new QueryDataBase();


                    qb.GetData("UPDATE `cinema`.`film` SET `name_film`='" + textBox1.Text + "', `lasting`='" + textBox2.Text + "', `producer`='" + textBox3.Text + "', `description`='" + textBox7.Text + "', `limitation`='" + textBox6.Text + "', `genre`='" + comboBox1.Text + "', `Main_male_role`='" + textBox4.Text + "', `Main_female_role`='" + textBox5.Text + "' WHERE `id_film`='" + Form5.ind + "';");
                    MessageBox.Show("Изменение Прошло успешно");
                }
                else
                {
                    MessageBox.Show("Изменение не выполнено");
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException)
            { MessageBox.Show("Неверны формат данных"); }
        }
Esempio n. 7
0
        private void button2_Click(object sender, EventArgs e)
        {
            QueryDataBase qb = new QueryDataBase();

            try
            {
                string[] Rows1 = qb.GetData("DELETE FROM `Film` WHERE `id_film`='" + dataGridView1.CurrentRow.Cells[0].Value + "';");
                dataGridView1.Rows.Clear();
                MessageBox.Show("Фильм удален");
            }
            catch (MySql.Data.MySqlClient.MySqlException)
            { MessageBox.Show("Нельзя удалить фильм"); }
            dataGridView1.Rows.Clear();
            string[] Rows2 = qb.GetData("SELECT id_film, name_film, lasting, producer, limitation, Main_male_role, Main_female_role from film ; ");
            foreach (string line in Rows2)
            {
                string[] columns = line.Split(';');
                dataGridView1.Rows.Add(columns);
            }
        }
Esempio n. 8
0
        private void button2_Click(object sender, EventArgs e)
        {
            QueryDataBase qb1 = new QueryDataBase();

            try
            {
                string[] Rows = qb1.GetData("DELETE FROM `cinema`.`timetable` WHERE `id_timetable`=" + dataGridView1.CurrentRow.Cells[0].Value + ";");
                dataGridView1.Rows.Clear();
                MessageBox.Show("Пользователь удален");
            }
            catch (MySql.Data.MySqlClient.MySqlException)
            { MessageBox.Show("Нельзя удалить пользователя"); }
            dataGridView1.Rows.Clear();
            string[] Rows1 = qb1.GetData("SELECT t.id_timetable , f.name_film , h.name_hall , m.Measuring ,s.time_seance,s.price, t.date_timetable FROM ((((timetable t  join seance s on t.id_seance=s.id_seance) join hall h on s.id_hall=h.id_hall)  join measuring m on h.id_measuring=m.id_measuring) join film f on s.id_film=f.id_film);");
            foreach (string line in Rows1)
            {
                string[] columns = line.Split(';');
                dataGridView1.Rows.Add(columns);
            }
        }
Esempio n. 9
0
        public RaspisanieDob()
        {
            InitializeComponent();

            QueryDataBase qb = new QueryDataBase();

            string[] Rows = qb.GetData("SELECT id_film,name_film FROM cinema.film;");
            foreach (string line in Rows)
            {
                string[] columns = line.Split(';');
                dataGridView1.Rows.Add(columns);
            }
            for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                comboBox1.Items.Add(dataGridView1[1, i].Value.ToString());
            }


            string[] Rows1 = qb.GetData("SELECT id_hall,name_hall FROM cinema.hall;");
            foreach (string line in Rows1)
            {
                string[] columns = line.Split(';');
                dataGridView2.Rows.Add(columns);
            }
            for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
            {
                comboBox2.Items.Add(dataGridView2[1, i].Value.ToString());
            }

            string[] Rows2 = qb.GetData(" SELECT id_seance FROM cinema.seance;");
            foreach (string line in Rows2)
            {
                string[] columns = line.Split(';');
                dataGridView3.Rows.Add(columns);
            }
        }
Esempio n. 10
0
        public Gold()
        {
            string CBi1 = "1";

            String CBj1  = "1";
            String CBj2  = "2";
            String CBj3  = "3";
            String CBj4  = "4";
            String CBj5  = "5";
            String CBj6  = "6";
            String CBj7  = "7";
            String CBj8  = "8";
            String CBj9  = "9";
            String CBj10 = "10";

            string CBi2 = "2";

            String CBj21  = "1";
            String CBj22  = "2";
            String CBj23  = "3";
            String CBj24  = "4";
            String CBj25  = "5";
            String CBj26  = "6";
            String CBj27  = "7";
            String CBj28  = "8";
            String CBj29  = "9";
            String CBj210 = "10";
            String CBj211 = "11";
            String CBj212 = "12";

            string CBi3 = "3";

            String CBj31  = "1";
            String CBj32  = "2";
            String CBj33  = "3";
            String CBj34  = "4";
            String CBj35  = "5";
            String CBj36  = "6";
            String CBj37  = "7";
            String CBj38  = "8";
            String CBj39  = "9";
            String CBj310 = "10";

            string CBi4 = "4";

            String CBj41  = "1";
            String CBj42  = "2";
            String CBj43  = "3";
            String CBj44  = "4";
            String CBj45  = "5";
            String CBj46  = "6";
            String CBj47  = "7";
            String CBj48  = "8";
            String CBj49  = "9";
            String CBj410 = "10";
            String CBj411 = "11";
            String CBj412 = "12";

            string CBi5 = "5";

            String CBj51  = "1";
            String CBj52  = "2";
            String CBj53  = "3";
            String CBj54  = "4";
            String CBj55  = "5";
            String CBj56  = "6";
            String CBj57  = "7";
            String CBj58  = "8";
            String CBj59  = "9";
            String CBj510 = "10";
            String CBj511 = "11";
            String CBj512 = "12";

            string CBi6 = "6";

            String CBj61  = "1";
            String CBj62  = "2";
            String CBj63  = "3";
            String CBj64  = "4";
            String CBj65  = "5";
            String CBj66  = "6";
            String CBj67  = "7";
            String CBj68  = "8";
            String CBj69  = "9";
            String CBj610 = "10";
            String CBj611 = "11";
            String CBj612 = "12";

            InitializeComponent();
            try
            {
                QueryDataBase qb   = new QueryDataBase();
                string[]      Rows = qb.GetData("SELECT p.row_place, p.place FROM ticket t join place p on  t.id_place=p.id_place where id_timetable='" + Sale.ind + "';");
                foreach (string line in Rows)
                {
                    string[] columns = line.Split(';');
                    dataGridView1.Rows.Add(columns);
                }
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    if (CBi1 == dataGridView1[0, i].Value.ToString())
                    {
                        if (CBj1 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox1.Enabled = false;
                        }
                        if (CBj2 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox2.Enabled = false;
                        }
                        if (CBj3 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox3.Enabled = false;
                        }
                        if (CBj4 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox4.Enabled = false;
                        }
                        if (CBj5 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox5.Enabled = false;
                        }
                        if (CBj6 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox6.Enabled = false;
                        }
                        if (CBj7 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox7.Enabled = false;
                        }
                        if (CBj8 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox8.Enabled = false;
                        }
                        if (CBj9 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox9.Enabled = false;
                        }
                        if (CBj10 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox10.Enabled = false;
                        }
                    }
                    if (CBi2 == dataGridView1[0, i].Value.ToString())
                    {
                        if (CBj21 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox20.Enabled = false;
                        }
                        if (CBj22 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox19.Enabled = false;
                        }
                        if (CBj23 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox18.Enabled = false;
                        }
                        if (CBj24 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox17.Enabled = false;
                        }
                        if (CBj25 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox16.Enabled = false;
                        }
                        if (CBj26 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox15.Enabled = false;
                        }
                        if (CBj27 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox14.Enabled = false;
                        }
                        if (CBj28 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox13.Enabled = false;
                        }
                        if (CBj29 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox12.Enabled = false;
                        }
                        if (CBj210 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox11.Enabled = false;
                        }
                        if (CBj211 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox21.Enabled = false;
                        }
                        if (CBj212 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox22.Enabled = false;
                        }
                    }
                    if (CBi3 == dataGridView1[0, i].Value.ToString())
                    {
                        if (CBj31 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox32.Enabled = false;
                        }
                        if (CBj32 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox31.Enabled = false;
                        }
                        if (CBj33 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox30.Enabled = false;
                        }
                        if (CBj34 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox29.Enabled = false;
                        }
                        if (CBj35 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox28.Enabled = false;
                        }
                        if (CBj36 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox27.Enabled = false;
                        }
                        if (CBj37 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox26.Enabled = false;
                        }
                        if (CBj38 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox25.Enabled = false;
                        }
                        if (CBj39 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox24.Enabled = false;
                        }
                        if (CBj310 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox23.Enabled = false;
                        }
                    }
                    if (CBi4 == dataGridView1[0, i].Value.ToString())
                    {
                        if (CBj41 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox44.Enabled = false;
                        }
                        if (CBj42 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox43.Enabled = false;
                        }
                        if (CBj43 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox42.Enabled = false;
                        }
                        if (CBj44 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox41.Enabled = false;
                        }
                        if (CBj45 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox40.Enabled = false;
                        }
                        if (CBj46 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox39.Enabled = false;
                        }
                        if (CBj47 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox38.Enabled = false;
                        }
                        if (CBj48 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox37.Enabled = false;
                        }
                        if (CBj49 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox36.Enabled = false;
                        }
                        if (CBj410 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox35.Enabled = false;
                        }
                        if (CBj411 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox34.Enabled = false;
                        }
                        if (CBj412 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox33.Enabled = false;
                        }
                    }

                    if (CBi5 == dataGridView1[0, i].Value.ToString())
                    {
                        if (CBj51 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox56.Enabled = false;
                        }
                        if (CBj52 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox55.Enabled = false;
                        }
                        if (CBj53 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox54.Enabled = false;
                        }
                        if (CBj54 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox53.Enabled = false;
                        }
                        if (CBj55 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox52.Enabled = false;
                        }
                        if (CBj56 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox51.Enabled = false;
                        }
                        if (CBj57 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox50.Enabled = false;
                        }
                        if (CBj58 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox49.Enabled = false;
                        }
                        if (CBj59 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox48.Enabled = false;
                        }
                        if (CBj510 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox47.Enabled = false;
                        }
                        if (CBj511 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox46.Enabled = false;
                        }
                        if (CBj512 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox45.Enabled = false;
                        }
                    }

                    if (CBi6 == dataGridView1[0, i].Value.ToString())
                    {
                        if (CBj61 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox68.Enabled = false;
                        }
                        if (CBj62 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox67.Enabled = false;
                        }
                        if (CBj63 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox66.Enabled = false;
                        }
                        if (CBj64 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox65.Enabled = false;
                        }
                        if (CBj65 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox64.Enabled = false;
                        }
                        if (CBj66 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox63.Enabled = false;
                        }
                        if (CBj67 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox62.Enabled = false;
                        }
                        if (CBj68 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox61.Enabled = false;
                        }
                        if (CBj69 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox60.Enabled = false;
                        }
                        if (CBj610 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox59.Enabled = false;
                        }
                        if (CBj611 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox58.Enabled = false;
                        }
                        if (CBj612 == dataGridView1[1, i].Value.ToString())
                        {
                            checkBox57.Enabled = false;
                        }
                    }
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException) { }
            catch (NullReferenceException) { }
        }
Esempio n. 11
0
        public RaspisanieIzm()
        {
            InitializeComponent();

            QueryDataBase qb = new QueryDataBase();

            string[] Rows = qb.GetData("SELECT id_film,name_film FROM cinema.film;");
            foreach (string line in Rows)
            {
                string[] columns = line.Split(';');
                dataGridView1.Rows.Add(columns);
            }
            for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                comboBox1.Items.Add(dataGridView1[1, i].Value.ToString());
            }


            string[] Rows1 = qb.GetData("SELECT id_hall,name_hall FROM cinema.hall;");
            foreach (string line in Rows1)
            {
                string[] columns = line.Split(';');
                dataGridView2.Rows.Add(columns);
            }
            for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
            {
                comboBox2.Items.Add(dataGridView2[1, i].Value.ToString());
            }

            string[] Rows2 = qb.GetData(" SELECT id_seance FROM cinema.seance;");
            foreach (string line in Rows2)
            {
                string[] columns = line.Split(';');
                dataGridView3.Rows.Add(columns);
            }
            string[] Rows3 = qb.GetData("SELECT name_film FROM (timetable t join seance s on t.id_seance=s.id_seance) join film f on s.id_film=f.id_film where id_timetable='" + Raspisanie.ind + " '   ;");
            foreach (string line in Rows3)
            {
                string[] columns = line.Split(';');
                comboBox1.Text = line;
            }
            QueryDataBase qb1 = new QueryDataBase();

            string[] Rows4 = qb.GetData("SELECT name_hall FROM(timetable t join seance s on t.id_seance = s.id_seance) join hall h on s.id_hall = h.id_hall where id_timetable = '" + Raspisanie.ind + " '   ;");
            foreach (string line in Rows4)
            {
                string[] columns = line.Split(';');
                comboBox2.Text = line;
            }
            QueryDataBase qb2 = new QueryDataBase();

            string[] Rows5 = qb.GetData("SELECT time_seance FROM (timetable t join seance s on t.id_seance=s.id_seance)  where id_timetable='" + Raspisanie.ind + " '   ;");
            foreach (string line in Rows5)
            {
                string[] columns = line.Split(';');
                textBox1.Text = line;
            }
            QueryDataBase qb3 = new QueryDataBase();

            string[] Rows6 = qb.GetData("SELECT price FROM (timetable t join seance s on t.id_seance=s.id_seance)  where id_timetable='" + Raspisanie.ind + " '   ;");
            foreach (string line in Rows6)
            {
                string[] columns = line.Split(';');
                textBox2.Text = line;
            }
            QueryDataBase qb4 = new QueryDataBase();

            string[] Rows7 = qb.GetData("SELECT date_timetable FROM cinema.timetable where id_timetable='" + Raspisanie.ind + " '   ;");
            foreach (string line in Rows7)
            {
                string[] columns = line.Split(';');
                maskedTextBox1.Text = line;
            }
            string[] Rows8 = qb.GetData("SELECT s.id_seance  FROM (timetable t join seance s on t.id_seance=s.id_seance)  where id_timetable='" + Raspisanie.ind + " '   ;");
            foreach (string line in Rows8)
            {
                string[] columns = line.Split(';');
                textBox3.Text = line;
            }
        }
Esempio n. 12
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text != "" && comboBox2.Text != "" && comboBox3.Text != "" && comboBox4.Text != "" && textBox1.Text != "" && textBox2.Text != "" && comboBox7.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "")
            {
                try

                {
                    string d  = "";
                    string d2 = "";
                    for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
                    {
                        if (comboBox7.Text == dataGridView2[1, i].Value.ToString())
                        {
                            d = dataGridView2[0, i].Value.ToString();
                        }
                    }

                    QueryDataBase qb = new QueryDataBase();
                    qb.InsertData("INSERT INTO `cinema`.`tab` (`id_employees`, `date_sale`, `time_sale`) VALUES ('" + d + "', '" + textBox1.Text + "', '" + textBox2.Text + "');");

                    string[] Rows6 = qb.GetData("SELECT id_tab FROM cinema.tab where date_sale ='" + textBox1.Text + "' and time_sale = '" + textBox2.Text + "';");
                    foreach (string line in Rows6)
                    {
                        string[] columns = line.Split(';');
                        dataGridView7.Rows.Add(columns);
                    }
                    d2 = dataGridView7[0, 0].Value.ToString();
                    for (int i = 0; i < Rows.Length; i++)
                    {
                        string[] Rows5 = qb.GetData("SELECT id_place FROM cinema.place p join hall h on p.id_hall=h.id_hall where h.name_hall='" + comboBox4.Text + "' and p.row_place='" + Rows[i] + "' and p.place='" + Places[i] + "';");

                        foreach (string line in Rows5)
                        {
                            string[] columns = line.Split(';');
                            dataGridView8.Rows.Add(columns);
                        }
                    }
                    for (int i = 0; i < dataGridView8.Rows.Count - 1; i++)
                    {
                        qb.InsertData("INSERT INTO `cinema`.`ticket` (`id_tab`, `id_timetable`, `id_place`) VALUES ('" + d2 + "', '" + ind + "', '" + dataGridView8[0, i].Value.ToString() + "');");
                    }
                }
                catch (MySql.Data.MySqlClient.MySqlException) { }
                catch (NullReferenceException) { }
                MessageBox.Show("Продажа прошла успешно ");
                System.IO.FileStream   fs           = new System.IO.FileStream(@"C:\Users\PC\Desktop\Cinema\1.txt", System.IO.FileMode.Create);
                System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(fs);

                try
                {
                    streamWriter.WriteLine("           Чек");
                    streamWriter.WriteLine("==========================");
                    streamWriter.WriteLine("Дата продажи - " + textBox1.Text);
                    streamWriter.WriteLine("Время продажи - " + textBox2.Text);
                    streamWriter.WriteLine("Продавец - " + comboBox7.Text);
                    streamWriter.WriteLine("==========================");
                    streamWriter.WriteLine("Фильм - " + comboBox1.Text);
                    streamWriter.WriteLine("Дата Сеанса - " + comboBox2.Text);
                    streamWriter.WriteLine("Время Сеанса - " + comboBox3.Text);
                    streamWriter.WriteLine("Зал - " + comboBox4.Text);
                    streamWriter.WriteLine("Количество Билетов - " + kolB);
                    streamWriter.WriteLine("Цена - " + textBox5.Text);
                    streamWriter.WriteLine("==========================");
                    streamWriter.Close();
                    fs.Close();

                    MessageBox.Show("Чек успешно сохранен");
                }
                catch
                {
                    MessageBox.Show("Ошибка при сохранении файла!");
                }

                System.IO.FileStream   fs1         = new System.IO.FileStream(@"C:\Users\PC\Desktop\Cinema\2.txt", System.IO.FileMode.Create);
                System.IO.StreamWriter streamWrite = new System.IO.StreamWriter(fs1);
                for (int i = 0; i < kolB; i++)
                {
                    try
                    {
                        streamWrite.WriteLine("           Билет");
                        streamWrite.WriteLine("==========================");
                        streamWrite.WriteLine("Фильм - " + comboBox1.Text);
                        streamWrite.WriteLine("Дата Сеанса - " + comboBox2.Text);
                        streamWrite.WriteLine("Время Сеанса - " + comboBox3.Text);
                        streamWrite.WriteLine("Зал - " + comboBox4.Text);
                        streamWrite.WriteLine("Ряд " + Rows[i]);
                        streamWrite.WriteLine("Место " + Places[i]);
                        streamWrite.WriteLine("Цена - " + dataGridView9[0, 0].Value.ToString());
                        streamWrite.WriteLine("==========================");
                    }
                    catch
                    {
                        MessageBox.Show("Ошибка при сохранении файла!");
                    }
                }
                MessageBox.Show("Билет успешно сохранен");
                streamWrite.Close();
                fs1.Close();
            }
            else
            {
                MessageBox.Show("Заполните поля");
            }
        }
Esempio n. 13
0
        public Form8()
        {
            InitializeComponent();
            QueryDataBase qb = new QueryDataBase();

            string[] Rows = qb.GetData("SELECT name_film FROM cinema.film where id_film='" + Form5.ind + " '   ;");
            foreach (string line in Rows)
            {
                string[] columns = line.Split(';');
                textBox1.Text = line;
            }
            QueryDataBase qb1 = new QueryDataBase();

            string[] Rows1 = qb.GetData("SELECT lasting FROM cinema.film where id_film='" + Form5.ind + " '   ;");
            foreach (string line in Rows1)
            {
                string[] columns = line.Split(';');
                textBox2.Text = line;
            }
            QueryDataBase qb2 = new QueryDataBase();

            string[] Rows2 = qb.GetData("SELECT producer FROM cinema.film where id_film='" + Form5.ind + " ' ;");
            foreach (string line in Rows2)
            {
                string[] columns = line.Split(';');
                textBox3.Text = line;
            }
            QueryDataBase qb3 = new QueryDataBase();

            string[] Rows3 = qb.GetData("SELECT genre FROM cinema.film where id_film='" + Form5.ind + " ' ;");
            foreach (string line in Rows3)
            {
                string[] columns = line.Split(';');
                comboBox1.Text = line;
            }
            QueryDataBase qb4 = new QueryDataBase();

            string[] Rows4 = qb.GetData("SELECT Main_male_role FROM cinema.film where id_film='" + Form5.ind + " ' ;");
            foreach (string line in Rows4)
            {
                string[] columns = line.Split(';');
                textBox4.Text = line;
            }

            QueryDataBase qb5 = new QueryDataBase();

            string[] Rows5 = qb.GetData("SELECT Main_female_role FROM cinema.film where id_film='" + Form5.ind + " ' ;");
            foreach (string line in Rows5)
            {
                string[] columns = line.Split(';');
                textBox5.Text = line;
            }


            string[] Rows6 = qb.GetData("SELECT limitation FROM cinema.film where id_film='" + Form5.ind + " ' ;");
            foreach (string line in Rows6)
            {
                string[] columns = line.Split(';');
                textBox6.Text = line;
            }
            string[] Rows7 = qb.GetData("SELECT description FROM cinema.film where id_film='" + Form5.ind + " ' ;");
            foreach (string line in Rows7)
            {
                string[] columns = line.Split(';');
                textBox7.Text = line;
            }
        }