Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string        loginCheck    = textBox_Login.Text;
            string        password      = textBox_Passord.Text;
            string        passwordCheck = Hash(textBox_Passord.Text);//Шифрование пароля
            string        checkCmd      = $"Select Login_, Pasword_ from Autoriz where Login_ ='{loginCheck}' and Pasword_ ='{passwordCheck}'";
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();
            SqlCommand    sqlCommand    = new SqlCommand(checkCmd, sqlConnection);

            using (sqlConnection)
            {
                try
                {
                    sqlConnection.Open();

                    sqlCommand.Prepare();
                    sqlCommand.ExecuteNonQuery();
                    if (loginCheck == (string)sqlCommand.ExecuteScalar())
                    {
                        this.Hide();
                        Form_Menu menu_Form = new Form_Menu();
                        menu_Form.Show();
                    }
                    else
                    {
                        MessageBox.Show("Логин или пароль ведены не верно", "Ошибка");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Ejemplo n.º 2
0
        private void button_Reg_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnect = Class_Connection_DB.DatabaseSQL();

            using (sqlConnect)
            {
                try
                {
                    string passwordCheck = GetHash(textBox_Password.Text);
                    sqlConnect.Open();
                    SqlCommand sqlCommand = new SqlCommand("Autoriz_Insert", sqlConnect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    sqlCommand.Parameters.AddWithValue("@Login_", textBox_Login.Text);
                    sqlCommand.Parameters.AddWithValue("@Pasword_", passwordCheck);
                    sqlCommand.ExecuteNonQuery();
                    MessageBox.Show("Регистрация прошла успешно.", "Уведомление");
                    Form_Autorization form = new Form_Autorization();
                    form.Show();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Какие либо данные введены не корректно." + ex, "Ошибка");
                }
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnect = Class_Connection_DB.DatabaseSQL();

            using (sqlConnect)
            {
                try
                {
                    sqlConnect.Open();
                    SqlCommand sqlCommand = new SqlCommand("Sotrud_Update_Dolj", sqlConnect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    sqlCommand.Parameters.AddWithValue("@Id", comboBox_Sot.SelectedValue);
                    sqlCommand.Parameters.AddWithValue("@Dolj_S", comboBox_Dolj.SelectedValue);
                    sqlCommand.ExecuteNonQuery();
                    MessageBox.Show("Должность сотрудника обновлена", "Уведомление");
                    this.Hide();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Какие либо данные введены не корректно." + ex, "Ошибка");
                }
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            SqlConnection sqlConnect = Class_Connection_DB.DatabaseSQL();

            using (sqlConnect)
            {
                try
                {
                    sqlConnect.Open();
                    SqlCommand sqlCommand = new SqlCommand("Sotrud_Insert", sqlConnect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    sqlCommand.Parameters.AddWithValue("@F_K", textBox_F.Text);
                    sqlCommand.Parameters.AddWithValue("@I_K", textBox_I.Text);
                    sqlCommand.Parameters.AddWithValue("@O_K", textBox_O.Text);
                    sqlCommand.Parameters.AddWithValue("@Phone_Number", maskedTextBox_Phone.Text);
                    sqlCommand.Parameters.AddWithValue("@Date_Of_Bithd", maskedTextBox_Date.Text);
                    sqlCommand.Parameters.AddWithValue("@Dolj_S", comboBox_Dolj.SelectedValue);
                    sqlCommand.Parameters.AddWithValue("@Autorir_S", comboBox_Akk.SelectedValue);
                    sqlCommand.ExecuteNonQuery();
                    MessageBox.Show("Сотрудник принят на работу", "Уведомление");
                    this.Hide();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Какие либо данные введены не корректно." + ex, "Ошибка");
                }
            }
        }
Ejemplo n.º 5
0
        public void Update()
        {
            SqlConnection  sqlConnect  = Class_Connection_DB.DatabaseSQL();
            SqlDataAdapter dataadapter = new SqlDataAdapter(connection_DB.qw_View_Sotrud, sqlConnect);
            DataSet        ds          = new DataSet();

            sqlConnect.Open();
            dataadapter.Fill(ds, connection_DB.qw_View_Sotrud_Nazv);
            sqlConnect.Close();
            dataGridView1.DataSource = ds;
            dataGridView1.DataMember = connection_DB.qw_View_Sotrud_Nazv;
        }
Ejemplo n.º 6
0
        private void button4_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();

            using (sqlConnection)
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("klient_Delete", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlCommand.Parameters.AddWithValue("@Id", Convert.ToInt32(idS));
                sqlCommand.ExecuteNonQuery();
                Update();
                MessageBox.Show("Клиент был удален");
            }
        }
Ejemplo n.º 7
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         SqlConnection  sqlConnect  = Class_Connection_DB.DatabaseSQL();
         SqlDataAdapter dataadapter = new SqlDataAdapter(@"SELECT dbo.Sotrud.Id_Sotrud AS Ключ, dbo.Sotrud.F_S AS Фамилия, dbo.Sotrud.I_S AS Имя, dbo.Sotrud.O_S AS Отчество, dbo.Sotrud.Phone_Number AS [Номер телефона], dbo.Sotrud.Date_Of_Bithd AS [Дата рождения], dbo.Dolj.Nazv_Dolj AS Должность, dbo.Dolj.Oklad AS Оклад, dbo.Autoriz.Login_ AS Аккаунт FROM dbo.Sotrud INNER JOIN dbo.Autoriz ON dbo.Sotrud.Autorir_S = dbo.Autoriz.Id_Auto INNER JOIN dbo.Dolj ON dbo.Sotrud.Dolj_S = dbo.Dolj.Id_Dolj where dbo.Dolj.Nazv_Dolj like '%" + textBox4.Text + "%'", sqlConnect);
         DataSet        ds          = new DataSet();
         sqlConnect.Open();
         dataadapter.Fill(ds, connection_DB.qw_View_Sotrud_Nazv);
         sqlConnect.Close();
         dataGridView1.DataSource = ds;
         dataGridView1.DataMember = connection_DB.qw_View_Sotrud_Nazv;
     }
     else
     {
         MessageBox.Show("Заполните поля фильтрации");
     }
 }
Ejemplo n.º 8
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();

            using (sqlConnection)
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("Dolj_Insert", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlCommand.Parameters.AddWithValue("@Nazv_Dolj", textBox_Nazv.Text);
                sqlCommand.Parameters.AddWithValue("@Oklad", textBox_Oklad.Text);
                sqlCommand.ExecuteNonQuery();
                Update();
                MessageBox.Show("Должность была добавлена");
            }
        }
Ejemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();

            using (sqlConnection)
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("Pokupka_Bileta_Insert", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlCommand.Parameters.AddWithValue("@Afisha_Id", comboBox_Film.SelectedValue);
                sqlCommand.Parameters.AddWithValue("@klient_Id", comboBox_Klient.SelectedValue);
                sqlCommand.Parameters.AddWithValue("@Sotrud_Id", comboBox_Sotrud.SelectedValue);
                sqlCommand.ExecuteNonQuery();
                Update();
                MessageBox.Show("Билет успешно оформлен");
            }
        }
Ejemplo n.º 10
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();

            using (sqlConnection)
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("klient_Insert", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlCommand.Parameters.AddWithValue("@F_K", textBox_F.Text);
                sqlCommand.Parameters.AddWithValue("@I_K", textBox_I.Text);
                sqlCommand.Parameters.AddWithValue("@O_K", textBox_O.Text);
                sqlCommand.Parameters.AddWithValue("@Phone_Number", maskedTextBox_Phone.Text);
                sqlCommand.ExecuteNonQuery();
                Update();
                MessageBox.Show("Клиент был доабвен");
            }
        }
Ejemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();

            using (sqlConnection)
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("Afisha_Insert", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlCommand.Parameters.AddWithValue("@Nazv", textBox_Nazv.Text);
                sqlCommand.Parameters.AddWithValue("@Dlitelnost", maskedTextBox_D.Text);
                sqlCommand.Parameters.AddWithValue("@Ganr_Id", comboBox_G.SelectedValue);
                sqlCommand.Parameters.AddWithValue("@Chena", Convert.ToInt32(textBox_Chena.Text));
                sqlCommand.ExecuteNonQuery();
                Update();
                MessageBox.Show("Новый фильм был добавлен");
                this.Hide();
            }
        }
