Exemple #1
0
 /// <summary>
 /// 检查用户科室和权限
 /// </summary>
 /// <returns></returns>
 private bool CheckUserDeptAndRight(bool IsCA)
 {
     if (!CurrentUser.CheckPassword(txtPasswd.TextPass.Trim(), IsCA))
     {
         MessageBox.Show("密码不正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtPasswd.Text = "";
         txtPasswd.Focus();
         return(false);
     }
     if (!CurrentUser.IsAdministrator)
     {
         if (lvwSystem.Items.Count > 1)
         {
             lvwSystem.Focus();
             if (lvwSystem.SelectedItems.Count == 0)
             {
                 lvwSystem.Items[0].Selected = true;
                 lvwSystem.Items[0].Focused  = true;
                 this.CurrentSystem          = Convert.ToInt32(this.lvwSystem.SelectedItems[0].Tag);
             }
             else
             {
                 this.CurrentSystem = Convert.ToInt32(this.lvwSystem.SelectedItems[0].Tag);
             }
         }
         else
         {
             if (lvwSystem.Items.Count == 0)
             {
                 MessageBox.Show("该用户没有任何系统可用!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return(false);
             }
             this.CurrentSystem = Convert.ToInt32(this.lvwSystem.Items[0].Tag);
         }
     }
     else
     {
         //默认选第一个科室
         if (lvwSystem.Items.Count > 0)
         {
             if (lvwSystem.SelectedItems.Count == 0)
             {
                 this.CurrentSystem = Convert.ToInt32(this.lvwSystem.Items[0].Tag);
             }
             else
             {
                 this.CurrentSystem = Convert.ToInt32(this.lvwSystem.SelectedItems[0].Tag);
             }
         }
         else
         {
             this.CurrentSystem = 0;
         }
         txtFilter.Text = "";
         txtFilter.Focus();
     }
     return(true);
 }
Exemple #2
0
 private void textBoxPressEnterKey(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if ((int)e.KeyChar == 13)
     {
         TextBox txtBox = (TextBox)sender;
         if (txtBox.Name == txtOldPwd.Name)
         {
             txtNewPwd.Focus();
         }
         else if (txtBox.Name == txtNewPwd.Name)
         {
             txtAffirmPwd.Focus();
         }
         else if (txtBox.Name == txtAffirmPwd.Name)
         {
             btOK.Focus();
         }
     }
 }