Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string         name = textName.Text;
            string         pwd  = textPwd.Text;
            int            type;
            ManagerInfoBll bll   = new ManagerInfoBll();
            LoginState     login = bll.Login(name, pwd, out type);

            switch (login)
            {
            case LoginState.Ok:
                FormMain main = new FormMain();
                main.Tag = type;
                //将登录窗体隐藏
                this.Hide();
                main.Show();
                break;

            case LoginState.NameError:
                MessageBox.Show("名字错误");
                break;

            case LoginState.PwdError:
                MessageBox.Show("密码错误");
                break;
            }
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //获取用户输入的信息
            string name = txtName.Text;
            string pwd  = txtPwd.Text;
            //调用代码
            int            type;
            ManagerInfoBll miBll      = new ManagerInfoBll();
            LoginState     loginState = miBll.Login(name, pwd, out type);

            switch (loginState)
            {
            case LoginState.Ok:
                FormMain main = new FormMain();
                main.Tag = type;    //将员工级别传递过去
                main.Show();
                //将登录窗体隐藏
                this.Hide();
                break;

            case LoginState.NameError:
                MessageBox.Show("用户名错误");
                break;

            case LoginState.PwdError:
                MessageBox.Show("密码错误");
                break;
            }
        }
Esempio n. 3
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            string name = textUsername.Text;
            string pwd  = textPassword.Text;

            int            type;
            ManagerInfoBll miBll      = new ManagerInfoBll();
            LoginState     loginState = miBll.Login(name, pwd, out type);

            switch (loginState)
            {
            case LoginState.Ok:
                FormMain main = new FormMain();
                main.Tag = type;
                main.Show();
                main.Focus();
                this.Hide();
                break;

            case LoginState.NameError:
                MessageBox.Show("User name error");
                break;

            case LoginState.PwdError:
                MessageBox.Show("Password error");
                break;
            }
        }
Esempio n. 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string name = tbUserName.Text;
            string pwd  = tbPwd.Text;

            if (tbPwd.Text == "" || tbUserName.Text == "")  //判断文本框是否为空
            {
                MessageBox.Show("用户名和密码不能为空!", "提示");
                return;
            }
            switch (miBll.Login(name, pwd, out type)) //调用业务逻辑层登录判断方法
            {
            case StudyModel.LoginStatus.OK:           //登录成功
                isPass = true;                        //登录标记改变
                this.Close();                         //关闭登录界面
                //FrmMain frmMain = new FrmMain();
                //frmMain.Tag = type;
                //frmMain.Show();
                //this.Hide();
                break;

            case StudyModel.LoginStatus.UserNameError:      //用户名错误
                MessageBox.Show("用户名错误!", "提示");
                break;

            case StudyModel.LoginStatus.PwdError:           //密码错误
                MessageBox.Show("密码错误!", "提示");
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string         name  = txtName.Text;
            string         pwd   = txtPwd.Text;
            ManagerInfoBll miBll = new ManagerInfoBll();
            int            type;
            LoginState     state = miBll.Login(name, pwd, out type);

            switch (state)
            {
            case LoginState.Ok:
                MainFrm mainFrm = new MainFrm();
                mainFrm.Tag = type;
                mainFrm.Show();
                this.Visible = false;
                break;

            case LoginState.NameError:
                MessageBox.Show("用户名错误");
                break;

            case LoginState.PwdError:
                MessageBox.Show("密码错误");
                break;

            default:
                break;
            }
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string     name = txtName.Text;
            string     pwd  = txtPwd.Text;
            int        type;
            LoginState state = mb.Login(name, pwd, out type);

            switch (state)
            {
            case LoginState.Ok: MessageBox.Show("登陆成功!");
                FormMain main = new FormMain();
                main.Tag = type;
                main.Show();
                this.Hide();
                break;

            case LoginState.PwdERROR: MessageBox.Show("密码错误!");
                txtPwd.Text = "";
                txtPwd.Focus();
                break;

            case LoginState.NameERROR: MessageBox.Show("用户名错误!");
                txtName.Text = "";
                txtPwd.Text  = "";
                txtName.Focus();
                break;
            }
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            ManagerInfo mi = new ManagerInfo();

            mi.MName = textBox1.Text;
            mi.MPwd  = textBox2.Text;
            ManagerInfoBll miBll = new ManagerInfoBll();

            if (miBll.Login(mi))
            {
                MainForm mainForm = new MainForm();
                mainForm.Tag = mi.MType;
                mainForm.Show();
                this.Visible = false;
            }
            else
            {
                MessageBox.Show("用户名或密码错误!!!");
            }
        }
Esempio n. 8
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var mi = new ManagerInfo();

            mi.MName = txtName.Text;
            mi.MPwd  = txtPwd.Text;

            var miBll = new ManagerInfoBll();

            if (miBll.Login(mi))
            {
                var mainForm = new MainForm();
                mainForm.Tag = mi.MType.ToString();
                mainForm.Show();
                Visible = false;
            }
            else
            {
                MessageBox.Show("用户名或者密码错误");
            }
        }
Esempio n. 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            ManagerInfoBll bll = new ManagerInfoBll();
            int            type;
            ManagerStute   stute = bll.Login(textBox1.Text, textBox2.Text, out type);

            switch (stute)
            {
            case ManagerStute.OK:
                FormMain main = new FormMain();
                main.Tag = type;
                main.Show();
                this.Hide();
                break;

            case ManagerStute.NAMEERROR:
                MessageBox.Show("用户名错误");
                break;

            case ManagerStute.PWDERROR:
                MessageBox.Show("密码错误");
                break;
            }
        }