Esempio n. 1
0
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Convert.ToString(cmbYiyuan.Text.Trim())))
     {
         MessageBox.Show("请请选择医院代号!");
         cmbYiyuan.Focus();
         return;
     }
     if (string.IsNullOrEmpty(Convert.ToString(txtLoginName.Text.Trim())))
     {
         MessageBox.Show("请输入 用户名!");
         txtLoginName.Focus();
         return;
     }
     if (string.IsNullOrEmpty(Convert.ToString(txtPassWord.Text.Trim())))
     {
         MessageBox.Show("请输入 密码!");
         txtPassWord.Focus();
         return;
     }
     try
     {
         string    uid      = txtLoginName.Text.Trim();
         string    password = txtPassWord.Text.Trim();
         DataTable dtUser   = bll.Get_user_info(uid, password);
         if (dtUser.Rows.Count != 0)
         {
             LogHelp.SaveLoginConfigure(cmbYiyuan.Text);
             Program.Customer.user_name = dtUser.Rows[0][2].ToString();
             Program.Customer.position  = dtUser.Rows[0][3].ToString();
             Program.Customer.userno    = dtUser.Rows[0][4].ToString();
             if (cmbYiyuan.Text.Trim() == "江苏盛泽医院")
             {
                 Program.Customer.yiyuanType = "010601";
             }
             else if (cmbYiyuan.Text.Trim() == "妇幼保健中心")
             {
                 Program.Customer.yiyuanType = "010604";
             }
             string jurisdiction        = bll.Get_user_jurisdiction(Program.Customer);
             int    jurisdiction_Length = jurisdiction.Length;
             Program.jurisdiction = new bool[jurisdiction_Length];
             Char[] temp = new char[jurisdiction_Length];
             temp = jurisdiction.ToCharArray();
             for (int j = 0; j < jurisdiction.Length; j++)
             {
                 Program.jurisdiction[j] = (temp[j] == '1') ? true : false;
             }
             DialogResult = DialogResult.OK;
             LockSet f1 = new LockSet();
             f1.timer11.Start(); //定时锁定程序
             loginCount++;
         }
         else
         {
             MessageBox.Show("账号或密码错误,请检查。");
             txtPassWord.Text = string.Empty;
         }
     }
     catch (Exception ex)
     {
         string errorStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "服务器中断,登陆失败!!";
         LogHelp.WriteErrorLog(errorStr);
         MessageBox.Show("登录失败!", ex.ToString());
         this.txtPassWord.Text = string.Empty;
     }
 }