public ActionResult Index(UserInfo userInfo, string days) { var UserId = Session["Id"] != null ? Session["Id"].ToString() : ""; var status = false; var successAction = "Added"; var FailedAction = "Addition"; if (userInfo.Id > 0) { status = userInfoRepository.Update(userInfo); successAction = "Updated"; FailedAction = "Update"; } else { var date = DateTime.Now; while (date.DayOfWeek.ToString() != "Monday") { date = date.AddDays(-1); } var day = days.Trim().Split(' '); foreach (var item in day) { userInfo.Date = date.AddDays(Convert.ToInt32(item)); userInfo.INumber = UserId; status = userInfoRepository.Add(userInfo); } } Session["Status"] = status ? "Success" : "Failed"; Session["Message"] = status ? "UserInfo Successfully " + successAction + "" : "UserInfo " + FailedAction + " Failed"; return(RedirectToAction("Index")); }
//添加用户 public int User_Add(UserAddViewModel userAddViewModel) { var user_Info = _IMapper.Map <UserAddViewModel, User_Info>(userAddViewModel); _IUserInfoRepository.Add(user_Info); return(_IUserInfoRepository.SaveChanges()); }
public void CreateUser(UserInfo userInfo) { if (userInfo == null) { throw new ArgumentNullException("用户信息不能为空"); } _userInfoRepository.Add(userInfo); //_userInfoRepository.UnitOfWork.Commit(); _userInfoRepository.UnitOfWork.CommitAndRefreshChanges(); }
/// <summary> /// 新增用户 /// </summary> /// <param name="param"></param> /// <returns></returns> public async Task <BaseResponse> Add(AddUserParam param) { var result = await userInfoRepository.Add(param.MapTo <PoJun.Shadow.Api.ContractModel.Inside.Test.AddUserParam>()); if (result == null) { throw new FailException(); } return(new BaseResponse()); }
private async static Task SeedUserInfo(int userId, IUserInfoRepository repository) { UserInfo userInfo = new UserInfo() { OwnerId = userId, FirstName = "Daniil", LastName = "Nichitenco" }; await repository.Add(userInfo); await repository.SaveChangesAsync(); }
private async Task <ActionResult <UserInfo> > CreateUserInfo(UserForUpdateDto userForUpdateDto, int userId) { var userInfo = _mapper.Map <UserInfo>(userForUpdateDto); userInfo.OwnerId = userId; await _repository.Add(userInfo); await _repository.SaveChangesAsync(); return(Ok(userInfo)); }
public void AddWithUserInfoReturnsExpectedResult() { //Arrange var wishList = new UserDetail { UserId = "Vasan123", FirstName = "Vasan", LastName = "Thirumalai", Password = "******" }; //Act var actual = userInfoRepository.Add(wishList); // Assert Assert.Equal(1, actual); }
public void Text1() { Container con = new Container(); IUserInfoRepository userinfo = con.Resolve <IUserInfoRepository>(); UserInfo ui = new UserInfo(); ui.Name = "zhangdi"; ui.RowCreateDate = DateTime.Now; userinfo.Add(ui); userinfo.Flush(); }
public bool CreateUser(UserInfoManagementInDTO user, Guid userInfoId, string imageURL) { try { if (ValidateEmail(user.Email) != Guid.Empty) { return(false); } var userInfo = new UserInfo(); userInfo.Address = user.Address; userInfo.EntityId = user.CompanyId; userInfo.ContactNo = user.ContactNo; userInfo.Country = user.Country; userInfo.Email = user.Email; userInfo.FirstName = user.FirstName; userInfo.LastName = user.LastName; userInfo.Position = user.Position; userInfo.Status = user.Status; userInfo.Timezone = user.Timezone; userInfo.CreatedBy = userInfoId; userInfo.ModifiedBy = userInfoId; userInfo.ModifiedOn = Localization.GetUTCDateNow(); userInfo.CreatedOn = Localization.GetUTCDateNow(); userInfo.UserInfoId = Guid.NewGuid(); userInfo.ImageURL = imageURL; var userId = _userInfoRepository.Add(userInfo); foreach (var mappedRole in user.RoleMappingItems) { var userRole = new UserRole(); userRole.UserId = userId; userRole.RoleId = mappedRole.RoleId; userRole.CreatedBy = userInfoId; userRole.CreatedOn = Localization.GetUTCDateNow(); userRole.ModifiedBy = userInfoId; userRole.ModifiedOn = Localization.GetUTCDateNow(); _userRoleRepository.Add(userRole, true); } } catch (Exception ex) { throw new Exception(ex.Message); } return(true); }
/// <summary> /// Необходимо реализовать метод Invoke или InvokeAsync /// </summary> public async Task InvokeAsync(HttpContext context) { string userAgent = context.Request.Headers["User-Agent"][0]; var newUserInfo = new UserInfo() { Id = Guid.NewGuid(), Date = DateTime.Now, UserAgent = userAgent }; await _repo.Add(newUserInfo); LogConsole(context); await LogFile(context); // Передача запроса далее по конвейеру await _next.Invoke(context); }
///// <summary> ///// 新增用户 ///// </summary> ///// <param name="userInfo"></param> ///// <returns></returns> public bool AddUserInfo(string userName, string email, string password, out string msg) { bool success = false; UserInfo user = new UserInfo() { UserName = userName, Email = email, Password = password, UId = _uUID.CreateUUID() }; if (_userInfoRepository.Add(user)) { // TODO 发送邮件激活链接 success = true; msg = "Success"; } else { msg = "新增失败"; } return(success); }
public ValidationResponse RegisterInfo(UserInfoRequest registerInfoRequest) { if (UserExists(registerInfoRequest.UserId) is null) { return(CatchErrorForNonExistentIdentity()); } var userInfo = _mapper.Map <UserInfo>(registerInfoRequest); var result = _validateUserInfo.ValidateAddition(userInfo); if (result.IsSuccess) { if (_userInfoRepository.Add(userInfo) > 0) { _userInfoHistoryRepository.Add(_entityHistoryFactory.GetEntityHistory(userInfo, Domain.Domain.DomainHistory.Enums.RequestActionEnum.Register) as UserInfoHistory); result.Message = "User info has ben add"; return(result); } } return(result); }
public TblUser Create(TblUser user, string password) { if (string.IsNullOrWhiteSpace(password)) { throw new Exception("Password is required"); } if (_userInfoRepository.All.Any(x => x.UserName == user.UserName)) { throw new Exception("Username \"" + user.UserName + "\" is already taken"); } if (!string.IsNullOrWhiteSpace(password)) { var encryptedPassword = Encrypt(password); user.Password = encryptedPassword; } _userInfoRepository.Add(user); _userInfoRepository.SaveChanges(); return(user); }
public int Add(UserModel userModel) { var userEntity = new Entities.UserDetail { FirstName = userModel.FirstName, LastName = userModel.LastName, Password = userModel.Password, ConfirmPassword = userModel.ConfirmPassword, DateOfBirth = userModel.DateOfBirth, Email = userModel.Email, Gender = userModel.Gender, PhoneNumber = userModel.PhoneNumber, RoleId = userModel.PhoneNumber, Status = userModel.Status, Insurance = userModel.Insurance, Description = userModel.Description, License = userModel.License, Permit = userModel.Permit, Registration = userModel.Registration, VehicleNumber = userModel.VehicleNumber, }; return(userRepository.Add(userEntity)); }
public void Add(UserInfo entity) { userInfoRepo.Add(entity); }
public bool Add(UserInfo entity) { return(_userInfoRepository.Add(entity)); }
public long QuoteAdd(PostPrecisePriceRequest request, string _url, IUserInfoRepository repository, int topAgentId = 0) { //如果是直接报价,没有传递车牌号,直接用车架号替换 if (string.IsNullOrWhiteSpace(request.LicenseNo)) { request.LicenseNo = request.CarVin.ToUpper(); } var insertUserinfo = new bx_userinfo { agent_id = request.Agent, top_agent_id = topAgentId, IsLastYear = 0, LastYearSource = -1, Source = request.IntentionCompany, //Mobile = agentModel.Mobile, LicenseNo = request.LicenseNo, Agent = request.Agent.ToString(), //UserId = account.UserId, OpenId = request.CustKey, CityCode = request.CityCode.ToString(), //IsPublic = 0, QuoteStatus = -1, CreateTime = DateTime.Now, IsSingleSubmit = request.IsSingleSubmit, // CarType = request.CarType, // IsNewCar = request.IsNewCar, // CarUsedType = request.CarUsedType, CarVIN = request.CarVin.ToUpper(), MoldName = request.MoldName, RegisterDate = request.RegisterDate, EngineNo = request.EngineNo.ToUpper(), RenewalType = request.RenewalType, // SeatCout = request.SeatCount, // TonCount = request.TonCount, NeedEngineNo = 0, IsDistributed = 0, UpdateTime = DateTime.Now, RenewalStatus = -1, OwnerIdCardType = -1, IsReView = 0, IsTest = 0, RenewalCarType = request.RenewalCarType, IsChangeRelation = 0//修改关系人状态改为0;17/10/23bygpjadd。//提交订单会判断此字段是否为1 }; if (!string.IsNullOrWhiteSpace(request.Mobile)) { insertUserinfo.Mobile = request.Mobile; } //分配逻辑 //if (request.RenewalType == 2) //{ // insertUserinfo.IsDistributed = 0; //未分配 //} //else //{ // if (request.ChildAgent == request.Agent) // { // insertUserinfo.IsDistributed = 0; //未分配 // } // else // { // insertUserinfo.IsDistributed = 2; //已 分配 // } //} //此新车报价,如果有就更新 ,没有直接报价 if (!string.IsNullOrWhiteSpace(request.UpdateLicenseNo)) { insertUserinfo.LicenseNo = request.UpdateLicenseNo; } if (!string.IsNullOrWhiteSpace(request.Email)) { insertUserinfo.Email = request.Email; } //#region 费改地区身份证完善 if (!string.IsNullOrWhiteSpace(request.CarOwnersName)) { //insertUserinfo.UserName = request.CarOwnersName; insertUserinfo.LicenseOwner = request.CarOwnersName; //insertUserinfo.InsuredName = request.CarOwnersName; } if (!string.IsNullOrWhiteSpace(request.IdCard)) { insertUserinfo.IdCard = request.IdCard.ToUpper(); //insertUserinfo.InsuredIdCard = request.IdCard.ToUpper(); //insertUserinfo.InsuredIdType = 1;//小龙端 需要此属性 } //#endregion #region 车主信息 if (!string.IsNullOrWhiteSpace(request.IdCard)) { insertUserinfo.IdCard = request.IdCard; //if (request.IdCard.IsValidIdCard()) //{ // request.OwnerIdCardType = 1; //} } if (request.OwnerIdCardType > 0) { insertUserinfo.OwnerIdCardType = request.OwnerIdCardType; } insertUserinfo.OwnerSex = request.OwnerSex; insertUserinfo.OwnerBirthday = request.OwnerBirthday; insertUserinfo.OwnerIssuer = request.OwnerAuthority; insertUserinfo.OwnerNation = request.OwnerNation; #endregion #region 投保人为空 按照被保人信息保存 var isPosterValid = false || !string.IsNullOrWhiteSpace(request.HolderName) && !string.IsNullOrWhiteSpace(request.HolderIdCard) && request.HolderIdType > 0; var isInsuredValid = false || !string.IsNullOrWhiteSpace(request.InsuredName) && !string.IsNullOrWhiteSpace(request.InsuredIdCard) && request.InsuredIdType > 0; if (!isPosterValid && isInsuredValid) { request.HolderName = request.InsuredName; request.HolderIdCard = request.InsuredIdCard; request.HolderIdType = request.InsuredIdType; } if (!string.IsNullOrWhiteSpace(request.InsuredMobile) && string.IsNullOrWhiteSpace(request.HolderMobile)) { request.HolderMobile = request.InsuredMobile; } if (!string.IsNullOrWhiteSpace(request.InsuredEmail) && string.IsNullOrWhiteSpace(request.HolderEmail)) { request.HolderEmail = request.InsuredEmail; } if (!string.IsNullOrWhiteSpace(request.InsuredAddress) && string.IsNullOrWhiteSpace(request.HolderAddress)) { request.HolderAddress = request.InsuredAddress; } #endregion #region 被保险人信息 if (!string.IsNullOrWhiteSpace(request.InsuredEmail)) { insertUserinfo.InsuredEmail = request.InsuredEmail; } if (!string.IsNullOrWhiteSpace(request.InsuredName)) { insertUserinfo.InsuredName = request.InsuredName.Trim(); } if (!string.IsNullOrWhiteSpace(request.InsuredIdCard)) { insertUserinfo.InsuredIdCard = request.InsuredIdCard.ToUpper(); //if (request.InsuredIdCard.IsValidIdCard()) //{ // request.InsuredIdType = 1; //} } if (!string.IsNullOrWhiteSpace(request.InsuredMobile)) { insertUserinfo.InsuredMobile = request.InsuredMobile.Trim(); } if (request.InsuredIdType != 0) { insertUserinfo.InsuredIdType = request.InsuredIdType; } insertUserinfo.InsuredAddress = request.InsuredAddress; insertUserinfo.InsuredCertiStartdate = request.InsuredCertiStartdate; insertUserinfo.InsuredCertiEnddate = request.InsuredCertiEnddate; insertUserinfo.InsuredSex = request.InsuredSex; insertUserinfo.InsuredBirthday = request.InsuredBirthday; insertUserinfo.InsuredIssuer = request.InsuredAuthority; insertUserinfo.InsuredNation = request.InsuredNation; #endregion #region 投保人信息 if (!string.IsNullOrWhiteSpace(request.HolderEmail)) { insertUserinfo.HolderEmail = request.HolderEmail; } if (!string.IsNullOrWhiteSpace(request.HolderName)) { insertUserinfo.HolderName = request.HolderName.Trim(); } if (!string.IsNullOrWhiteSpace(request.HolderIdCard)) { insertUserinfo.HolderIdCard = request.HolderIdCard.ToUpper(); //if (request.HolderIdCard.IsValidIdCard()) //{ // request.HolderIdType = 1; //} } if (!string.IsNullOrWhiteSpace(request.HolderMobile)) { insertUserinfo.HolderMobile = request.HolderMobile.Trim(); } if (request.HolderIdType != 0) { insertUserinfo.HolderIdType = request.HolderIdType; } insertUserinfo.HolderAddress = request.HolderAddress; insertUserinfo.HolderCertiStartdate = request.HolderCertiStartdate; insertUserinfo.HolderCertiEnddate = request.HolderCertiEnddate; insertUserinfo.HolderSex = request.HolderSex; insertUserinfo.HolderBirthday = request.HolderBirthday; insertUserinfo.HolderIssuer = request.HolderAuthority; insertUserinfo.HolderNation = request.HolderNation; #endregion //此处品牌型号改在外层获取 //if (insertUserinfo.CarVIN.Length > 5) //{ // var frontCarVin = insertUserinfo.CarVIN.Substring(0, 5); // if (!insertUserinfo.CarVIN.StartsWith("L") && insertUserinfo.MoldName.ToUpper().IndexOf(frontCarVin, System.StringComparison.Ordinal) >= 0) // { // using (var client = new HttpClient()) // { // client.BaseAddress = new Uri(_url); // var getUrl = string.Format("api/taipingyang/gettaipycarinfoby?carvin={0}", insertUserinfo.CarVIN); // HttpResponseMessage responseVin = client.GetAsync(getUrl).Result; // var resultVin = responseVin.Content.ReadAsStringAsync().Result; // var carinfo = resultVin.FromJson<WaGetTaiPyCarInfoResponse>(); // if (carinfo != null && carinfo.CarInfo != null) // { // insertUserinfo.MoldName = carinfo.CarInfo.moldName; // } // } // } //} var id = repository.Add(insertUserinfo); return(id); }
public void AddUser(UserInfo item) { _userInfoRep.Add(item); }
public long Add(bx_userinfo userinfo) { return(_userInfoRepository.Add(userinfo)); }
public static bx_userinfo Save(GetReInfoRequest request, int roleType, IUserInfoRepository infoRepository, int topAgentId = 0) { var insertUserinfo = new bx_userinfo { top_agent_id = topAgentId, agent_id = request.Agent, IsLastYear = 0, LastYearSource = -1, //Source = -1, //Mobile = agentModel.Mobile, LicenseNo = request.LicenseNo, Agent = request.Agent.ToString(), //UserId = account.UserId,//此字段废弃 OpenId = request.CustKey, CityCode = request.CityCode.ToString(), //IsPublic = request.IsPublic, QuoteStatus = -1, RenewalStatus = -1, CreateTime = DateTime.Now, RenewalType = request.RenewalType, //IsLastNewCar = request.IsLastYearNewCar, //EngineNo = request.EngineNo, //CarVIN = request.CarVin, NeedEngineNo = 1, IsDistributed = 0, UpdateTime = DateTime.Now, IsSingleSubmit = 0, Source = 0, OwnerIdCardType = -1, IsReView = 0, IsTest = 0 }; insertUserinfo.RenewalCarType = request.RenewalCarType; if (!string.IsNullOrWhiteSpace(request.SixDigitsAfterIdCard)) { insertUserinfo.SixDigitsAfterIdCard = request.SixDigitsAfterIdCard; } if (request.IsLastYearNewCar == 2) { insertUserinfo.NeedEngineNo = 1; if (!string.IsNullOrWhiteSpace(request.EngineNo)) { insertUserinfo.EngineNo = request.EngineNo.ToUpper(); } if (!string.IsNullOrWhiteSpace(request.CarVin)) { insertUserinfo.CarVIN = request.CarVin.ToUpper(); } } //车架号及发动机号全部都有的情况 ,没有测试 ,先注释 //if (request.IsLastYearNewCar == 1 & // (!string.IsNullOrWhiteSpace(request.CarVin) && !string.IsNullOrWhiteSpace(request.EngineNo))) //{ // insertUserinfo.LicenseNo = request.LicenseNo; // insertUserinfo.MoldName = string.Empty; // insertUserinfo.RegisterDate = string.Empty; // if (!string.IsNullOrWhiteSpace(request.EngineNo)) // { // insertUserinfo.EngineNo = request.EngineNo.ToUpper(); // } // if (!string.IsNullOrWhiteSpace(request.CarVin)) // { // insertUserinfo.CarVIN = request.CarVin.ToUpper(); // } // insertUserinfo.NeedEngineNo = 1; //} if (!string.IsNullOrWhiteSpace(request.CarOwnersName)) { insertUserinfo.UserName = request.CarOwnersName; insertUserinfo.LicenseOwner = request.CarOwnersName; insertUserinfo.InsuredName = request.CarOwnersName; } if (!string.IsNullOrWhiteSpace(request.IdCard)) { insertUserinfo.IdCard = request.IdCard.ToUpper(); insertUserinfo.InsuredIdCard = request.IdCard.ToUpper(); } /* 摄像头进店修改进店参数 * addbygpj20180828 * 20180918删除该逻辑,刘松年在下文会改 */ //if (request.RenewalType == 3) //{ // insertUserinfo.IsCamera = true; // insertUserinfo.CameraTime = DateTime.Now; //} /* * 如果老数据,分配状态都按以前的走。 * 如果摄像头进店,顶级和管理员是未分配,其他为自己试算 * 非摄像头进店,顶级是未分配,其他为已分配 * 此处老数据不用考虑,不执行下文的update方法即可 * addbygpj20180828 */ bool distributedRoleType = false; if (request.RenewalType == 3) { distributedRoleType = (roleType == 3 || roleType == 4);//管理员或顶级 insertUserinfo.IsDistributed = distributedRoleType ? 0 : 2; } else { distributedRoleType = roleType == 3;//顶级 insertUserinfo.IsDistributed = distributedRoleType ? 0 : 2; } insertUserinfo.IsSingleLicenseno = 0; //20181009中心要求修改是否单车牌标识 if (string.IsNullOrEmpty(insertUserinfo.CarVIN) || string.IsNullOrEmpty(insertUserinfo.EngineNo)) { insertUserinfo.IsSingleLicenseno = 1; } #region 车店连呼新增userinfo时权限相关特殊操作,bygpj //业务call liuzhenlong,qixinbo,lvshaobo if (request.ZuoXiId > 0) { //新增续保报价选择数据来源时用 20181218 insertUserinfo.zs_zuoxi_id = request.ZuoXiId; } else { //20181126去掉配置//20181127新增的需要加上 //车店连呼特殊配置CLHZuoXiAgentId var strzuoxiagent = ConfigurationManager.AppSettings["CLHZuoXiAgentId"]; if (!string.IsNullOrEmpty(strzuoxiagent)) { string[] reAgent = strzuoxiagent.Split(','); //取配置里的数组,如果匹配上,则将子集代理id赋值给zuoxiid if (Array.IndexOf(reAgent, topAgentId.ToString()) != -1) { insertUserinfo.zs_zuoxi_id = request.Agent; } } } #endregion var buid = infoRepository.Add(insertUserinfo); insertUserinfo.Id = buid; return(insertUserinfo); }
/// <summary> /// 请求报价新增userinfo /// </summary> /// <param name="request"></param> /// <param name="_url"></param> /// <param name="repository"></param> /// <param name="topAgentId"></param> /// <returns></returns> public static long QuoteAdd(PostPrecisePriceRequest request, string _url, IUserInfoRepository repository, int topAgentId = 0) { //如果是直接报价,没有传递车牌号,直接用车架号替换 if (string.IsNullOrWhiteSpace(request.LicenseNo)) { request.LicenseNo = request.CarVin.ToUpper(); } var insertUserinfo = new bx_userinfo { agent_id = request.Agent, top_agent_id = topAgentId, IsLastYear = 0, LastYearSource = -1, Source = request.IntentionCompany, //Mobile = agentModel.Mobile, LicenseNo = request.LicenseNo, Agent = request.Agent.ToString(), //UserId = account.UserId, OpenId = request.CustKey, CityCode = request.CityCode.ToString(), //IsPublic = 0, QuoteStatus = -1, CreateTime = DateTime.Now, IsSingleSubmit = request.IsSingleSubmit, // CarType = request.CarType, // IsNewCar = request.IsNewCar, // CarUsedType = request.CarUsedType, CarVIN = request.CarVin.ToUpper(), MoldName = request.MoldName, RegisterDate = request.RegisterDate, EngineNo = request.EngineNo.ToUpper(), RenewalType = request.RenewalType, // SeatCout = request.SeatCount, // TonCount = request.TonCount, NeedEngineNo = 0, IsDistributed = 0, UpdateTime = DateTime.Now, LatestQuoteTime = DateTime.Now,//20181030跟路航沟通报价前后都改此值,modifyby gpj RenewalStatus = -1, OwnerIdCardType = -1, IsReView = 0, IsTest = 0, RenewalCarType = request.RenewalCarType, IsChangeRelation = 0//修改关系人状态改为0;17/10/23bygpjadd。//提交订单会判断此字段是否为1 }; if (!string.IsNullOrWhiteSpace(request.Mobile)) { insertUserinfo.Mobile = request.Mobile; } //分配逻辑 如果是顶级,为未分配,否则为已分配(即自己试算数据)//modifyby20181119此处以前删除了,现在放开,因为调用crm接口的摄像头分配逻辑废弃了 if (request.RenewalType == 2) { insertUserinfo.IsDistributed = 0; //未分配 } else { if (request.ChildAgent == topAgentId) { insertUserinfo.IsDistributed = 0; //未分配 } else { insertUserinfo.IsDistributed = 2; //已分配 } } //此新车报价,如果有就更新 ,没有直接报价 if (!string.IsNullOrWhiteSpace(request.UpdateLicenseNo)) { insertUserinfo.LicenseNo = request.UpdateLicenseNo; } if (!string.IsNullOrWhiteSpace(request.Email)) { insertUserinfo.Email = request.Email; } //#region 费改地区身份证完善 if (!string.IsNullOrWhiteSpace(request.CarOwnersName)) { //insertUserinfo.UserName = request.CarOwnersName; insertUserinfo.LicenseOwner = request.CarOwnersName; //insertUserinfo.InsuredName = request.CarOwnersName; } if (!string.IsNullOrWhiteSpace(request.IdCard)) { insertUserinfo.IdCard = request.IdCard.ToUpper(); //insertUserinfo.InsuredIdCard = request.IdCard.ToUpper(); //insertUserinfo.InsuredIdType = 1;//小龙端 需要此属性 } //#endregion #region 车主信息 if (!string.IsNullOrWhiteSpace(request.IdCard)) { insertUserinfo.IdCard = request.IdCard; //if (request.IdCard.IsValidIdCard()) //{ // request.OwnerIdCardType = 1; //} if (!string.IsNullOrEmpty(_isAddIdCardBack6) && _isAddIdCardBack6.Equals("1") && string.IsNullOrEmpty(insertUserinfo.SixDigitsAfterIdCard) && !insertUserinfo.IdCard.Contains("*") && insertUserinfo.IdCard.Length > 6) { //原先证件6位不为空&&证件不包含*&&证件长度大于6位 insertUserinfo.SixDigitsAfterIdCard = insertUserinfo.IdCard.Substring(insertUserinfo.IdCard.Length - 6, 6); } } if (request.OwnerIdCardType > 0) { insertUserinfo.OwnerIdCardType = request.OwnerIdCardType; } insertUserinfo.OwnerSex = request.OwnerSex; insertUserinfo.OwnerBirthday = request.OwnerBirthday; insertUserinfo.OwnerIssuer = request.OwnerAuthority; insertUserinfo.OwnerNation = request.OwnerNation; #endregion #region 投保人为空 按照被保人信息保存 var isPosterValid = false || !string.IsNullOrWhiteSpace(request.HolderName) && !string.IsNullOrWhiteSpace(request.HolderIdCard) && request.HolderIdType > 0; var isInsuredValid = false || !string.IsNullOrWhiteSpace(request.InsuredName) && !string.IsNullOrWhiteSpace(request.InsuredIdCard) && request.InsuredIdType > 0; if (!isPosterValid && isInsuredValid) { request.HolderName = request.InsuredName; request.HolderIdCard = request.InsuredIdCard; request.HolderIdType = request.InsuredIdType; } if (!string.IsNullOrWhiteSpace(request.InsuredMobile) && string.IsNullOrWhiteSpace(request.HolderMobile)) { request.HolderMobile = request.InsuredMobile; } if (!string.IsNullOrWhiteSpace(request.InsuredEmail) && string.IsNullOrWhiteSpace(request.HolderEmail)) { request.HolderEmail = request.InsuredEmail; } if (!string.IsNullOrWhiteSpace(request.InsuredAddress) && string.IsNullOrWhiteSpace(request.HolderAddress)) { request.HolderAddress = request.InsuredAddress; } #endregion #region 被保险人信息 if (!string.IsNullOrWhiteSpace(request.InsuredEmail)) { insertUserinfo.InsuredEmail = request.InsuredEmail; } if (!string.IsNullOrWhiteSpace(request.InsuredName)) { insertUserinfo.InsuredName = request.InsuredName.Trim(); } if (!string.IsNullOrWhiteSpace(request.InsuredIdCard)) { insertUserinfo.InsuredIdCard = request.InsuredIdCard.ToUpper(); //if (request.InsuredIdCard.IsValidIdCard()) //{ // request.InsuredIdType = 1; //} } if (!string.IsNullOrWhiteSpace(request.InsuredMobile)) { insertUserinfo.InsuredMobile = request.InsuredMobile.Trim(); } if (request.InsuredIdType != 0) { insertUserinfo.InsuredIdType = request.InsuredIdType; } insertUserinfo.InsuredAddress = request.InsuredAddress; insertUserinfo.InsuredCertiStartdate = request.InsuredCertiStartdate; insertUserinfo.InsuredCertiEnddate = request.InsuredCertiEnddate; insertUserinfo.InsuredSex = request.InsuredSex; insertUserinfo.InsuredBirthday = request.InsuredBirthday; insertUserinfo.InsuredIssuer = request.InsuredAuthority; insertUserinfo.InsuredNation = request.InsuredNation; #endregion #region 投保人信息 if (!string.IsNullOrWhiteSpace(request.HolderEmail)) { insertUserinfo.HolderEmail = request.HolderEmail; } if (!string.IsNullOrWhiteSpace(request.HolderName)) { insertUserinfo.HolderName = request.HolderName.Trim(); } if (!string.IsNullOrWhiteSpace(request.HolderIdCard)) { insertUserinfo.HolderIdCard = request.HolderIdCard.ToUpper(); //if (request.HolderIdCard.IsValidIdCard()) //{ // request.HolderIdType = 1; //} } if (!string.IsNullOrWhiteSpace(request.HolderMobile)) { insertUserinfo.HolderMobile = request.HolderMobile.Trim(); } if (request.HolderIdType != 0) { insertUserinfo.HolderIdType = request.HolderIdType; } insertUserinfo.HolderAddress = request.HolderAddress; insertUserinfo.HolderCertiStartdate = request.HolderCertiStartdate; insertUserinfo.HolderCertiEnddate = request.HolderCertiEnddate; insertUserinfo.HolderSex = request.HolderSex; insertUserinfo.HolderBirthday = request.HolderBirthday; insertUserinfo.HolderIssuer = request.HolderAuthority; insertUserinfo.HolderNation = request.HolderNation; #endregion //此处品牌型号改在外层获取 //if (insertUserinfo.CarVIN.Length > 5) //{ // var frontCarVin = insertUserinfo.CarVIN.Substring(0, 5); // if (!insertUserinfo.CarVIN.StartsWith("L") && insertUserinfo.MoldName.ToUpper().IndexOf(frontCarVin, System.StringComparison.Ordinal) >= 0) // { // using (var client = new HttpClient()) // { // client.BaseAddress = new Uri(_url); // var getUrl = string.Format("api/taipingyang/gettaipycarinfoby?carvin={0}", insertUserinfo.CarVIN); // HttpResponseMessage responseVin = client.GetAsync(getUrl).Result; // var resultVin = responseVin.Content.ReadAsStringAsync().Result; // var carinfo = resultVin.FromJson<WaGetTaiPyCarInfoResponse>(); // if (carinfo != null && carinfo.CarInfo != null) // { // insertUserinfo.MoldName = carinfo.CarInfo.moldName; // } // } // } //} #region 车店连呼新增userinfo时权限相关特殊操作,bygpj //业务call liuzhenlong,qixinbo,lvshaobo if (request.ZuoXiId > 0) { //新增续保报价选择数据来源时用 20181218 insertUserinfo.zs_zuoxi_id = request.ZuoXiId; } else { //20181126去掉配置//20181127只新增赋值zuoxiid //车店连呼特殊配置CLHZuoXiAgentId var strzuoxiagent = ConfigurationManager.AppSettings["CLHZuoXiAgentId"]; if (!string.IsNullOrEmpty(strzuoxiagent)) { string[] reAgent = strzuoxiagent.Split(','); //取配置里的数组,如果匹配上,则将子集代理id赋值给zuoxiid if (Array.IndexOf(reAgent, topAgentId.ToString()) != -1) { insertUserinfo.zs_zuoxi_id = request.Agent; } } } #endregion insertUserinfo.IsSingleLicenseno = 0; //20181009中心要求修改是否单车牌标识 if (string.IsNullOrEmpty(insertUserinfo.CarVIN) || string.IsNullOrEmpty(insertUserinfo.EngineNo)) { insertUserinfo.IsSingleLicenseno = 1; } var id = repository.Add(insertUserinfo); return(id); }