Beispiel #1
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            long role        = (comboBoxRole.SelectedItem as ComboBoxItem).ID;
            bool loginSet    = false;
            bool passwordSet = false;

            if (!string.IsNullOrEmpty(textBoxLogin.Text))
            {
                loginSet = true;
            }
            if (!string.IsNullOrEmpty(textBoxPassword.Text))
            {
                passwordSet = true;
            }
            if (loginSet && passwordSet)
            {
                string login    = textBoxLogin.Text;
                string password = textBoxPassword.Text;
                LoginCore.LogIn(role, login, password);
                if (CoreBase.isAuthorised)
                {
                    this.Visible = false;
                    Form form;
                    switch (role)
                    {
                    case 1:
                        form = new Forms.AdminForm();
                        form.Show();
                        break;

                    case 2:
                        form = new Forms.CashierForm();
                        form.ShowDialog();
                        break;

                    case 3:
                        form = new Forms.KitchenForm();
                        form.Show();
                        break;

                    default:
                        ErrorsViewWrapper.ShowError(ErrorTexts.UNEXPEXTED_ERROR);
                        Application.Exit();
                        break;
                    }
                }
            }
            else if (!loginSet && !passwordSet)
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_LOGIN_AND_PASSWORD);
            }
            else if (loginSet && !passwordSet)
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_PASSWORD);
            }
            else
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_LOGIN);
            }
        }
Beispiel #2
0
 public CashierForm()
 {
     InitializeComponent();
     instance = this;
 }