Beispiel #1
0
 public Form1()
 {
     InitializeComponent();
     Txt_Name.Clear();
     Txt_Psw.Clear();
     //skinEngine1.SkinFile = System.Environment.CurrentDirectory + "\\Skins\\MidsummerColor1.ssk";  //皮肤文件以 .ssk结尾
 }
Beispiel #2
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_login_Click(object sender, EventArgs e)
        {
            string Name = Txt_Name.Text.Trim();
            string Psw  = Txt_Psw.Text.Trim();

            if (string.IsNullOrEmpty(Name))
            {
                MsgBoxHelper.MsgErrorShow("账号为空");
                Txt_Name.Focus();
                return;
            }
            if (string.IsNullOrEmpty(Psw))
            {
                MsgBoxHelper.MsgErrorShow("密码为空");
                Txt_Psw.Focus();
                return;
            }
            string enPSW = MD5Encrypt.Encrypt(Psw);

            try
            {
                LoginBLL login = new LoginBLL();
                List <View_StndentRole> StuList = login.Login(Name, enPSW);
                if (StuList == null || StuList.Count == 0)
                {
                    MsgBoxHelper.MsgErrorShow("账号或密码错误");
                    return;
                }
                else
                {
                    MainIndex index = new MainIndex();
                    index.Tag = new LoginModel()
                    {
                        StuList    = StuList,
                        LoginForm1 = this
                    };
                    index.Show();
                    this.Hide();
                }
            }
            catch (Exception exception)
            {
                MsgBoxHelper.MsgErrorShow("登录出现错误");
            }
        }