Ejemplo n.º 1
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            if (textBoxUsername.Text == "")
            {
                userNameRequiredLabel.Show();
            }
            else
            {
                userNameRequiredLabel.Hide();
            }
            if (textBoxPassword.Text == "")
            {
                passwordRequiredLabel.Show();
            }
            else
            {
                passwordRequiredLabel.Hide();
            }
            if (textBoxUsername.Text != "" && textBoxPassword.Text != "")
            {
                String     query   = "SELECT * FROM Users WHERE Name='" + textBoxUsername.Text + "' AND Password='******'";
                SqlCommand command = new SqlCommand(query, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                string        type   = "";
                int           count  = 0;
                while (reader.Read())
                {
                    count++;
                    type = reader["Type"].ToString();
                }
                connection.Close();
                if (count == 1)
                {
                    textBoxUsername.Text = "";
                    textBoxPassword.Text = "";
                    this.Hide();
                    switch (type.ToUpper())
                    {
                    case "MIS MANAGER":
                        MISManagerForm mm = new MISManagerForm();
                        mm.SetDesktopLocation(0, 0);
                        mm.BringToFront();
                        mm.Show();
                        break;

                    case "SALES MANAGER":
                        SalesManagerForm sm = new SalesManagerForm();
                        sm.SetDesktopLocation(0, 0);
                        sm.BringToFront();
                        sm.Show();
                        break;

                    case "ORDER CLERKS":
                        OrderClerksForm oc = new OrderClerksForm();
                        oc.SetDesktopLocation(0, 0);
                        oc.BringToFront();
                        oc.Show();
                        break;

                    case "ACCOUNTANT":
                        AccountantForm a = new AccountantForm();
                        a.SetDesktopLocation(0, 0);
                        a.BringToFront();
                        a.Show();
                        break;

                    case "INVENTORY CONTROLLER":
                        InventoryControllerForm ic = new InventoryControllerForm();
                        ic.SetDesktopLocation(0, 0);
                        ic.BringToFront();
                        ic.Show();
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void AddAmmo(object parameter)
        {
            AccountantForm AForm = new AccountantForm(1);

            AForm.Show();
        }
Ejemplo n.º 3
0
        void AddWeapon(object parameter)
        {
            AccountantForm AForm = new AccountantForm(2);

            AForm.Show();
        }
Ejemplo n.º 4
0
        void AddWorker(object parameter)
        {
            AccountantForm AForm = new AccountantForm(0);

            AForm.Show();
        }