Пример #1
0
        private void openForm(int i)
        {
            switch (i)
            {
            case 1:
                FormCostumers fc = new FormCostumers();
                this.Visible = false;
                fc.ShowDialog();
                if (fc.DialogResult == DialogResult.OK)
                {
                    this.Visible = true;
                }
                break;

            case 2:
                FormProducts fp = new FormProducts();
                this.Visible = false;
                fp.ShowDialog();
                if (fp.DialogResult == DialogResult.OK)
                {
                    this.Visible = true;
                }
                break;

            case 3:
                FormSales fs = new FormSales();
                this.Visible = false;
                fs.ShowDialog();
                if (fs.DialogResult == DialogResult.OK)
                {
                    this.Visible = true;
                }
                break;
            }
        }
        private void buttonAllsales_Click(object sender, EventArgs e)
        {
            FormSales fs = new FormSales("admin");

            fs.Show();
            Close();
        }
Пример #3
0
        private void buttonAllSales_Click(object sender, EventArgs e)
        {
            FormSales fs = new FormSales("secretary");

            fs.Show();
            Close();
        }
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            string typedLogin    = "";
            string typedPassword = "";

            if (textBoxLogin.Text == "" || textBoxPassword.Text == "")
            {
                MessageBox.Show("Заповніть всі поля");
                return;
            }
            else
            {
                typedLogin    = textBoxLogin.Text;
                typedPassword = textBoxPassword.Text;

                bool logedIn = false;
                foreach (var user in carshop_db.Instance.Users)
                {
                    if (typedLogin.Equals(user.name) && typedPassword.Equals(user.password))
                    {
                        if (user.userType == "admin")
                        {
                            Form admf = new FormAdmin();
                            admf.Show();
                            Hide();
                        }
                        if (user.userType == "secretary")
                        {
                            Form admf = new FormSecretary();
                            admf.Show();
                            Hide();
                        }
                        if (user.userType == "seller")
                        {
                            FormSales fs = new FormSales("seller");
                            fs.Show();
                            Hide();
                        }

                        logedIn = true;
                        break;
                    }
                }

                if (!logedIn)
                {
                    MessageBox.Show("Ім'я або пароль введені неправлиьно");
                }
            }
        }