private void btnDelete_Click(object sender, EventArgs e) { String idcard = this.txtIdCard.Text.Trim(); if (idcard.Length == 0) { MessageBoxHelper.Show("请输入要删除的身份证号码!"); return; } string result = string.Empty; result = IDCardHelper.Validate(idcard); if (result != string.Empty) { MessageBoxHelper.Show(result); return; } this.SetConfig(); if (_TG.DeleteUser(idcard) == SUCCESSED) { MessageBoxHelper.Show("删除成功!"); } else { MessageBoxHelper.Show(Convert.ToString(_TG.LastErrCode) + "\n" + _TG.LastErrMsg + "\n" + _TG.LastErrReason); } }
public void SetIDCard(IDCard card) { this.txtName.Text = card.Name; this.txtIdCard.Text = card.IDC; this.txtAddress.Text = card.ADDRESS; this.dateBirthday.Value = card.BIRTH; this.cbSex.Text = IDCardHelper.GetSexName(card.IDC); }
/// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void IdentityVerify_Load(object sender, EventArgs e) { //身份证读卡子线程 //为了将身份证的信息读到内存中来 idCardHelper = new IDCardHelper(); idCardHelper.GetAvatarInfo(pImageEngine, m_strPath); StartVideo();//开启视频 }
private void AfterReadIdCard(IDCard card) { //TODO,所属地区代码的实现 this.txtName.Text = card.Name; this.txtIdCard.Text = card.IDC; this.InitByIdCard(this.txtIdCard.Text); this.txtRegAddress.Text = this.txtConnAddress.Text = card.ADDRESS; this.dateBirthday.Value = card.BIRTH; this.cbSex.Text = IDCardHelper.GetSexName(card.IDC); }
protected void ValidateIdCard(object sender, CancelEventArgs e, bool allowBlank) { TextBox txt = sender as TextBox; if (txt != null) { string tmp = txt.Text.Trim(); if (allowBlank) { if (tmp.Length == 0) { this.errorProvider1.SetError(txt, string.Empty); e.Cancel = false; } else { tmp = IDCardHelper.Validate(tmp); if (tmp.Length != 0) { this.errorProvider1.SetError(txt, tmp); e.Cancel = true; } else { this.errorProvider1.SetError(txt, string.Empty); e.Cancel = false; } } } else if (tmp.Length == 0) { this.errorProvider1.SetError(txt, "请输入身份证号!"); e.Cancel = true; } else { tmp = IDCardHelper.Validate(tmp); if (tmp.Length != 0) { this.errorProvider1.SetError(txt, tmp); e.Cancel = true; } else { this.errorProvider1.SetError(txt, string.Empty); e.Cancel = false; } } } }
private void btn15To18_Click(object sender, EventArgs e) { string key = this.txtIdCard.Text.Trim(); if (key.Length != 15) { MessageBoxHelper.Show("必须是15位的身份证才可以升级,请检查!"); return; } else { this.txtIdCard.Text = IDCardHelper.IdCard15To18(key); } }
protected void btnSaveStudent_Click(object sender, EventArgs e) { string lStrIDCard = StringHelper.fnFormatNullOrBlankString(this.txtIDCard.Text, ""); if (lStrIDCard == "") { WebTools.Alert("身份证号码不能为空"); return; } else if ((lStrIDCard.Length == 15 || lStrIDCard.Length == 18)) { string re = IDCardHelper.Validate(lStrIDCard); if (re != string.Empty) { WebTools.Alert(re); return; } } else if (txtLsh.Text.Trim().Length < 13) { WebTools.Alert("受理号不能少于13位"); return; } FpStudentObject fso = new FpStudentObject(); fso.IDCARD = lStrIDCard; int localtype = StringHelper.fnFormatNullOrBlankInt(ddlLocaltype.SelectedValue); fso.LOCALTYPE = localtype; fso.NAME = txtName.Text; fso.STATUE = FpStudentObject.STATUE_NEW; fso.LSH = txtLsh.Text; fso.SCHOOL_CODE = ddlSchool.SelectedValue; fso.SCHOOL_NAME = ddlSchool.SelectedItem.Text; fso.CAR_TYPE = ddlCarType.SelectedValue; fso.CREATE_TIME = DateTime.Now; fso.LASTMODIFY_TIME = DateTime.Now; fso.BL_IND = cbBlInd.Checked ? "Y" : "N"; if (FPSystemBiz.fnAddOrUpdateStudentRecord(fso)) { fnUISaveStudentInfoSucess(true); } else { fnUISaveStudentInfoSucess(false); } }
private void AfterReadIdCard(IDCard card) { //TODO,所属地区代码的实现 // card.PIC_Image; this.lbIdCardQfjg.Text = card.REGORG; this.lbIdCardYxqx.Text = card.Period_Of_Validity_CName; this.picIdCardImage.Image = card.PIC_Image; this.picIdCardImage.SizeMode = PictureBoxSizeMode.StretchImage; this.lbIdCardSfzmhm.Text = card.IDC; this.lbIDCardName.Text = card.Name; this.lbIdCardNational.Text = card.IDC; // this.InitByIdCard(this.txtIdCard.Text); this.lbIdCardAddress.Text = card.ADDRESS; this.lbIdCardBirthDay.Text = card.BIRTH.ToString("yyyy 年 MM 月 dd 日"); this.lbIdCardSex.Text = IDCardHelper.GetSexName(card.IDC); }
private void btnBegin_Click(object sender, EventArgs e) { if (this.txtPicPath.Text.Length == 0) { MessageBoxHelper.Show("请先配置要采集的照片的存放路径!"); this.txtPicPath.Focus(); return; } string idcard = this.txtIdCard.Text.Trim(); if (idcard.Length == 0) { MessageBoxHelper.Show("请先输入要采集人的身份证明号码!"); this.txtIdCard.Focus(); return; } if (idcard.Length == 15) { idcard = FT.Commons.Tools.IDCardHelper.IdCard15To18(idcard); this.txtIdCard.Text = idcard; } if (this.cbIdCardType.SelectedIndex == 0) { string error = IDCardHelper.Validate(idcard); if (error.Length > 0) { MessageBoxHelper.Show(error); this.txtIdCard.Focus(); return; } } try { if (!msgfilter) { this.Enabled = false; msgfilter = true; Application.AddMessageFilter(this); } FileHelper.ClearCapturePhotoes(); tw.Acquire(); } catch (Exception ex) { MessageBoxHelper.Show("没有找到合适外设!"); } }
private CarInfoDto Api1(CardInfosInput input) { var cardInfo = IDCardHelper.GetCardInfo(input.IdCard, input.Name); if (string.IsNullOrEmpty(cardInfo)) { return(null); } var cards = JsonConvert.DeserializeObject <CarInfoDto>(cardInfo); Logger.Info("在接口1中查询到数据" + cardInfo); if (cards.status != "202" && cards.status != "203") { return(cards); } return(null); }
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 InitByIdCard(string idcard) { this.cbRegProvince.SelectedValue = IDCardHelper.GetProvince(idcard); if (this.cbRegProvince.SelectedValue == null) { MessageBoxHelper.Show("发证地区区划变更过,请手动选择!"); return; //this.cbArea.SelectedIndex = 0; } //Constant.InitCity(this.cbCity, this.cbProvince.SelectedValue.ToString()); this.cbRegCity.SelectedValue = IDCardHelper.GetCity(idcard); if (this.cbRegCity.SelectedValue == null) { MessageBoxHelper.Show("发证地区区划变更过,请手动选择!"); return; //this.cbArea.SelectedIndex = 0; } //Constant.InitAreaCode(this.cbArea, this.cbCity.SelectedValue.ToString()); this.cbRegArea.SelectedValue = IDCardHelper.GetArea(idcard); if (this.cbRegArea.SelectedValue == null) { MessageBoxHelper.Show("发证地区区划变更过,请手动选择!"); return; //this.cbArea.SelectedIndex = 0; } else { this.cbBelongArea.SelectedValue = this.cbRegArea.SelectedValue; if (this.cbBelongArea.SelectedValue == null) { this.cbBelongArea.SelectedIndex = 0; } } }
private void btnValidator_Click(object sender, EventArgs e) { string key = this.txtIdCard.Text.Trim(); if (key.Length != 18) { MessageBoxHelper.Show("必须是18位的身份证,请检查!"); return; } else { string result = IDCardHelper.Validate(key); if (result == string.Empty) { MessageBoxHelper.Show("正确的身份证号码!"); return; } else { MessageBoxHelper.Show("错误," + result + "!"); return; } } }
private void txtIdCard_Validating(object sender, CancelEventArgs e) { string idcard = this.txtIdCard.Text.Trim(); if (idcard.Length > 0) { string str = IDCardHelper.Validate(idcard); if (str != string.Empty) { this.SetError(sender, str); e.Cancel = true; } else { this.ClearError(sender); e.Cancel = false; } } else { this.ClearError(sender); e.Cancel = false; } }
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 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(); } }
public void ExportHealthCareRecords(string filePath, CompanyEmployee emp) { var baseRowTemplateIndex_Table2 = 21; var baseRowTemplateIndex_Table3 = 26; var baseRowTemplateIndex_Table4 = 31; var baseRowTemplateIndex_Table5 = 46; var totalMoveRowCount = 0; var excelModel = new ExcelModel(); var excelSheet = new ExcelSheetModel(); excelSheet.Name = "Sheet1"; #region 封面 excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "编号", RowIndex = 1, ColumnIndex = 16, Value = DateTime.Now.ToString("yyyyMMddhhmmss"), }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "区县", RowIndex = 2, ColumnIndex = 16, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "姓名", RowIndex = 7, ColumnIndex = 7, Value = emp.EmployeeBaseInfo.UserName, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "单位名称", RowIndex = 8, ColumnIndex = 7, Value = emp.Company.CompanyName, }); #endregion #region 基本信息 excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "工号", RowIndex = 12, ColumnIndex = 2, Value = emp.WorkNumber, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "岗位状态", RowIndex = 12, ColumnIndex = 9, Value = emp.WorkType }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "上岗时间", RowIndex = 12, ColumnIndex = 15, Value = emp.StartPostDate.HasValue ? emp.StartPostDate.Value.ToString("yyyy/MM") : "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "离岗时间", RowIndex = 12, ColumnIndex = 17, Value = emp.EndPostDate.HasValue ? emp.EndPostDate.Value.ToString("yyyy/MM") : "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "姓名", RowIndex = 13, ColumnIndex = 2, Value = emp.EmployeeBaseInfo.UserName, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "身份证", RowIndex = 13, ColumnIndex = 9, Value = emp.EmployeeBaseInfo.IDCard, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "性别", RowIndex = 13, ColumnIndex = 15, Value = emp.EmployeeBaseInfo.Sex, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "是否需离岗体检", RowIndex = 13, ColumnIndex = 17, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "出生年月", RowIndex = 14, ColumnIndex = 2, Value = IDCardHelper.GetBirthDay(emp.EmployeeBaseInfo.IDCard).ToString("yyyy年MM月"), }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "户籍", RowIndex = 14, ColumnIndex = 9, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "是否已体检", RowIndex = 14, ColumnIndex = 17, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "文化程度", RowIndex = 15, ColumnIndex = 2, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "是否吸烟", RowIndex = 15, ColumnIndex = 9, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "个人爱好", RowIndex = 16, ColumnIndex = 2, Value = "", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "既往史", RowIndex = 17, ColumnIndex = 2, Value = "", }); #endregion #region 职业史 if (emp.EmployeeBaseInfo.WorkHistories.Count > 0) { for (int i = 0; i < emp.EmployeeBaseInfo.WorkHistories.Count; i++) { var item = emp.EmployeeBaseInfo.WorkHistories[i]; var rowIndex = baseRowTemplateIndex_Table2 + i + 1; excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "用人单位名称", RowIndex = rowIndex, ColumnIndex = 1, Value = item.CompanyName, TemplateRowIndex = baseRowTemplateIndex_Table2 }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "从事工种", RowIndex = rowIndex, ColumnIndex = 3, Value = item.WorkType, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "工作岗位", RowIndex = rowIndex, ColumnIndex = 6, Value = item.Department, }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "起始时间", RowIndex = rowIndex, ColumnIndex = 8, Value = string.Format("{0} - {1}", item.EntryDate.HasValue ? item.EntryDate.Value.ToString("yyyy年MM月") : "", item.LeaveDate.HasValue ? item.LeaveDate.Value.ToString("yyyy年MM月") : "") }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "是否危害岗位", RowIndex = rowIndex, ColumnIndex = 14, Value = string.IsNullOrEmpty(item.AdverseFactor) ? "否" : "是", }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "接触职业危害因素名称1", RowIndex = rowIndex, ColumnIndex = 15, Value = item.AdverseFactor, }); } totalMoveRowCount += emp.EmployeeBaseInfo.WorkHistories.Count; } #endregion #region 职业危害接触史 baseRowTemplateIndex_Table3 += totalMoveRowCount; totalMoveRowCount += 0; #endregion #region 职业卫生(健康)检查结果 baseRowTemplateIndex_Table4 += totalMoveRowCount; var healthResultList = _healthResultRepository.GetByIDCard(emp.EmployeeBaseInfo.IDCard); if (healthResultList.Count > 0) { for (int i = 0; i < healthResultList.Count; i++) { var item = healthResultList[i]; var rowIndex = baseRowTemplateIndex_Table4 + i + 1; excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "检查时间", RowIndex = rowIndex, ColumnIndex = 1, Value = item.HealthDate.HasValue ? item.HealthDate.Value.ToString("yyyy年MM月") : "", TemplateRowIndex = baseRowTemplateIndex_Table4 }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检项目-粉尘", RowIndex = rowIndex, ColumnIndex = 2, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检项目-毒物", RowIndex = rowIndex, ColumnIndex = 3, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检项目-物理因素", RowIndex = rowIndex, ColumnIndex = 4, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "健康监护类型-上岗前", RowIndex = rowIndex, ColumnIndex = 5, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "健康监护类型-在岗期间", RowIndex = rowIndex, ColumnIndex = 6, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "健康监护类型-离岗时", RowIndex = rowIndex, ColumnIndex = 7, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检结果-正常", RowIndex = rowIndex, ColumnIndex = 8, Value = item.Result }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检结果-复查", RowIndex = rowIndex, ColumnIndex = 9, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检结果-确诊", RowIndex = rowIndex, ColumnIndex = 10, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检结果-禁忌", RowIndex = rowIndex, ColumnIndex = 11, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检结果-疑似", RowIndex = rowIndex, ColumnIndex = 12, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检项目-其他病患", RowIndex = rowIndex, ColumnIndex = 13, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "复查时间", RowIndex = rowIndex, ColumnIndex = 14, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "复查情况", RowIndex = rowIndex, ColumnIndex = 15, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "复查结论", RowIndex = rowIndex, ColumnIndex = 16, Value = "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "体检单位", RowIndex = rowIndex, ColumnIndex = 17, Value = item.HealthByCompany }); } totalMoveRowCount += healthResultList.Count; } #endregion #region 职业病诊疗情况 baseRowTemplateIndex_Table5 += totalMoveRowCount; #endregion excelModel.Sheets.Add(excelSheet); _importExportService.ExportWithTemplateExtend(filePath, excelModel); }
public void ExportAdverseFactorContactSituationRegistrationForm(string filePath, CompanyOrder order) { var excelModel = new ExcelModel(); var excelSheet = new ExcelSheetModel(); excelSheet.Name = "Sheet1"; excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "单位名称", RowIndex = 3, ColumnIndex = 3, Value = order.Company.CompanyName }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "单位地址", RowIndex = 4, ColumnIndex = 3, Value = order.Company.CompanyAddress }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "邮编", RowIndex = 4, ColumnIndex = 10, Value = order.Company.ZipCode }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "法人", RowIndex = 5, ColumnIndex = 3, Value = order.Company.LegalPerson }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "联系人", RowIndex = 5, ColumnIndex = 7, Value = order.Company.ContactPerson }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "联系电话", RowIndex = 5, ColumnIndex = 10, Value = order.Company.ContactPhone }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "休息日", RowIndex = 6, ColumnIndex = 3, Value = order.Company.RestDay }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "企业注册类型", RowIndex = 6, ColumnIndex = 7, Value = order.Company.CompanyRegisterType == null ? string.Empty : order.Company.CompanyRegisterType.Name }); if (order.CompanyEmployees != null && order.CompanyEmployees.Count > 0) { var row = 9; foreach (var emp in order.CompanyEmployees) { excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "序号", RowIndex = row, ColumnIndex = 1, Value = (row - 8).ToString() }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "姓名", RowIndex = row, ColumnIndex = 2, Value = emp.EmployeeBaseInfo.UserName }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "性别", RowIndex = row, ColumnIndex = 3, Value = emp.EmployeeBaseInfo.Sex }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "年龄", RowIndex = row, ColumnIndex = 4, Value = IDCardHelper.GetAge(emp.EmployeeBaseInfo.IDCard).ToString() }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "民工", RowIndex = row, ColumnIndex = 5, Value = emp.MigrantWorker.Name }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "车间部门", RowIndex = row, ColumnIndex = 6, Value = emp.Department }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "工种", RowIndex = row, ColumnIndex = 7, Value = emp.WorkType }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "危害因素", RowIndex = row, ColumnIndex = 8, Value = emp.AdverseFactor }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "接触工龄", RowIndex = row, ColumnIndex = 9, Value = emp.AdverseMonthes.HasValue ? emp.AdverseMonthes.ToString() : "" }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "检查类别", RowIndex = row, ColumnIndex = 10, Value = emp.HealthStatus.Name }); excelSheet.Cells.Add(new ExcelSheetCellModel() { Title = "备注", RowIndex = row, ColumnIndex = 11, Value = emp.Comment }); row++; } } excelModel.Sheets.Add(excelSheet); _importExportService.ExportWithTemplate(filePath, excelModel); }
public override void Execute(GetCardInfos args) { var info = args.Info; info.ForEach(m => { try { var cardInfo = _cardInfoRepository.Get(m.ID); if (cardInfo != null) { var result = IDCardHelper.GetCardInfo(cardInfo.IdCard, cardInfo.RealName); Logger.Info(result); var isSuccess = false; var card = JsonConvert.DeserializeObject <CarInfoDto>(result); var province = card.province; var city = card.city; var prefecture = card.prefecture; var area = card.area; var sex = card.sex; var birthday = card.birthday; if (card.status == "202" || card.status == "203") { //无法验证的情况下,只能再次向别的接口发起验证 var temp = IDCard2Helper.GetCardInfo(cardInfo.IdCard, cardInfo.RealName); if (!string.IsNullOrEmpty(temp)) { Logger.Info("接口" + temp); var cards2 = JsonConvert.DeserializeObject <CarInfo2Dto>(temp); if (cards2.result != null && cards2.result.IdCardInfor != null) { try { sex = cards2.result.IdCardInfor.sex; birthday = cards2.result.IdCardInfor.birthday; area = cards2.result.IdCardInfor.area; var areaInfo = IDCard2Helper.getArea(area); province = areaInfo.Province; city = areaInfo.City; prefecture = areaInfo.Country; isSuccess = true; } catch { } } } } cardInfo.Status = isSuccess?"01": card.status; cardInfo.StatusMsg = isSuccess ? "验证通过" :card.msg; cardInfo.Sex = sex; cardInfo.Address = area; cardInfo.Province = province; cardInfo.City = city; cardInfo.Prefecture = prefecture; if (!string.IsNullOrEmpty(birthday)) { cardInfo.Birthday = DateTime.Parse(birthday); } cardInfo.AddrCode = card.addrCode; cardInfo.LastCode = card.lastCode; cardInfo.CheckTime = DateTime.Now; _cardInfoRepository.Update(cardInfo); } } catch (Exception e) { Logger.Info(e.ToString()); } }); }
private void btnCollection_Click(object sender, EventArgs e) { String idcard = this.txtIdCard.Text.Trim(); if (idcard.Length == 0) { MessageBoxHelper.Show("请输入要采集的身份证号码!"); return; } string result = string.Empty; if (idcard.Length >= 15) { result = IDCardHelper.Validate(idcard); if (result != string.Empty) { MessageBoxHelper.Show(result); return; } } String name = this.txtName.Text.Trim(); if (name.Length == 0) { MessageBoxHelper.Show("请输入要采集的姓名!"); return; } // if(FingerDbOperator.Exists(idcard)) // { // MessageBoxHelper.Show("已存在身份证号码为"+idcard+"的指纹记录!"); // return; // } int intResult = SUCCESSED; this.SetConfig(); //if (FingerDbOperator.Exists(idcard)) //{ //FingerDbOperator.DeleteUser(idcard); //} intResult = _TG.NewEnroll(idcard); if (intResult == SUCCESSED) { MessageBoxHelper.Show("采集成功!"); FingerDbOperator.Enroll(idcard, name, this.datePxrq.Value.ToString("yyyy-MM-dd"), this.cbStudentType.SelectedValue.ToString(), this.cbLearnCar.Text); // this.localFingerRecordSearch2.SetConditions(" c_name like '%'"); // this.localFingerRecordSearch2.se this.localFingerRecordSearch2.SetMyConditon(" c_name like '%'"); //this.txtIdCard.Text = string.Empty; this.ClearInput(); //this.localFingerRecordSearch2.SetMyConditon(string.Empty); // this.lo } else if (intResult == 404) { MessageBoxHelper.Show("使用者要求取消或者离开"); } else if (intResult == 31) { MessageBoxHelper.Show("身份证号码" + idcard + "已经采集了指纹,请先删除该身份证的指纹后进行采集!"); return; /* * FingerDbOperator.DeleteUser(idcard); * _TG.DeleteUser(idcard); * intResult = _TG.NewEnroll(idcard); * if (intResult == SUCCESSED) * { * MessageBoxHelper.Show("更新采集成功!"); * FingerDbOperator.Enroll(idcard, name, this.datePxrq.Value.ToString("yyyy-MM-dd"), this.cbStudentType.SelectedValue.ToString(), this.cbLearnCar.Text); * //this.localFingerRecordSearch2.SetConditions(" c_name like '%'"); * //this.localFingerRecordSearch2.SetMyConditon(string.Empty); * this.localFingerRecordSearch2.SetMyConditon(" c_name like '%'"); * this.ClearInput(); * * // this.localFingerRecordSearch2.Refresh(); * * } */ } else if (intResult == 40) { FingerDbOperator.ClearFingerAratek(); System.Threading.Thread.Sleep(1000); intResult = _TG.NewEnroll(idcard); if (intResult == SUCCESSED) { MessageBoxHelper.Show("采集成功!"); FingerDbOperator.Enroll(idcard, name, this.datePxrq.Value.ToString("yyyy-MM-dd"), this.cbStudentType.SelectedValue.ToString(), this.cbLearnCar.Text); // this.localFingerRecordSearch2.SetConditions(" c_name like '%'"); // this.localFingerRecordSearch2.Refresh(); //this.localFingerRecordSearch2.SetMyConditon(string.Empty); this.localFingerRecordSearch2.SetMyConditon(" c_name like '%'"); this.ClearInput(); } // MessageBoxHelper.Show("已经超出授权数量,无法采集!"); } else if (intResult == 94 || intResult == 10) { MessageBoxHelper.Show("指纹采集数据库被使用中,请多点击几次或重启操作系统!" + intResult.ToString()); } else { MessageBoxHelper.Show("指纹采集监控平台返回代码:" + intResult); //_TG.UpdateEnroll(idcard); // MessageBox.Show("更新采集成功!"); // MessageBox.Show(Convert.ToString(_TG.LastErrCode) // + "\n" + _TG.LastErrMsg // + "\n" + _TG.LastErrReason); } }
/// <summary> /// 校验peopledto合法性 /// </summary> /// <param name="addPeopleDto"></param> internal object CheckPeopleDto(AddPeopleDto addPeopleDto) { if (_boProvider._context.Peoples.Any(m => m.NetName == addPeopleDto.NetName)) { return(JsonConvert.SerializeObject(new ResultMsgDto() { Code = 419, Msg = $"该用户名已存在" })); //throw ExceptionHelper.InvalidArgumentException("该用户名已存在"); } var result = IDCardHelper.GetIsValid(addPeopleDto.PeopleIdNumber); if (result == false) { return(JsonConvert.SerializeObject(new ResultMsgDto() { Code = 419, Msg = $"请输入合法的身份证" })); //throw ExceptionHelper.InvalidArgumentException($"请输入合法的身份证"); } if (_boProvider._context.Peoples.Any(m => m.PeopleIdNumber == addPeopleDto.PeopleIdNumber)) { return(JsonConvert.SerializeObject(new ResultMsgDto() { Code = 419, Msg = $"该用户已经注册了" })); //throw ExceptionHelper.InvalidArgumentException($"该用户已经注册了"); } try { var addr = new MailAddress(addPeopleDto.Email); //throw ExceptionHelper.InvalidArgumentException($"请输入正确的邮箱地址"); } catch (Exception) { return(JsonConvert.SerializeObject(new ResultMsgDto() { Code = 419, Msg = $"请输入正确的邮箱地址" })); } var sex = IDCardHelper.GetGenderStr(addPeopleDto.PeopleIdNumber); if (int.Parse(sex) % 2 == 0) { sex = "女"; } else { sex = "男"; } if (sex != addPeopleDto.Sex) { return(JsonConvert.SerializeObject(new ResultMsgDto() { Code = 419, Msg = $"请输入正确的性别" })); //throw ExceptionHelper.InvalidArgumentException($"请输入正确的性别"); } var people = _boProvider._mapper.Map <People>(addPeopleDto); _boProvider._peopleRepo.AddPeople(people); return(JsonConvert.SerializeObject(new ResultMsgDto() { Code = 200, Msg = $"正确" })); }
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); } } } }