Exemplo n.º 1
0
        private void Out_button_Click(object sender, EventArgs e)
        {
            this.Hide();
            KladovshicForm bF = new KladovshicForm();

            bF.Show();
        }
Exemplo n.º 2
0
        private void LoginOut_button_Click(object sender, EventArgs e)
        {
            this.Hide(); //cкрывает текущее окно
            KladovshicForm regForm = new KladovshicForm();

            regForm.Show();
        }
Exemplo n.º 3
0
 private void Back_button_Click(object sender, EventArgs e)
 {
     if (AvtorisForm.name == "Kladovshic")
     {
         this.Hide();//скрывает окно
         KladovshicForm usForm = new KladovshicForm();
         usForm.Show();
     }
     if (AvtorisForm.name == "Direcktor")
     {
         this.Hide();
         DirektorForm usForm = new DirektorForm();
         usForm.Show();
     }
     if (AvtorisForm.name == "Menedger")
     {
         this.Hide();
         MenedgerForm usForm = new MenedgerForm();
         usForm.Show();
     }
     if (AvtorisForm.name == "user")
     {
         this.Hide();
         ZakazchicForm usForm = new ZakazchicForm();
         usForm.Show();
     }
 }
Exemplo n.º 4
0
        private void buttonEnter_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnect = new SqlConnection("Data Source=LAPTOP-562FH47J\\SQL2017;Initial Catalog=Fabrica;Integrated Security=True"); //Подключение к серверу БД

            sqlConnect.Open();
            SqlCommand sqlQuery = new SqlCommand("SELECT * FROM [dbo].[Polsovatel]" +
                                                 "WHERE Login = '******' AND " +
                                                 "Password = '******'", sqlConnect); // запрос в таблицу "Polsovatel"
            SqlDataReader sqlReader = null;

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

                if ((sqlReader.GetValue(0).ToString() == textLogin.Text) &&
                    (sqlReader.GetValue(1).ToString() == textPassword.Text))
                {
                    if (sqlReader.GetValue(2).ToString() == "Kladovshic")
                    {
                        name = "Kladovshic";
                        this.Hide();//скрывает окно
                        KladovshicForm usForm = new KladovshicForm();
                        usForm.Show();
                    }
                    if (sqlReader.GetValue(2).ToString() == "Direcktor")
                    {
                        name = "Direcktor";
                        this.Hide();
                        DirektorForm usForm = new DirektorForm();
                        usForm.Show();
                    }
                    if (sqlReader.GetValue(2).ToString() == "Menedger")
                    {
                        name = "Menedger";
                        this.Hide();
                        MenedgerForm usForm = new MenedgerForm();
                        usForm.Show();
                    }
                    if (sqlReader.GetValue(2).ToString() == "user")
                    {
                        name = "user";
                        this.Hide();
                        ZakazchicForm usForm = new ZakazchicForm();
                        usForm.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("Такого пользователя не существует. Пересоздайте или введи заново.");
            }
        }