Ejemplo n.º 12
0
        private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = Class_Connection_DB.DatabaseSQL();

            using (sqlConnection)
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("klient_Update", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlCommand.Parameters.AddWithValue("@Id", Convert.ToInt32(idS));
                sqlCommand.Parameters.AddWithValue("@F_K", textBox_F.Text);
                sqlCommand.Parameters.AddWithValue("@I_K", textBox_I.Text);
                sqlCommand.Parameters.AddWithValue("@O_K", textBox_O.Text);
                sqlCommand.Parameters.AddWithValue("@Phone_Number", maskedTextBox_Phone.Text);
                sqlCommand.ExecuteNonQuery();
                Update();
                MessageBox.Show("Даныне клиента обновлены");
            }
        }
Ejemplo n.º 13
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnect = Class_Connection_DB.DatabaseSQL();

            using (sqlConnect)
            {
                try
                {
                    sqlConnect.Open();
                    SqlCommand sqlCommand = new SqlCommand("Afisha_Delete", sqlConnect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    sqlCommand.Parameters.AddWithValue("@Id", comboBox_Film.SelectedValue);
                    sqlCommand.ExecuteNonQuery();
                    MessageBox.Show("Фильм успешно удален", "Уведомление");
                    this.Hide();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Какие либо данные введены не корректно." + ex, "Ошибка");
                }
            }
        }