Beispiel #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormUser frmUser = new FormUser();

            frmUser.Show();
        }
Beispiel #2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormUser frmUser = new FormUser();

            frmUser.Show();
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            SqlConnection sqlConnect = new SqlConnection("Data Source=172.16.0.211\\SQLEXPRESS;" +
                                                         "Initial Catalog=user33;Persist Security " +
                                                         "Info=True;User ID=user33;Password=wsruser33");

            sqlConnect.Open();
            SqlCommand sqlQuery = new SqlCommand("SELECT * FROM [dbo].[Autosalon] Where Login='******'  AND  Password='******'", sqlConnect);

            SqlDataReader sqlQueryReader = null;

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

                if ((sqlQueryReader.GetValue(0).ToString() == TBLogin.Text) &&
                    (sqlQueryReader.GetValue(1).ToString() == TBPassword.Text))
                {
                    if (sqlQueryReader.GetValue(2).ToString() == "Manager")
                    {
                        MessageBox.Show("Вы авторизовались за Менеджера");
                    }
                    else if (sqlQueryReader.GetValue(2).ToString() == "Client")
                    {
                        FormUser formU = new FormUser();
                        formU.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("Неправильная связка");
            }
        }