Exemplo n.º 1
0
        public ManagerStute Login(string name, string pwd, out int type)
        {
            type = 0;
            ManagerStute stute = new ManagerStute();
            ManagerInfo  mi    = dal.Login(name);

            if (mi != null)
            {
                if (mi.MPwd.Equals(MD5Helper.EncryptString(pwd)))
                {
                    stute = ManagerStute.OK;
                    type  = mi.MType;
                }
                else
                {
                    stute = ManagerStute.PWDERROR;
                }
            }
            else
            {
                stute = ManagerStute.NAMEERROR;
            }
            return(stute);
        }
Exemplo n.º 2
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;
            }
        }