public string Handle() { try { List <StaffInfo> newUserList = GetNewUserList(Content.users); List <StaffInfo> oldUserList = QYKQDal.GetUsers(QYCode); List <StaffInfo> AddList = new List <StaffInfo>(); List <StaffInfo> DelList = new List <StaffInfo>(); CompareCardId(newUserList, oldUserList, out AddList, out DelList); if (AddList.Count != 0) { MyLibrary.Log.Warn("增卡开始;企业代码:" + QYCode); foreach (var v in AddList) { Add(QYCode, v.Name, v.ID.ToUpper()); } MyLibrary.Log.Warn("增卡结束;企业代码:" + QYCode); } if (DelList.Count != 0) { MyLibrary.Log.Warn("销卡开始;企业代码:" + QYCode); foreach (var v in DelList) { Del(QYCode, v.Name, v.ID.ToUpper()); } MyLibrary.Log.Warn("销卡结束;企业代码:" + QYCode); } QYKQDal.UpdateLastTime(QYCode); return("0"); } catch (Exception ex) { return(ex.Message); } }
private void Del(string QYCode, string StaffName, string IdentityCardNo) { QykqInfo info = new QykqInfo(); info.pi_CmdId = "04_2"; info.pi_EnterpriseID = QYCode; info.pi_IdentityCardNo = IdentityCardNo; UInt16 ResultNum; string Reason; QYKQDal.Insert_Pro(info, out ResultNum, out Reason); if (ResultNum == 1) { MyLibrary.Log.Debug(Name + "_销卡出错;" + Reason + " 企业号码:" + QYCode + " 员工姓名:" + StaffName + " 身份证号:" + IdentityCardNo); } }
private void Add(string QYCode, string StaffName, string IdentityCardNo) { QykqInfo info = new QykqInfo(); info.pi_CmdId = "04_1"; info.pi_EnterpriseID = QYCode; info.pi_StaffName = StaffName; info.pi_IdentityCardNo = IdentityCardNo; info.pi_RegistrationTime = Time; info.pi_Dataintegrity = string.IsNullOrWhiteSpace(info.pi_IdentityCardNo) ? "1" : "0"; info.pi_UploadType = "1"; UInt16 ResultNum; string Reason; QYKQDal.Insert_Pro(info, out ResultNum, out Reason); if (ResultNum == 1) { MyLibrary.Log.Debug(Name + "_发卡出错;" + Reason + " 企业号码:" + QYCode + " 员工姓名:" + StaffName + " 身份证号:" + IdentityCardNo); } }