Пример #1
0
        private void BTNListCallsF_Click(object sender, EventArgs e)
        {
            ListCallsF lcf = new ListCallsF();

            this.Hide();
            lcf.Show();
        }
Пример #2
0
        private void BTNLogin_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source=DESKTOP-8R0I2UI;Initial Catalog=B-7;Integrated Security=True");

            conn.Open();
            SqlCommand sqlQuery = new SqlCommand("SELECT * FROM [dbo].[Users]" +
                                                 "WHERE Login = '******' AND " +
                                                 "Password = '******'", conn);
            SqlDataReader sqlReader = null;

            sqlReader = sqlQuery.ExecuteReader();
            if (sqlReader.HasRows)
            {
                sqlReader.Read();

                if ((sqlReader.GetValue(0).ToString() == TBLogin.Text) &&
                    (sqlReader.GetValue(1).ToString() == TBPassword.Text))
                {
                    if (sqlReader.GetValue(0).ToString() == "abdulina")
                    {
                        ListCallsF LCF = new ListCallsF();
                        MessageBox.Show("Добро пожаловать! " + TBLogin.Text);
                        this.Hide();
                        LCF.Show();
                    }
                    if (sqlReader.GetValue(0).ToString() == "bogdanova")
                    {
                        ListCallsF LCF = new ListCallsF();
                        MessageBox.Show("Добро пожаловать! " + TBLogin.Text);
                        this.Hide();
                        LCF.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("Для входа в систему введите Логин и Пароль");
            }
        }