예제 #1
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            string loginName     = txt_loginName.Text.Trim();
            string loginPassword = txt_loginPassword.Text.Trim();

            if (!string.IsNullOrEmpty(loginName) && !string.IsNullOrEmpty(loginPassword))
            {
                UserLogin userLogin = new UserLogin();
                bool      result    = userLogin.IsExist(new User(loginName, loginPassword));
                if (result)
                {
                    OperateIniFile.GetInstance().WriteIniData("LoginLocal", "UserName", loginName);
                    OperateIniFile.GetInstance().WriteIniData("LoginLocal", "PassWord", loginPassword);
                    User user = userLogin.GetUser(loginName, loginPassword);
                    UserHelper.SetUser(user);
                    UserHelper.SetLogin(true);
                    Hide();
                    Frm_FirstPage frm = GetFormHelper.GetFirstPage(this, true);
                    frm.Show();
                    frm.Activate();
                }
                else
                {
                    XtraMessageBox.Show("用户名或密码错误。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                XtraMessageBox.Show("用户名和密码不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 public static Frm_FirstPage GetFirstPage(Form form, bool isNew)
 {
     if (isNew || firstPage == null || firstPage.IsDisposed)
     {
         firstPage = new Frm_FirstPage(form);
     }
     return(firstPage);
 }
예제 #3
0
 public static Frm_QueryBorrowing GetQueryBorrow(Frm_FirstPage form)
 {
     if (borrowing == null || borrowing.IsDisposed)
     {
         if (form == null)
         {
             borrowing = new Frm_QueryBorrowing();
         }
         else
         {
             borrowing = new Frm_QueryBorrowing(form);
         }
     }
     return(borrowing);
 }