Esempio n. 1
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            listBox2.Items.Clear();
            Filmc = listBox1.SelectedIndex + 10;
            string sc_getDate = "Select date_session from film_session where date_session >= getdate() and film_id=" + Filmc + " ";

            conection = ClassSQL.GetConect();
            conection.Open();
            try
            {
                sclCom2 = new SqlCommand(sc_getDate, conection);
                DataSet        datset = new DataSet("datetime");
                SqlDataAdapter dat    = new SqlDataAdapter(sclCom2);
                dat.Fill(datset, "Datetime");
                foreach (DataRow row in datset.Tables["Datetime"].Rows)
                {
                    listBox2.Items.Add(row["date_session"]);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conection.Close();
                conection.Dispose();
            }
            listBox2.Visible = true;
            label3.Visible   = true;
            Filmc            = 0;
        }
Esempio n. 2
0
        public ViborSeans(int id_pok)
        {
            InitializeComponent();
            id_p      = id_pok;
            conection = ClassSQL.GetConect();
            conection.Open();
            try
            {
                sclCom = new SqlCommand(sc_getFilm, conection);
                DataSet        ds  = new DataSet("film_name");
                SqlDataAdapter dat = new SqlDataAdapter(sclCom);
                dat.Fill(ds, "Film");
                foreach (DataRow row in ds.Tables["Film"].Rows)
                {
                    listBox1.Items.Add(row["film_name"]);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conection.Close();
                conection.Dispose();
            }
        }
Esempio n. 3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            znach = comboBox1.SelectedItem.ToString();
            SqlConnection conection = ClassSQL.GetConect();

            conection.Open();

            if (znach != " ")
            {
                try
                {
                    Filldgv(conection);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    //conection.Close();
                    //conection.Dispose();
                    dataGridView1.Refresh();
                }
            }
        }
