private void btn_ok_Click(object sender, EventArgs e) { if (rbt_ZG.Checked == true) { sbjgbh = ConfigurationManager.AppSettings["sbjgbh_ZGYB"].ToString(); //社保机构编号(职工) yybm = ConfigurationManager.AppSettings["yybm"].ToString(); //医院编码 UserCode_DW = ConfigurationManager.AppSettings["UserCode_DW"].ToString(); //医保登录用户名 Password_DW = ConfigurationManager.AppSettings["Password_DW"].ToString(); //医保登录密码 BXLX = "职工"; } if (rbt_JM.Checked == true) { sbjgbh = ConfigurationManager.AppSettings["sbjgbh_JMYB"].ToString(); //社保机构编号(居民) yybm = ConfigurationManager.AppSettings["yybm"].ToString(); //医院编码 UserCode_DW = ConfigurationManager.AppSettings["UserCode_DW"].ToString(); //医保登录用户名 Password_DW = ConfigurationManager.AppSettings["Password_DW"].ToString(); //医保登录密码 BXLX = "居民"; } this.Hide(); FrmsbjgSelect fsbjg = new FrmsbjgSelect(); fsbjg.ShowDialog(); sbjgbh = fsbjg.selSbjgBH; string networkPatclassID = fsbjg.fglyComtext; fsbjg.Close(); MainForm frm = new MainForm(UserCode, UserName, HOSPITAL_ID, HOSPITAL_NAME, sbjgbh, yybm, UserCode_DW, Password_DW, networkPatclassID); frm.ShowDialog(); this.Close(); this.Dispose(); }
/// <summary> /// 登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { var time = DateTime.Now; UserCode = text_UserCode.Text.ToString().Trim(); Password = text_Password.Text.ToString().Trim(); UserName = textBox_CzyXm.Text.ToString().Trim(); HOSPITAL_ID = cmb_Hos.SelectedValue.ToString(); HOSPITAL_NAME = cmb_Hos.Text; if (UserCode == "" || UserName == "") { MessageBox.Show("请正确输入用户名回车后再进行登录!"); this.text_UserCode.Focus(); return; } else if (Password == "") { MessageBox.Show("请输入密码后再进行登录!"); this.text_Password.Focus(); return; } else { string PassWord_JM = StringHelper.GetMD5String(Password); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT DISTINCT a.USER_CODE,a.UESR_NAME,a.PASSWORD,a.HOSPITAL_ID,c.HOSPITAL_NAME FROM COMM.COMM.USERINFO_VIEW a "); strSql.Append(" LEFT JOIN COMM.COMM.ROLES_VS_SYS b ON b.ROLE_ID = a.ROLE_ID "); strSql.Append(" LEFT JOIN COMM.COMM.HOSPITALS c ON c.HOSPITAL_ID = a.HOSPITAL_ID "); strSql.Append(" WHERE b.SYS_ID IN ('1','3') AND a.FLAG_SYSINVALID=0 "); strSql.Append(" AND USER_CODE= '" + UserCode + "' AND a.HOSPITAL_ID='" + HOSPITAL_ID + "' ");//AND a.PASSWORD='******' DataTable dtRe = new DataTable(); dtRe = SQLHelper.ExecSqlReDs(strSql.ToString()).Tables[0]; if (dtRe.Rows.Count == 0) { MessageBox.Show("用户不存在或无此登陆权限"); return; } else if (dtRe.Rows[0]["PASSWORD"].ToString().Trim() != PassWord_JM) //判断密码 { MessageBox.Show("密码不正确"); this.text_Password.Text = ""; text_Password.Focus(); return; } this.Hide(); StringBuilder strSql2 = new StringBuilder(); strSql2.Append(" SELECT TOP 1 INSTITUTION_CODE, INSTITUTION_NAME, INSTITUTION_USER_CODE, INSTITUTION_PASSWORD "); strSql2.Append(" FROM COMM.DICT.NETWORK_VS_INSTITUTION "); strSql2.Append(" WHERE HOSPITAL_ID='" + HOSPITAL_ID + "' "); dtRe = new DataTable(); dtRe = SQLHelper.ExecSqlReDs(strSql2.ToString()).Tables[0]; if (dtRe.Rows.Count == 0) { MessageBox.Show("用户不存在或无此登陆权限"); return; } sbjgbh = ConfigurationManager.AppSettings["sbjgbh_JMYB"].ToString(); //社保机构编号(居民) yybm = dtRe.Rows[0]["INSTITUTION_CODE"].ToString(); //医院编码 UserCode_DW = dtRe.Rows[0]["INSTITUTION_USER_CODE"].ToString(); //医保登录用户名 Password_DW = dtRe.Rows[0]["INSTITUTION_PASSWORD"].ToString(); //医保登录密码 FrmsbjgSelect fsbjg = new FrmsbjgSelect(); fsbjg.ShowDialog(); sbjgbh = fsbjg.selSbjgBH; networkPatclassID = "";//fsbjg.fglyComtext; fsbjg.Close(); //LOGIN.Sel_SBJG frm = new LOGIN.Sel_SBJG(this.text_UserCode.Text.ToString(), this.textBox_CzyXm.Text.ToString(), HOSPITAL_ID, HOSPITAL_NAME); MainForm frm = new MainForm(UserCode, UserName, HOSPITAL_ID, HOSPITAL_NAME, sbjgbh, yybm, UserCode_DW, Password_DW, networkPatclassID); frm.ShowDialog(); this.Close(); this.Dispose(); } }