Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string szUserID = this.textBox1.Text.Trim().ToUpper();
            if (string.IsNullOrEmpty(szUserID))
            {
                MessageBox.Show("请输入您的用户ID!");
                this.textBox1.Focus();
                this.textBox1.SelectAll();
                return;
            }
            short shRet = ReturnValue.OK;

            //获取用户信息
            this.loginUser = null;
            shRet = DataService.Instance.GetUserInfo(szUserID, ref this.loginUser);
            if (shRet == ReturnValue.FAILED)
            {
                MessageBox.Show("您没有权限登录护理电子病历系统!");
                this.textBox1.Focus();
                this.textBox1.SelectAll();
                return;
            }
            if (this.loginUser == null || shRet != ReturnValue.OK)
            {
                MessageBox.Show("登录失败,系统获无法取用户信息!");
                this.textBox1.Focus();
                this.textBox1.SelectAll();
                return;
            }

            //验证用户输入的密码
            shRet = DataService.Instance.IsUserValid(szUserID, this.textBox2.Text);
            if (shRet == ReturnValue.FAILED)
            {
                MessageBox.Show("您输入的登录口令错误!");
                this.textBox2.Focus();
                this.textBox2.SelectAll();
                return;
            }
            if (shRet != ReturnValue.OK)
            {
                MessageBox.Show("登录失败,系统无法验证用户信息!");
                this.textBox2.Focus();
                this.textBox2.SelectAll();
                return;
            }
            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 2
0
        public bool SwitchSystemUser(UserInfo userInfo)
        {
            if (userInfo == null || string.IsNullOrEmpty(userInfo.Id))
                return false;

            UserInfo currentUser = null;
            if (SystemContext.Instance.LoginUser != null)
                currentUser = SystemContext.Instance.LoginUser;
            if (currentUser != null && currentUser.Equals(userInfo))
                return true;

            if (!SaveCurrentFile())
            {
                return false;
            }

            SystemContext.Instance.LoginUser = userInfo;

            this.labName.Text = userInfo.Name;
            return true;
        }
Ejemplo n.º 3
0
 public short GetUserInfo(string userId, ref UserInfo userInfo)
 {
     if (userId == "123")
     {
         if (userInfo == null)
             userInfo = new UserInfo();
         userInfo.Id = "123";
         userInfo.Name = "zhangsan";
         return ReturnValue.OK;
     }
     else if(userId=="1234")
     {
         if (userInfo == null)
             userInfo = new UserInfo();
         userInfo.Id = "1234";
         userInfo.Name = "lisi";
         return ReturnValue.OK;
     }
     else
     {
         return ReturnValue.FAILED;
     }
 }
Ejemplo n.º 4
0
 public short GetUserInfo(string userId, ref UserInfo userInfo)
 {
     return SystemContext.Instance.DataAccess.GetUserInfo(userId,ref userInfo);
 }