Esempio n. 4
0
        private void LoadKolvo()
        {
            SqlConnection conection  = ClassSQL.GetConect();
            SqlConnection conection3 = ClassSQL.GetConect();

            conection.Open();
            conection3.Open();
            try
            {
                string cs_date = "set language english; select session_id from film_session where date_session = '" + convDat(listBox2.SelectedItem.ToString()) + "' ;";

                sclCom5 = new SqlCommand(cs_date, conection);


                go = sclCom5.ExecuteScalar().ToString();

                idha = go;

                string cs_truemesto = "select count(place.place_id) from place where free=0 and session_id=" + go + ";";
                sclCom3 = new SqlCommand(cs_truemesto, conection3);
                string truemesto = sclCom3.ExecuteScalar().ToString();

                label_Kolvo.Text = (Int32.Parse(truemesto)).ToString();
                conection.Close();
                conection.Dispose();
                conection3.Close();
                conection3.Dispose();
            }
            catch
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
        private void LoadCinema()
        {
            SqlConnection conection  = ClassSQL.GetConect();
            SqlConnection conection3 = ClassSQL.GetConect();

            conection.Open();
            conection3.Open();
            string cs_date = "set language english; select session_id from film_session where date_session = '" + convDat(listBox2.SelectedItem.ToString()) + "' ;";

            sclCom5 = new SqlCommand(cs_date, conection);

            go   = sclCom5.ExecuteScalar().ToString();//id_session
            idha = go;

            string cs_truecinema = "select c.cinema_name from film_session f join cinema c on c.cinema_id=f.cinema_id and f.session_id=" + go + ";";

            sclCom3 = new SqlCommand(cs_truecinema, conection3);
            string truecinema = sclCom3.ExecuteScalar().ToString();

            label_cinema.Text = (truecinema).ToString();
            conection.Close();
            conection.Dispose();
            conection3.Close();
            conection3.Dispose();
        }
Esempio n. 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            {
                SqlConnection conection = ClassSQL.GetConect();
                conection.Open();

                if (znach != " ")
                {
                    try
                    {
                        Filldgv(conection);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Что-то пошло не так(" + ex.Message);
                    }
                    finally
                    {
                        conection.Close();
                        conection.Dispose();
                        dataGridView1.Refresh();
                    }
                }
            }
        }
Esempio n. 7
0
        private void LoadKolvo()
        {
            SqlConnection conection  = ClassSQL.GetConect();
            SqlConnection conection3 = ClassSQL.GetConect();

            conection.Open();
            conection3.Open();
            string cs_date = "set language english; select ID_Seans from Seans where Data_time_Seans = '" + convDat(listBox2.SelectedItem.ToString()) + "' ;";

            dat_seans = convDat(listBox2.SelectedItem.ToString());
            sclCom    = new SqlCommand(cs_date, conection);
            go        = sclCom.ExecuteScalar().ToString();
            idha      = go;


            string cs_truemesto = "select count(ID_Mesto) from Mesto where Zan_Mesto = 0 and ID_Seans = " + go + ";";

            sclCom = new SqlCommand(cs_truemesto, conection);
            string truemesto = sclCom.ExecuteScalar().ToString();

            label_Kolvo.Text = (Int32.Parse(truemesto)).ToString();
            conection.Close();
            conection.Dispose();
            conection3.Close();
            conection3.Dispose();
        }
Esempio n. 8
0
        public AddFilm()
        {
            InitializeComponent();

            SqlConnection conection  = ClassSQL.GetConect();
            SqlConnection conection2 = ClassSQL.GetConect();
            SqlConnection conection3 = ClassSQL.GetConect();

            conection.Open();
            conection2.Open();
            conection3.Open();
            try
            {
                Filldgv(conection);
                Filljanr(conection2);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conection.Close();
                conection.Dispose();
                conection2.Close();
                conection2.Dispose();
                conection3.Close();
                conection3.Dispose();
            }
        }
Esempio n. 9
0
 public PersFrom(int id_pers, string id_dolj) //string
 {
     InitializeComponent();
     id_p      = id_pers;
     id_d      = id_dolj;
     id_pol    = id_dolj;
     conection = ClassSQL.GetConect();
     conection.Open();
     try
     {
         FillInfo();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         conection.Close();
         conection.Dispose();
     }
     if (id_d == "администратор")
     {
         button7.Visible = true;
         button3.Visible = true;
         button4.Visible = true;
         panel1.Location = new System.Drawing.Point(12, 190);
     }
 }
Esempio n. 10
0
        private void button2_Click(object sender, EventArgs e)
        {
            string        sc_writepokup = "insert into cinema_card (surname_card, name_card, patronymic_card, phone_pers,points) values('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "');";
            SqlConnection conection     = ClassSQL.GetConect();

            conection.Open();
            try
            {
                scom3 = new SqlCommand(sc_writepokup, conection);
                scom3.ExecuteNonQuery();
                MessageBox.Show("Добавление прошло успешно!", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
                textBox4.Clear();
                textBox5.Clear();
                dataGridView1.Refresh();
                SqlConnection conection2 = ClassSQL.GetConect();
                conection2.Open();
                Filldgv(conection2);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка. Возможно данные введены некорректно. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            conection.Close();
            conection.Dispose();
        }
Esempio n. 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            string        sc_writepers = "  insert into personal (cinema_id, position, surname_pers,name_pers, patronymic_pers, passport_seria, passport_number, phone_pers, login_pers,password_pers) values ('" + textBox_kin.Text + "', '" + textBox_dolj.Text + "', '" + textBox_fam.Text + "', '" + textBox_nam.Text + "', '" + textBox_otc.Text + "', '" + textBox_pasp.Text + "', '" + textBox_pasp2.Text + "', '" + textBox_mob.Text + "', '" + textBox_log.Text + "', '" + textBox_pass.Text + "');";
            SqlConnection conection    = ClassSQL.GetConect();

            conection.Open();



            try
            {
                scom3 = new SqlCommand(sc_writepers, conection);
                scom3.ExecuteNonQuery();
                MessageBox.Show("Добавление прошло успешно!", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_kin.Clear();
                textBox_pasp.Clear();
                textBox_pasp2.Clear();
                textBox_mob.Clear();
                textBox_nam.Clear();
                textBox_fam.Clear();
                textBox_otc.Clear();
                textBox_log.Clear();
                textBox_pass.Clear();
                dataGridView1.Refresh();
                SqlConnection conection2 = ClassSQL.GetConect();
                conection2.Open();
                Filldgv(conection2);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка. Возможно вы ввели неверные данные. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            conection.Close();
            conection.Dispose();
        }
Esempio n. 12
0
        private void FullNameFilm(SqlConnection conn)
        {
            SqlConnection conection4 = ClassSQL.GetConect();

            conection4.Open();
            string sc_getfilm = "Select f.film_name, f.producer, g.genre_name, f.film_time, f.release_date,f.poster, f.plot  from film f join genre g on g.genre_id = f.genre_id where film_name = '" + filminf + "' ";

            scom4 = new SqlCommand(sc_getfilm, conn);
            using (DbDataReader reader = scom4.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        panel1.Visible      = true;
                        label_namefilm.Text = reader.GetString(0);
                        label_producer.Text = reader.GetString(1);
                        label_genre.Text    = reader.GetString(2);
                        label_time.Text     = reader.GetString(3);
                        label_plot.Text     = reader.GetString(6);
                        SqlConnection conection6 = ClassSQL.GetConect();
                        conection6.Open();
                        string sc_getimg = "Select poster from film where film_name='" + filminf + "'";
                        scom6             = new SqlCommand(sc_getimg, conection6);
                        pathimg           = scom6.ExecuteScalar().ToString();
                        pictureBox1.Image = Image.FromFile(pathimg);
                        pathimg           = scom6.ExecuteScalar().ToString();
                        pictureBox1.Image = Image.FromFile(pathimg);
                    }
                }
            }
        }
Esempio n. 13
0
 public PersFrom(int id_pers, int id_dolj)
 {
     InitializeComponent();
     PokupForm.id_pokupatel = id_like_pers;
     id_p      = id_pers;
     id_d      = id_dolj;
     id_pol    = id_dolj;
     conection = ClassSQL.GetConect();
     conection.Open();
     try
     {
         FillInfo();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Что-то пошло не так((" + ex.Message);
     }
     finally
     {
         conection.Close();
         conection.Dispose();
     }
     if (id_d == 8)
     {
         button7.Visible = true;
         button2.Visible = true;
         button3.Visible = true;
     }
 }
Esempio n. 14
0
        public ViborSeans(int id_g, int id_pol)
        {
            InitializeComponent();

            gorod     = id_g;
            conection = ClassSQL.GetConect();
            conection.Open();
            try
            {
                string sc_getFilm = "select f.Naz_Film from Film f join Seans s on s.ID_Film = f.ID_Film where Data_time_Seans >= getdate()  and ID_Kinoteatr =  " + gorod.ToString() + "";
                sclCom = new SqlCommand(sc_getFilm, conection);
                DataSet        ds  = new DataSet("Naz_films");
                SqlDataAdapter dat = new SqlDataAdapter(sclCom);
                dat.Fill(ds, "Films");
                foreach (DataRow row in ds.Tables["Films"].Rows)
                {
                    listBox1.Items.Add(row["Naz_Film"]);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
            finally
            {
                conection.Close();
                conection.Dispose();
            }
        }
Esempio n. 15
0
 private void button1_Click(object sender, EventArgs e)
 {
     con = ClassSQL.GetConect();
     con.Open();
     Filldgv();
     con.Close();
     con.Dispose();
 }
Esempio n. 16
0
        private void Обновить_Click(object sender, EventArgs e)
        {
            SqlConnection conection = ClassSQL.GetConect();

            conection.Open();
            Filldgv(conection);
            conection.Close();
            conection.Dispose();
        }
Esempio n. 17
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            con = ClassSQL.GetConect();
            string sc_selectID = "select ID_Zal from Zal where Cvet_Zal = '" + comboBox2.SelectedItem.ToString() + "';";

            con.Open();
            scom3 = new SqlCommand(sc_selectID, con);
            Zal   = scom3.ExecuteScalar().ToString();
            con.Close();
            con.Dispose();
        }
Esempio n. 18
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            con = ClassSQL.GetConect();
            string sc_selectID = "select cinema_id from cinema where cinema_name = '" + comboBox1.SelectedItem.ToString() + "';";

            con.Open();
            scom3  = new SqlCommand(sc_selectID, con);
            Cinema = scom3.ExecuteScalar().ToString();
            con.Close();
            con.Dispose();
        }
Esempio n. 19
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            con = ClassSQL.GetConect();
            string sc_selectID = "select ID_Film from  Film where Naz_Film = '" + comboBox3.SelectedItem.ToString() + "';";

            con.Open();
            scom3 = new SqlCommand(sc_selectID, con);
            Film  = scom3.ExecuteScalar().ToString();
            con.Close();
            con.Dispose();
        }
Esempio n. 20
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            SqlConnection conection = ClassSQL.GetConect();

            conection.Open();
            string sc_selectIDSeans = "select ID_Seans from Seans where Data_time_Seans = '" + comboBox2.SelectedItem.ToString() + "';";

            scom  = new SqlCommand(sc_selectIDSeans, conection);
            Seans = scom.ExecuteScalar().ToString();
            conection.Close();
            conection.Dispose();
        }
Esempio n. 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection connect = ClassSQL.GetConect();

            connect.Open();
            if (textBox_Card.Text != "")
            {
                EnterToSystem(connect);
            }
            else
            {
                MessageBox.Show("Данной карты не существует. Попробуйте снова. ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 22
0
        public Oplata(string vib_mesto, int price2, int id_p, int num_ryad)
        {
            InitializeComponent();
            ryad             = num_ryad;
            price            = price2;
            textBox_sum.Text = price.ToString();
            id_pok           = id_p;

            mestechko = vib_mesto;
            if (id_pok == 0) //вывод информации о неизвестном покупателе
            {
                groupBox1.Location    = new System.Drawing.Point(1, 240);
                label_Name.Visible    = false;
                label_Fam.Visible     = false;
                label_Otc.Visible     = false;
                label_numcard.Visible = false;
                label_Bal.Visible     = false;
                label10.Visible       = false;
                label7.Visible        = false;
                label9.Visible        = false;
                label8.Visible        = false;
                label5.Visible        = false;
            }
            else if (id_pok == -1)
            {
                label_Name.Visible    = false;
                label_Fam.Visible     = false;
                label_Otc.Visible     = false;
                label_numcard.Visible = false;
                label_numcard.Text    = "admin";
                label_Bal.Text        = "999999";
            }
            SqlConnection conection = ClassSQL.GetConect();

            conection.Open();
            try
            {
                GetName(conection);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conection.Close();
                conection.Dispose();
            }
        }
Esempio n. 23
0
        private void button2_Click(object sender, EventArgs e)
        {
            con = ClassSQL.GetConect();
            string sc_insert = "insert into film_session(cinema_id,date_session,film_id,hall_id) values ('" + Cinema + "', '" + convDat(maskedTextBox1.Text) + "', '" + Film + "', '" + Zal + "');";

            SqlConnection conection3 = ClassSQL.GetConect();

            con.Open();
            try
            {
                scom3 = new SqlCommand(sc_insert, con);
                scom3.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Данные введены некорректно. " + ex.Message);
            }
            finally
            {
                con.Close();
                con.Dispose();
                MessageBox.Show("Сеанс добавлен в систему. ", "Уведомление", MessageBoxButtons.OK);
                comboBox1.Text      = "";
                comboBox2.Text      = "";
                comboBox3.Text      = "";
                maskedTextBox1.Text = "";
                dataGridView1.Refresh();
                SqlConnection conection2 = ClassSQL.GetConect();
                conection2.Open();
                Filldgv(conection2);
            }

            string convDat(string oldDate)
            {
                MessageBox.Show(oldDate);
                string newdate;
                string data  = oldDate.Split(' ')[0];
                string vreme = oldDate.Split(' ')[1];

                string[] a1 = new string[3];
                a1 = data.Split('-').ToArray();
                string god = a1[2];
                string mes = a1[1];
                string day = a1[0];

                newdate = god + "-" + mes + "-" + day + " " + vreme;
                return(newdate);
            }
        }
Esempio n. 24
0
        private void button2_Click(object sender, EventArgs e)
        {
            //получение значения ИТОГО
            con = ClassSQL.GetConect();
            string sc_selectID = "select sum(price) as 'Выручка за период' from ticket t join film_session s on s.session_id = t.session_id and t.payment = 1 and t.date_ticket <= dateadd(month," + znach + ", getdate()) and t.date_ticket >= dateadd(month, -" + znach + ", getdate());";

            con.Open();
            scom3 = new SqlCommand(sc_selectID, con);
            itogo = scom3.ExecuteScalar().ToString();
            con.Close();
            con.Dispose();



            SFD.Filter = "Файлы Excel (*.xls; *.xlsx) | *.xls; *.xlsx";
            if (SFD.ShowDialog() == DialogResult.OK)
            {
                Microsoft.Office.Interop.Excel._Application app       = new Microsoft.Office.Interop.Excel.Application();
                Microsoft.Office.Interop.Excel._Workbook    workbook  = app.Workbooks.Add(Type.Missing);
                Microsoft.Office.Interop.Excel._Worksheet   worksheet = null;
                app.Visible            = true;
                worksheet              = workbook.ActiveSheet;
                worksheet.Name         = "Выручка";
                worksheet.Cells[1, 1]  = "Фильм";
                worksheet.Cells[1, 2]  = "Количество проданных билетов";
                worksheet.Cells[1, 3]  = "Сумма(в руб.)";
                worksheet.Cells[12, 1] = "Итого:";
                worksheet.Cells[12, 3] = itogo;

                for (int i = 1; i < dataGridView1.Columns.Count + 1; i++)
                {
                    worksheet.Cells[2, i]            = dataGridView1[i - 1, 0].Value;
                    worksheet.Columns[i].ColumnWidth = 30;
                }
                for (int i = 1; i < dataGridView1.RowCount; i++)
                {
                    for (int j = 0; j < dataGridView1.ColumnCount; j++)
                    {
                        worksheet.Cells[i + 2, j + 1] = dataGridView1[j, i].Value;
                    }
                }
                workbook.SaveAs(SFD.FileName, Type.Missing, Type.Missing,
                                Type.Missing, Type.Missing, Type.Missing,
                                Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing,
                                Type.Missing, Type.Missing, Type.Missing);

                app.Quit();
            }
        }
Esempio n. 25
0
        private void button2_Click(object sender, EventArgs e)
        {
            string        cmdText;
            string        cmdText2;
            SqlConnection conection  = ClassSQL.GetConect();
            SqlConnection conectionn = ClassSQL.GetConect();

            conectionn.Open();
            conection.Open();
            cmdText  = "insert into ticket(session_id, place_id, date_ticket, time_ticket, price, payment) values(" + ViborSeans.idha + "," + vib_mesto + ",convert(char(10),getdate(),102),convert(char(10),getdate(),108)," + price2 + ",0);";
            cmdText2 = "update place set free = 1  where place =" + vib_mesto + " and row_place =" + num_ryad + " and session_id = " + ViborSeans.idha + ";";
            try
            {
                sclCom4 = new SqlCommand(cmdText, conection);
                sclCom4.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                try
                {
                    sclCom5 = new SqlCommand(cmdText2, conectionn);
                    sclCom5.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ошибка системы. ", "Ошибка" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    int    t;
                    Random r = new Random();
                    t = (r.Next(10000, 99999));

                    conection.Close();
                    conection.Dispose();
                    conectionn.Close();
                    conectionn.Dispose();
                    MessageBox.Show("Ваше место забронировано.", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show("Ваше забронированое место: " + vib_mesto + "\nСкажите на кассе ваш номер:  " + t, "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Hide();
                }
            }
        }
Esempio n. 26
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlConnection conection5 = ClassSQL.GetConect();

            conection5.Open();

            if (e.RowIndex != -1 && dataGridView1.CurrentCell != null)
            {
                string numFilm = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                filminf = numFilm;
                FullNameFilm(conection5);
            }
            else
            {
                MessageBox.Show("Выберите фильм для просмотра информации о нем.");
            }
        }
Esempio n. 27
0
        public LoorBilet()
        {
            InitializeComponent();
            SqlConnection conection = ClassSQL.GetConect();

            conection.Open();
            try
            {
                LoadBilet(conection);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Что-то пошло не так" + ex.Message);
            }
            conection.Close();
            conection.Dispose();
        }
Esempio n. 28
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conect = ClassSQL.GetConect();

            conect.Open();
            try
            {
                EnterToSystem(conect);
            }
            catch
            {
                MessageBox.Show("Ошибка системы. ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conect.Close();
                conect.Dispose();
            }
        }
Esempio n. 29
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conect = ClassSQL.GetConect();

            conect.Open();
            try
            {
                EnterToSystem(conect);
            }
            catch
            {
                MessageBox.Show("Что-то пошло не так(");
            }
            finally
            {
                conect.Close();
                conect.Dispose();
            }
        }
Esempio n. 30
0
        private void LoadData_prem()
        {
            SqlConnection conection = ClassSQL.GetConect();

            conection.Open();
            string cs_dat_prem = "select f.Data_end_premier from Film f join Seans s on s.ID_Film = f.ID_Film where ID_Seans = " + go + ";";

            sclCom = new SqlCommand(cs_dat_prem, conection);
            string DatePrem = sclCom.ExecuteScalar().ToString();
            string data     = DatePrem.Split(' ')[0];

            string[] a1 = new string[3];
            a1     = data.Split('.').ToArray();
            god_pr = a1[2];
            mes_pr = a1[1];
            day_pr = a1[0];
            conection.Close();
            conection.Dispose();
        }