Exemplo n.º 1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SqlConnection = new OleDbConnection(connectString);
            await SqlConnection.OpenAsync();

            OleDbDataReader sqlReader = null;

            OleDbCommand command1 = new OleDbCommand("SELECT * FROM [Пользователи]", SqlConnection);

            sqlReader = command1.ExecuteReader();

            while (sqlReader.Read())
            {
                if (textBox.Text == Convert.ToString(sqlReader["Логин"]))
                {
                    if (passwordBox.Password.ToString() == Convert.ToString(sqlReader["Пароль"]))
                    {
                        FirstPage o = new FirstPage();
                        o.Name = textBox.Text;
                        o.Show();
                        this.Hide();
                        return;
                    }
                }
            }

            textBox.Background = Brushes.Red;
            textBox.Opacity    = 0.4;

            passwordBox.Background = Brushes.Red;
            passwordBox.Opacity    = 0.4;
        }
Exemplo n.º 2
0
        private void Button_Copy16_Click(object sender, RoutedEventArgs e)
        {
            FirstPage o = new FirstPage();

            o.Show();
            this.Hide();
        }
Exemplo n.º 3
0
        private void Button_Copy_Click(object sender, RoutedEventArgs e)
        {
            FirstPage a = new FirstPage();

            a.Name = this.Name;
            a.Show();
            this.Close();
        }
Exemplo n.º 4
0
 private void Button_Copy16_Click_1(object sender, RoutedEventArgs e)
 {
     if (Convert.ToString(this.Tag) == "1")
     {
         FirstPage o = new FirstPage();
         o.Show();
         this.Hide();
     }
     else
     {
         TablePageClient o = new TablePageClient();
         o.Show();
         this.Hide();
     }
 }
Exemplo n.º 5
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SqlConnection = new OleDbConnection(connectString);
            await SqlConnection.OpenAsync();

            OleDbDataReader sqlReader = null;

            OleDbCommand command1 = new OleDbCommand("UPDATE [Пользователи] SET [Логин]=@LN, [Пароль]=@FN, ФИО=@Fam WHERE [Логин]=@1", SqlConnection);

            command1.Parameters.AddWithValue("LN", textBox.Text);
            command1.Parameters.AddWithValue("FN", passwordBox.Password.ToString());
            command1.Parameters.AddWithValue("Fam", textBox_Copy.Text);

            command1.Parameters.AddWithValue("1", this.Name);


            if (textBox.Text != "")
            {
                if (passwordBox.Password.ToString() != "")
                {
                    if (textBox_Copy.Text != "")
                    {
                        await command1.ExecuteNonQueryAsync();

                        MessageBox.Show("Данные пользователя успешно изменены");
                        FirstPage o = new FirstPage();
                        o.Name = this.Name;
                        o.Show();
                        this.Hide();
                        return;
                    }
                }
            }

            textBox_Copy.Background = Brushes.Red;
            textBox_Copy.Opacity    = 0.4;

            textBox.Background = Brushes.Red;
            textBox.Opacity    = 0.4;

            passwordBox.Background = Brushes.Red;
            passwordBox.Opacity    = 0.4;
        }