private void txtIdCard_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string id = this.txtIdCard.Text.Trim(); if (id.Length != 0) { try { this.dateBirthday.Value = IDCardHelper.GetBirthday(id); this.cbSex.Text = IDCardHelper.GetSexName(id); } catch (Exception ex) { //this.SetError(sender, "手机号码格式错误!"); //MessageBoxHelper.Show("错误:"+ex.Message); } } } }
private void GenerateBirthdays() { string idCardNo = this.txtIdCard.Text.Trim(); if (!string.IsNullOrEmpty(idCardNo)) { string result = IDCardHelper.Validate(idCardNo); if (!string.IsNullOrEmpty(result)) { MessageDxUtil.ShowTips(result); this.txtIdCard.Focus(); return; } DateTime birthDay = IDCardHelper.GetBirthday(idCardNo); //int age = DateTimeHelper.GetServerDateTime2().Year - birthDay.Year; string sex = IDCardHelper.GetSexName(idCardNo); this.txtBirthday.DateTime = birthDay; this.txtGender.EditValue = EnumHelper.GetMemberValue <Gender>(sex); } }
private void GenerateBirthdays() { string idCardNo = this.txtIdentityCard.Text.Trim(); if (!string.IsNullOrEmpty(idCardNo)) { string result = IDCardHelper.Validate(idCardNo); if (!string.IsNullOrEmpty(result)) { MessageDxUtil.ShowTips(result); this.txtIdentityCard.Focus(); return; } DateTime birthDay = IDCardHelper.GetBirthday(idCardNo); int age = DateTime.Now.Year - birthDay.Year; string sex = IDCardHelper.GetSexName(idCardNo); this.txtBirthday.DateTime = birthDay; //this.txtAge.Value = age; this.txtGender.Text = sex; this.txtOfficePhone.Focus(); } }
protected void txtSfzmhm_TextChanged(object sender, EventArgs e) { string idcard = this.txtSfzmhm.Text.Trim(); if (string.IsNullOrEmpty(idcard) || idcard.Length < 18) { WebTools.Alert("身份证长度不足18位"); //this.txtSfzmhm.Text=""; this.txtSfzmhm.Focus(); return; } string re = IDCardHelper.Validate(idcard); if (!string.IsNullOrEmpty(re)) { WebTools.Alert(re); this.txtSfzmhm.Focus(); } string birthday = IDCardHelper.GetBirthday(idcard).ToString("yyyy-MM-dd"); string sex = IDCardHelper.GetSexName(idcard) == "男"?"1":"2"; this.txtCsrq.Value = birthday; this.cbXbValue.SelectedValue = sex; }
private void txtIdCard_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && this.cbIdCardType.SelectedIndex == 0) { string id = this.txtIdCard.Text.Trim(); if (id.Length == 15) { id = IDCardHelper.IdCard15To18(id); this.txtIdCard.Text = id; } if (this.lbId.Text.Length == 0) { ArrayList students = FT.DAL.Orm.SimpleOrmOperator.QueryConditionList <StudentInfo>(" where c_state<>'合格结业' and c_state<>'退学' and c_idcard='" + id + "'"); if (students != null && students.Count > 0) { MessageBoxHelper.Show("身份证明为" + id + "的学员处于在学状态,准备提取当前信息!"); StudentInfo student = students[0] as StudentInfo; FormHelper.SetDataToForm(this, student); this.entity = student; this.InitAllAddress(); } else { students = FT.DAL.Orm.SimpleOrmOperator.QueryConditionList <StudentInfo>(" where (c_state='合格结业' or c_state='退学') and c_idcard='" + id + "'"); if (students != null && students.Count > 0) { MessageBoxHelper.Show("身份证明为" + id + "的学员曾经在本校学习过,准备提取基本信息!"); StudentInfo student1 = students[0] as StudentInfo; FormHelper.SetDataToForm(this, student1); this.lbId.Text = string.Empty; this.lbBaoMingDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.lbState.Text = "初始报名"; this.cbLearnType.SelectedIndex = 1; this.txtExamDate.Text = string.Empty; this.txtExamId.Text = string.Empty; this.txtHeight.Text = string.Empty; this.txtLeftEye.Text = string.Empty; this.txtRightEye.Text = string.Empty; this.lbPrintedState.Text = "未打印"; } else if (id.Length != 0)//新学员 { try { this.InitByIdCard(id); this.dateBirthday.Value = IDCardHelper.GetBirthday(id); this.cbSex.Text = IDCardHelper.GetSexName(id); } catch (Exception ex) { //this.SetError(sender, "手机号码格式错误!"); //MessageBoxHelper.Show("错误:"+ex.Message); } } } } else { try { this.InitByIdCard(id); this.dateBirthday.Value = IDCardHelper.GetBirthday(id); this.cbSex.Text = IDCardHelper.GetSexName(id); } catch (Exception ex) { //this.SetError(sender, "手机号码格式错误!"); //MessageBoxHelper.Show("错误:"+ex.Message); } } } }