Esempio n. 1
0
 private void InitLoginCmb()
 {
     LocalLoginUserList = LocalLoginManager.GetLocalUsers();
     ImgCmbUserName.Items.Clear();
     foreach (LocalLoginUser pUser in LocalLoginUserList)
     {
         ImageComboItem pItem = new ImageComboItem(pUser.UserName, 0);
         ImgCmbUserName.Items.Add(pItem);
     }
 }
Esempio n. 2
0
        private void LoginRight()
        {
            //Properties.Settings.Default.LastLoginUser = ImgCmbUserName.Text;
            //Properties.Settings.Default.Save();
            LocalLoginUser pUser = new LocalLoginUser();

            pUser.UserName = this.ImgCmbUserName.Text;
            pUser.PassWord = this.txtPassword.Text;
            if (!RememberPwd.Checked)
            {
                pUser.PassWord = string.Empty;
            }
            if (ImgCmbUserName.SelectedIndex == -1)
            {
                LocalLoginManager.AddLocalLoginInfo(pUser);
            }
            else
            {
                LocalLoginManager.SaveLoginInfo(pUser);
            }
            this.DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
        private bool ValidateLogin(string UserName, string Password)
        {
            string UserID = string.Empty;

            if (LocalLoginManager.ValidateLogin(UserName, Password, ref UserID))
            {
                // SystemInfo.UserID = UserID;
                User pUser = User.GetUserByID(UserID);
                SystemInfo.UserName = pUser.UserName;
                SystemInfo.UserID   = UserID;
                //pUser.GetRoleName();
                //if (!pUser.GetRoleName().Equals("管理员用户"))
                //{
                //    return false;
                //}
                this.LoginRight();
                return(true);
            }
            else
            {
                this.LoginError();
                return(false);
            }
        }