Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(Properties.Settings.Default.dbConnectionSettings);

            connection.Open();
            String login = textBox1.Text;
            String pass  = textBox2.Text;

            SqlCommand    command = new SqlCommand("SELECT * FROM users WHERE login = '******' AND password = '******'", connection);
            SqlDataReader reader  = command.ExecuteReader();

            String role = "", name = "";

            while (reader.Read())
            {
                role = reader[2].ToString();
                name = reader[3].ToString();
            }

            Form form = null;

            switch (role)
            {
            case "User":
                form = new UserForm();
                this.Hide();
                form.Show();

                break;

            case "Director":
                form = new AdminForm();
                this.Hide();
                form.Show();

                break;

            case "Ware":
                form = new WareForm();
                this.Hide();
                form.Show();

                break;

            case "Manager":
                form = new ManagerForm();
                this.Hide();
                form.Show();

                break;

            default:
                MessageBox.Show("Роль не установлена или пользователь не найден!");
                break;
            }
        }
Ejemplo n.º 2
0
        public EmployeeAddEdit(Employee selectedEmployee, ManagerForm form)
        {
            inputHandler = new FormInputHandler();
            parent       = form;

            InitializeComponent();
            if (selectedEmployee == null)
            {
                return;
            }
            AddUserButton.Text = "Edit";
            employee           = selectedEmployee;
            FillTextBoxes();
        }
Ejemplo n.º 3
0
 public AddCustomerForm(ManagerForm frm)
 {
     parent = frm;
     InitializeComponent();
 }