private void button1_Click(object sender, EventArgs e) { if (this.comboBox5.Text == "" || this.comboBox5.Text == "--请选择--" || this.comboBox5.SelectedValue == null) { MessageBox.Show("【区域设置】信息不完整!"); return; } try { xcuncode = this.comboBox5.SelectedValue.ToString(); } catch { MessageBox.Show("出错!"); return; } if (xcuncode == null || "".Equals(xcuncode)) { MessageBox.Show("【区域设置】信息不完整!"); return; } else if (this.comboBox5.Text == "--请选择--") { DataTable dtxzs = areadao.cunInfo(xzcode); this.comboBox5.Text = dtxzs.Rows[0]["name"].ToString(); xcuncode = dtxzs.Rows[0]["code"].ToString(); } shengName = this.comboBox1.Text; shiName = this.comboBox2.Text; qxName = this.comboBox3.Text; xzName = this.comboBox4.Text; xcName = this.comboBox5.Text; allareaname = this.comboBox1.Text + this.comboBox2.Text + this.comboBox3.Text + xzName + xcName; string organ_code = null; organ_name = textBox1.Text; if (organ_name == "" || organ_name.Length < 1) { MessageBox.Show("建档单位不能为空!"); return; } input_name = this.comboBox6.Text; DataRow[] drs6 = dtuserlist.Select("uname = '" + input_name + "' "); if (drs6.Count() < 1) { MessageBox.Show("无此建档人名称,请重新选择!"); return; } zeren_doctor = this.comboBox7.Text; DataRow[] drs7 = dtuserlist.Select("uname = '" + zeren_doctor + "' "); if (drs7.Count() < 1) { MessageBox.Show("无此责任医生,请重新选择!"); return; } //if (shengName == "陕西") //{ zeren_doctorId = this.comboBox7.SelectedValue.ToString(); //} bc = this.comboBox8.Text; if (Common._bxgwry == "0") { if (this.comboBox8.Text == "") { MessageBox.Show("B超人员不能为空!"); return; } } else { DataRow[] drs8 = dtuserlist.Select("uname = '" + bc + "' "); if (drs8.Count() < 1) { MessageBox.Show("无此B超人员名称,请重新选择!"); return; } } xcg = this.comboBox9.Text; if (Common._bxgwry == "0") { if (this.comboBox9.Text == "") { MessageBox.Show("血球人员不能为空!"); return; } } else { DataRow[] drs9 = dtuserlist.Select("uname = '" + xcg + "' "); if (drs9.Count() < 1) { MessageBox.Show("无此血球人员名称,请重新选择!"); return; } } sh = this.comboBox10.Text; if (Common._bxgwry == "0") { if (this.comboBox10.Text == "") { MessageBox.Show("生化人员不能为空!"); return; } } else { DataRow[] drs10 = dtuserlist.Select("uname = '" + sh + "' "); if (drs10.Count() < 1) { MessageBox.Show("无此生化人员名称,请重新选择!"); return; } } sgtz = this.comboBox11.Text; if (Common._bxgwry == "0") { if (this.comboBox11.Text == "") { MessageBox.Show("身高体重不能为空!"); return; } } else { DataRow[] drs11 = dtuserlist.Select("uname = '" + sgtz + "' "); if (drs11.Count() < 1) { MessageBox.Show("无此身高体重人员名称,请重新选择!"); return; } } ncg = this.comboBox12.Text; if (Common._bxgwry == "0") { if (this.comboBox12.Text == "") { MessageBox.Show("尿机人员不能为空!"); return; } } else { DataRow[] drs12 = dtuserlist.Select("uname = '" + ncg + "' "); if (drs12.Count() < 1) { MessageBox.Show("无此尿机人员名称,请重新选择!"); return; } } xdt = this.comboBox13.Text; if (Common._bxgwry == "0") { if (this.comboBox13.Text == "") { MessageBox.Show("心电人员不能为空!"); return; } } else { DataRow[] drs13 = dtuserlist.Select("uname = '" + xdt + "' "); if (drs13.Count() < 1) { MessageBox.Show("无此心电人员名称,请重新选择!"); return; } } xy = this.comboBox14.Text; if (Common._bxgwry == "0") { if (this.comboBox14.Text == "") { MessageBox.Show("血压计人员不能为空!"); return; } } else { DataRow[] drs14 = dtuserlist.Select("uname = '" + xy + "' "); if (drs14.Count() < 1) { MessageBox.Show("无此血压计人员名称,请重新选择!"); return; } } wx = textBox3.Text; string other = textBox2.Text; string captain = ""; //this.comboBox15.SelectedValue.ToString(); string members = ""; // textBox4.Text; string operation = this.comboBox16.Text; if (Common._bxgwry == "0") { if (this.comboBox16.Text == "") { MessageBox.Show("操作人员不能为空!"); return; } } else { DataRow[] drs16 = dtuserlist.Select("uname = '" + operation + "' "); if (drs16.Count() < 1) { MessageBox.Show("无此操作人员名称,请重新选择!"); return; } } string car_name = this.comboBox17.Text; if (Common._bxgwry == "0") { if (this.comboBox17.Text == "") { MessageBox.Show("司机人员不能为空!"); return; } } else { DataRow[] drs17 = dtuserlist.Select("uname = '" + car_name + "' "); if (drs17.Count() < 1) { MessageBox.Show("无此司机人员名称,请重新选择!"); return; } } string create_user = null; string create_name = null; if (xcuncode != null && !"".Equals(xcuncode)) { bool bl = bsdao.addBasicSetting(shengcode, shicode, qxcode, xzcode, xcuncode, organ_code, organ_name, input_name, zeren_doctor, bc, xcg, sh, sgtz, ncg, xdt, xy, wx, other, captain, members, operation, car_name, create_user, create_name, zeren_doctorId, allareaname); if (bl) { //createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ////重置条码起始位置 //xmlDoc.Load(path); //node = xmlDoc.SelectSingleNode("config/barnumCode"); //node.InnerText = "10001"; //xmlDoc.Save(path); //处理别的窗体的信息 if (setFunDelegate == null) { frmMainmm frm = (frmMainmm)this.Parent.Parent; frm.SetJianDangInfo(textBox1.Text.Trim(), comboBox6.Text, comboBox7.Text); MessageBox.Show("数据保存成功!"); } else { setFunDelegate(textBox1.Text.Trim(), comboBox6.Text, comboBox7.Text); MessageBox.Show("数据保存成功!"); this.Close(); } issave = "1"; } } else { MessageBox.Show("区域选择不完整!"); } }
private void LoginSys() { loginname = this.comboBox1.Text; if (loginname == "admin") { DataTable sumret = service.UserService.sumUser(); if (sumret != null && sumret.Rows.Count >= 1) { DialogResult rr = MessageBox.Show("未初始化数据,是否继续?", "操作提示", MessageBoxButtons.YesNo); int tt = (int)rr; if (tt == 7) { return; } } } passw = this.txtPassword.Text; string md5passw = Md5.HashString(passw); //特殊处理下用户名 string username = ""; try { DataRowView dv = comboBox1.Items[comboBox1.SelectedIndex] as DataRowView; username = dv.Row["username"].ToString(); } catch { username = comboBox1.Text; } //用户登录 获取用户的账号和密码并判断 //DataTable ret = service.UserService.UserExists(comboBox1.Text, txtPassword.Text); DataTable ret = service.UserService.UserExists(username, md5passw); if (ret.Rows.Count > 0) { //获取当前登录用户的机构 userCode = ret.Rows[0]["user_code"].ToString(); if (!"admin".Equals(username)) { organCode = ret.Rows[0]["organ_code"].ToString(); if (udao.checkOrganNameBycode(organCode) == null || udao.checkOrganNameBycode(organCode).Rows.Count <= 0) { } else { organName = udao.checkOrganNameBycode(organCode).Rows[0]["organ_name"].ToString(); } } loginname = ret.Rows[0]["username"].ToString(); name = ret.Rows[0]["user_name"].ToString(); user_Name = name; bean.loginLogBean lb = new bean.loginLogBean(); lb.name = name; lb.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); lb.eventInfo = "登录系统!"; lb.type = "1"; if (lb.name != "admin" && lb.name != "" && lb.name != null) { lls.addCheckLog(lb); } /************/ string fpath = Application.StartupPath + "\\sysstem.ini"; sysstem.UpdateInfo(fpath); string spath = Application.StartupPath + "/log.txt"; FileInfo f = new FileInfo(spath); double fm = f.Length / 1024.0 / 1024.0; if (fm >= 1) //文件大于1M就删除掉 { File.WriteAllText(spath, string.Empty); } /*****end******/ this.Hide(); int m_nWindwMetricsY = GetWindwMetricsY(); Common.m_nWindwMetricsY = m_nWindwMetricsY; if (m_nWindwMetricsY <= 900) { frmMainm main = new frmMainm(); main.Show(); } else { frmMainmm main = new frmMainmm(); main.Show(); } } else { MessageBox.Show("用户名或密码错误!"); } }