Exemplo n.º 1
0
Arquivo: Login.cs Projeto: cobelee/mrs
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string UserType = BLL.UserType.Accountant.ToString();

            switch (cbUserType.SelectedIndex)
            {
            case 0: UserType = BLL.UserType.Accountant.ToString();
                break;

            case 1: UserType = BLL.UserType.Cashier.ToString();
                break;

            case 2: UserType = BLL.UserType.Administrator.ToString();
                break;
            }
            if (Authentication.Authenticate(tbUserName.Text, tbPassword.Text, UserType))
            {
                MRS.Model.Account account = new MRS.Model.Account();
                account = bllAccount.GetAccountByUserName(tbUserName.Text);
                switch (UserType)
                {
                case "Accountant":
                    //mrModule.Show();
                    //mrModule.ShowAccountant(account.TrueName);
                    mrBxMain.Show();
                    mrBxMain.WindowState = FormWindowState.Maximized;
                    mrBxMain.ShowAccountant(account.TrueName);
                    break;

                case "Cashier": cuMain.Show();
                    cuMain.ShowCashier(account.TrueName);
                    break;

                case "Administrator": settingMain.Show();
                    break;
                }

                this.Visible = false;
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
            }
        }