Esempio n. 1
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            try
            {
                // sql запрос добавления заказа в базу
                command.Connection = connection;
                connection.Open();
                command.CommandText = "SELECT * FROM Sign WHERE [login] = '" + textBox1.Text + "'";
                command.ExecuteNonQuery();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    string password = (string)reader["password"];
                    string status   = (string)reader["status"];
                    status = status.Replace(" ", string.Empty);

                    password = password.Replace(" ", string.Empty);
                    if (textBox2.Text.ToString() == password)
                    {
                        switch (status)
                        {
                        case "Администратор":
                            formMain.buttonOrders.Enabled    = true;
                            formMain.buttonPersonal.Enabled  = true;
                            formMain.buttonInventory.Enabled = true;
                            formMain.buttonEnter.Visible     = true;
                            formMain.buttonKassa.Enabled     = true;
                            break;

                        case "Касса":
                            formMain.buttonKassa.Enabled = true;
                            break;

                        case "Персонал":
                            formMain.buttonPersonal.Enabled = true;
                            break;

                        case "Склад":
                            formMain.buttonInventory.Enabled = true;
                            break;

                        case "Заказы":
                            formMain.buttonOrders.Enabled = true;
                            break;

                        default:
                            break;
                        }

                        information(textBox1.Text, status);
                        formMain.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("НЕ правильный пароль");
                    }
                }


                reader.Close();
                connection.Close();
            }
            catch
            {
                MessageBox.Show("Не правильно введен логин или пароль!");
            }
        }
Esempio n. 2
0
 private void FormPersonal_FormClosed(object sender, FormClosedEventArgs e)
 {
     formMain.Show();
 }
Esempio n. 3
0
 private void FormInventory_FormClosed(object sender, FormClosedEventArgs e)
 {
     formMain.Show();
 }