public void Valid_savequoteIsNull_Return0() { #region 配置 Substitute ISaveQuoteRepository _saveQuoteRepository = Substitute.For <ISaveQuoteRepository>(); ISubmitInfoRepository _submitInfoRepository = Substitute.For <ISubmitInfoRepository>(); IQuoteResultRepository _quoteResultRepository = Substitute.For <IQuoteResultRepository>(); IUserInfoRepository _userInfoRepository = Substitute.For <IUserInfoRepository>(); _submitInfoRepository.GetSubmitInfo(Arg.Any <long>(), Arg.Any <int>()).Returns(x => new bx_submit_info()); _quoteResultRepository.GetQuoteResultByBuid(Arg.Any <long>(), Arg.Any <int>()).Returns(x => new bx_quoteresult()); _saveQuoteRepository.GetSavequoteByBuid(Arg.Any <long>()).Returns(x => null); UpdateBjdCheck updateBjdCheck = new UpdateBjdCheck(_saveQuoteRepository, _submitInfoRepository, _quoteResultRepository, _userInfoRepository); #endregion #region 操作 Arg bx_submit_info submitInfo = new bx_submit_info(); bx_quoteresult quoteresult = new bx_quoteresult(); bx_savequote savequote = new bx_savequote(); bx_userinfo userinfo = new bx_userinfo(); var result = updateBjdCheck.Valid(new CreateOrUpdateBjdInfoRequest()); #endregion #region 断言 Assert Assert.AreEqual(0, result.State); #endregion }
public async Task <bx_savequote> GetSavequoteByBuidAsync(long buid) { bx_savequote savequote = new bx_savequote(); try { savequote = DataContextFactory.GetDataContext().bx_savequote.FirstOrDefault(x => x.B_Uid == buid); } catch (Exception ex) { logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(savequote); }
public int Update(bx_savequote savequote) { int count = 0; try { DataContextFactory.GetDataContext().bx_savequote.AddOrUpdate(savequote); count = DataContextFactory.GetDataContext().SaveChanges(); } catch (Exception ex) { logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(count); }
public long Add(bx_savequote savequote) { long count = 0; try { var item = DataContextFactory.GetDataContext().bx_savequote.Add(savequote); var returnResult = DataContextFactory.GetDataContext().SaveChanges(); count = item.Id; } catch (Exception ex) { logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(count); }
public bj_baodanxianzhong MapBaodanxianzhong(bj_baodanxinxi baodanxinxi, bx_quoteresult quoteresult, bx_savequote savequote, bx_submit_info submitInfo, List <bx_ywxdetail> jylist) { var baodanxianzhong = new bj_baodanxianzhong() { BaoDanXinXiId = baodanxinxi.Id, BizTotal = quoteresult.BizTotal.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BizTotal.Value : System.Math.Round((double)quoteresult.BizTotal.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BoLiBaoE = savequote.BoLi, BoLiBaoFei = quoteresult.BoLi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BoLi.Value : System.Math.Round((double)quoteresult.BoLi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianCheSun = quoteresult.BuJiMianCheSun.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianCheSun.Value : System.Math.Round((double)quoteresult.BuJiMianCheSun.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianDaoQiang = quoteresult.BuJiMianDaoQiang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianDaoQiang.Value : System.Math.Round((double)quoteresult.BuJiMianDaoQiang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianFuJian = quoteresult.BuJiMianFuJian.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianFuJian.Value : System.Math.Round((double)quoteresult.BuJiMianFuJian.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianRenYuan = quoteresult.BuJiMianRenYuan.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianRenYuan.Value : System.Math.Round((double)quoteresult.BuJiMianRenYuan.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianSanZhe = quoteresult.BuJiMianSanZhe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSanZhe.Value : System.Math.Round((double)quoteresult.BuJiMianSanZhe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //2.1.5版本修改 新增6个字段 BuJiMianChengKe = quoteresult.BuJiMianChengKe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianChengKe.Value : System.Math.Round((double)quoteresult.BuJiMianChengKe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianSiJi = quoteresult.BuJiMianSiJi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSiJi.Value : System.Math.Round((double)quoteresult.BuJiMianSiJi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianHuaHen = quoteresult.BuJiMianHuaHen.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianHuaHen.Value : System.Math.Round((double)quoteresult.BuJiMianHuaHen.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianSheShui = quoteresult.BuJiMianSheShui.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSheShui.Value : System.Math.Round((double)quoteresult.BuJiMianSheShui.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianZiRan = quoteresult.BuJiMianZiRan.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianZiRan.Value : System.Math.Round((double)quoteresult.BuJiMianZiRan.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianJingShenSunShi = quoteresult.BuJiMianJingShenSunShi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianJingShenSunShi.Value : System.Math.Round((double)quoteresult.BuJiMianJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SanFangTeYueBaoE = savequote.HcSanFangTeYue.HasValue ? savequote.HcSanFangTeYue.Value : 0, SanFangTeYueBaoFei = quoteresult.HcSanFangTeYue.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcSanFangTeYue.Value : System.Math.Round((double)quoteresult.HcSanFangTeYue.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, JingShenSunShiBaoE = savequote.HcJingShenSunShi.HasValue ? savequote.HcJingShenSunShi.Value : 0, JingShenSunShiBaoFei = quoteresult.HcJingShenSunShi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcJingShenSunShi.Value : System.Math.Round((double)quoteresult.HcJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, HuoWuZeRenBaoE = savequote.HcHuoWuZeRen.HasValue ? savequote.HcHuoWuZeRen.Value : 0, HuoWuZeRenBaoFei = quoteresult.HcHuoWuZeRen.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcHuoWuZeRen.Value : System.Math.Round((double)quoteresult.HcHuoWuZeRen.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //设备损失 SheBeiSunShiBaoE = savequote.HcSheBeiSunshi.HasValue ? savequote.HcSheBeiSunshi.Value : 0, SheBeiSunShiBaoFei = quoteresult.HcSheBeiSunshi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcSheBeiSunshi.Value : System.Math.Round((double)quoteresult.HcSheBeiSunshi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //不计免设备损失 BuJiMianSheBeiSunShiBaoE = savequote.BuJiMianSheBeiSunshi.HasValue ? savequote.BuJiMianSheBeiSunshi.Value : 0, BuJiMianSheBeiSunShiBaoFei = quoteresult.BuJiMianSheBeiSunshi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSheBeiSunshi.Value : System.Math.Round((double)quoteresult.BuJiMianSheBeiSunshi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, XiuLiChangBaoE = savequote.HcXiuLiChang, XiuLiChangBaoFei = quoteresult.HcXiuLiChang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcXiuLiChang.Value : System.Math.Round((double)quoteresult.HcXiuLiChang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, FeiYongBuChangBaoE = savequote.HcFeiYongBuChang, FeiYongBuChangBaoFei = quoteresult.HcFeiYongBuChang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcFeiYongBuChang.Value : System.Math.Round((double)quoteresult.HcFeiYongBuChang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //2.1.5修改结束 //费用补偿天数 FybcDays = savequote.FeiYongBuChangDays.HasValue ? savequote.FeiYongBuChangDays.Value : 0, CheDengBaoE = savequote.CheDeng, CheDengBaoFei = quoteresult.CheDeng.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.CheDeng.Value : System.Math.Round((double)quoteresult.CheDeng.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, ChengKeBaoE = savequote.ChengKe, ChengKeBaoFei = quoteresult.ChengKe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.ChengKe.Value : System.Math.Round((double)quoteresult.ChengKe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //CheSunBaoE = savequote.CheSun,//车损保额修改quoteresult CheSunBaoE = quoteresult.CheSunBE.HasValue ? quoteresult.CheSunBE.Value : 0, CheSunBaoFei = quoteresult.CheSun.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.CheSun.Value : System.Math.Round((double)quoteresult.CheSun.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //DaoQiangBaoE = savequote.DaoQiang,//盗抢保额修改quoteresult DaoQiangBaoE = quoteresult.DaoQiangBE.HasValue ? quoteresult.DaoQiangBE : 0, DaoQiangBaoFei = quoteresult.DaoQiang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.DaoQiang.Value : System.Math.Round((double)quoteresult.DaoQiang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, ForceTotal = quoteresult.ForceTotal.HasValue ? quoteresult.ForceTotal.Value : 0, HuaHenBaoE = savequote.HuaHen, HuaHenBaoFei = quoteresult.HuaHen.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HuaHen.Value : System.Math.Round((double)quoteresult.HuaHen.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SanZheBaoE = savequote.SanZhe, SanZheBaoFei = quoteresult.SanZhe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SanZhe.Value : System.Math.Round((double)quoteresult.SanZhe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SheShuiBaoE = savequote.SheShui, SheShuiBaoFei = quoteresult.SheShui.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SheShui.Value : System.Math.Round((double)quoteresult.SheShui.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SiJiBaoE = savequote.SiJi, SiJiBaoFei = quoteresult.SiJi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SiJi.Value : System.Math.Round((double)quoteresult.SiJi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, Source = submitInfo.source, TaxTotal = quoteresult.TaxTotal.HasValue ? quoteresult.TaxTotal.Value : 0, //ZiRanBaoE = savequote.ZiRan,//自燃保额修改quoteresult ZiRanBaoE = quoteresult.ZiRanBE.HasValue ? quoteresult.ZiRanBE.Value : 0, ZiRanBaoFei = quoteresult.ZiRan.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.ZiRan.Value : System.Math.Round((double)quoteresult.ZiRan.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SanZheJieJiaRiBaoE = savequote.SanZheJieJiaRi, SanZheJieJiaRiBaoFei = quoteresult.SanZheJieJiaRi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SanZheJieJiaRi.Value : System.Math.Round((double)quoteresult.SanZheJieJiaRi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, CreateTime = DateTime.Now, JiaoQiang = savequote.JiaoQiang }; #region 计免重新赋值,针对人保3.5代系统不计免赔合并展示的问题 if (baodanxianzhong.Source == 2 && baodanxianzhong.BuJiMianFuJian > 0) { //车损 if (savequote.BuJiMianCheSun > 0 && quoteresult.BuJiMianCheSun == 0) { baodanxianzhong.BuJiMianCheSun = -1; } //盗抢 if (savequote.BuJiMianDaoQiang > 0 && quoteresult.BuJiMianDaoQiang == 0) { baodanxianzhong.BuJiMianDaoQiang = -1; } //人员 if (savequote.BuJiMianRenYuan > 0 && quoteresult.BuJiMianRenYuan == 0) { baodanxianzhong.BuJiMianRenYuan = -1; } //三者 if (savequote.BuJiMianSanZhe > 0 && quoteresult.BuJiMianSanZhe == 0) { baodanxianzhong.BuJiMianSanZhe = -1; } //乘客 if (savequote.BuJiMianChengKe > 0 && quoteresult.BuJiMianChengKe == 0) { baodanxianzhong.BuJiMianChengKe = -1; } //司机 if (savequote.BuJiMianSiJi > 0 && quoteresult.BuJiMianSiJi == 0) { baodanxianzhong.BuJiMianSiJi = -1; } //划痕 if (savequote.BuJiMianHuaHen > 0 && quoteresult.BuJiMianHuaHen == 0) { baodanxianzhong.BuJiMianHuaHen = -1; } //涉水 if (savequote.BuJiMianSheShui > 0 && quoteresult.BuJiMianSheShui == 0) { baodanxianzhong.BuJiMianSheShui = -1; } //自燃 if (savequote.BuJiMianZiRan > 0 && quoteresult.BuJiMianZiRan == 0) { baodanxianzhong.BuJiMianZiRan = -1; } //精神损失 if (savequote.BuJiMianJingShenSunShi > 0 && quoteresult.BuJiMianJingShenSunShi == 0) { baodanxianzhong.BuJiMianJingShenSunShi = -1; } } //设备损失在上文已赋值,此处无需处理 //baodanxianzhong.BuJiMianSheBeiSunShiBaoE #endregion if (jylist != null && jylist.Any()) { jylist = jylist.Where(w => w.source == baodanxianzhong.Source).ToList(); if (jylist != null && jylist.Any()) { baodanxianzhong.JiaYiTotal = jylist.Sum(l => l.amount ?? 0); } } return(baodanxianzhong); }
public bj_baodanxinxi MapBaodanxinxi(CreateOrUpdateBjdInfoRequest request, bx_submit_info submitInfo, bx_quoteresult quoteresult, bx_savequote savequote, bx_userinfo userinfo, bx_quotereq_carinfo reqCarInfo, bx_preferential_activity activity) { var quotecarinfo = _quoteResultCarinfoRepository.Find(request.Buid, SourceGroupAlgorithm.GetOldSource(request.Source)); var lastinfo = _lastInfoRepository.GetByBuid(request.Buid); var listClaim = _userClaimRepository.FindList(request.Buid); int lossBizCount = listClaim.Where(n => n.pay_type == 0).ToList().Count; //商业出险次数 double?lossBizAmount = listClaim.Where(n => n.pay_type == 0).ToList().Sum(n => n.pay_amount); //商业出险金额 int lossForceCount = listClaim.Where(n => n.pay_type == 1).ToList().Count; //交强出险次数 double?lossForceAmount = listClaim.Where(n => n.pay_type == 1).ToList().Sum(n => n.pay_amount); //交强出险金额 var baodanxinxi = new bj_baodanxinxi { //BEGIN 2017-09-06新增字段 20170909L 当前后期修改中去掉了代理人信息(电话等) AgentId = request.ChildAgent == 0 ? int.Parse(userinfo.Agent) : request.ChildAgent, //END //BEGIN 2017-09-09新增字段 //activity_content = request.ActivityContent, activity_ids = activity.id.ToString(), //END // AgentId = int.Parse(userinfo.Agent), BizEndDate = lastinfo == null ? DateTime.MinValue : Convert.ToDateTime(lastinfo.last_business_end_date), //submitinfo.biz_end_time, BizNum = submitInfo.biz_tno, BizPrice = quoteresult.BizTotal.HasValue ? quoteresult.BizTotal.Value : 0, BizRate = double.Parse(submitInfo.biz_rate.HasValue ? submitInfo.biz_rate.Value.ToString() : "0"), BizStartDate = quoteresult.BizStartDate.HasValue ? quoteresult.BizStartDate.Value : (reqCarInfo.biz_start_date.HasValue?reqCarInfo.biz_start_date.Value:DateTime.MinValue),//submitInfo.biz_start_time, CarBrandModel = userinfo.MoldName, CarEngineNo = userinfo.EngineNo, CarLicense = userinfo.LicenseNo, CarOwner = userinfo.LicenseOwner, CarRegisterDate = string.IsNullOrEmpty(userinfo.RegisterDate) ? DateTime.MinValue : DateTime.Parse(userinfo.RegisterDate), CarVIN = userinfo.CarVIN, ChannelId = submitInfo.channel_id, CompanyId = submitInfo.source, CreateTime = DateTime.Now, ForceEndDate = lastinfo == null ? DateTime.MinValue : Convert.ToDateTime(lastinfo.last_end_date), //submitinfo.force_end_time, ForceStartDate = quoteresult.ForceStartDate.HasValue ? quoteresult.ForceStartDate.Value : (reqCarInfo.force_start_date.HasValue ? reqCarInfo.force_start_date.Value : DateTime.MinValue), //submitInfo.force_start_time, ForceNum = submitInfo.force_tno, ForcePrice = (quoteresult.ForceTotal.HasValue ? quoteresult.ForceTotal.Value : 0), ForceRate = double.Parse(submitInfo.force_rate.HasValue ? submitInfo.force_rate.Value.ToString() : "0"), InsuredName = userinfo.InsuredName, InsureIdNum = userinfo.InsuredIdCard, ManualBizRate = request.BizRate, ManualTaxRate = request.TaxRate, ManualForceRate = request.ForceRate, ObjectId = int.Parse(userinfo.Agent), ObjectType = 1, SubmitStatus = submitInfo.submit_status, TaxPrice = quoteresult.TaxTotal.HasValue ? quoteresult.TaxTotal.Value : 0, //新增的4个费率 NonClaimRate = (double)(quoteresult.RateFactor1.HasValue ? quoteresult.RateFactor1 : 0), MultiDiscountRate = (double)(quoteresult.RateFactor2.HasValue ? quoteresult.RateFactor2 : 0), AvgMileRate = (double)(quoteresult.RateFactor3.HasValue ? quoteresult.RateFactor3 : 0), RiskRate = (double)(quoteresult.RateFactor4.HasValue ? quoteresult.RateFactor4 : 0), //总费率系数 TotalRate = (quoteresult.NewRate.HasValue && quoteresult.NewRate != 0) ? quoteresult.NewRate.Value.ToString() : (quoteresult.TotalRate.HasValue ? quoteresult.TotalRate.Value.ToString() : "0"), //20170221新增增值税 AddValueTaxRate = request.AddValueTaxRate, //载客//+载质量 CarSeated = quotecarinfo != null ? (quotecarinfo.seat_count.HasValue ? quotecarinfo.seat_count.Value.ToString() : "0") : "0", //+ "/" + (quotecarinfo.car_equ_quality.HasValue ? quotecarinfo.car_equ_quality.Value.ToString() : "0") VehicleInfo = VehicleInfoMapper.VehicleInfoMethod(quotecarinfo), JqVehicleClaimType = quotecarinfo != null ? quotecarinfo.JqVehicleClaimType : "", SyVehicleClaimType = quotecarinfo != null ? quotecarinfo.SyVehicleClaimType : "", loss_biz_count = lossBizCount, loss_biz_amount = lossBizAmount.HasValue ? lossBizAmount.Value : 0, loss_force_count = lossForceCount, loss_force_amount = lossForceAmount.HasValue ? lossForceAmount.Value : 0 }; return(baodanxinxi); }
public Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> > GetModels(long buid, long groupspan) { List <bx_quote_history> listhistory = _quoteHistoryRepository.GetByBuid(buid, groupspan); List <int> listquote = new List <int>(); //未取到历史记录默认赋值为空 if (!listhistory.Any()) { return(new Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> >(null, null, null, null, "", listquote)); } try { listquote = listhistory.Select(l => l.source.Value).ToList();//老的source值 //取到历史记录开始循环 bx_savequote savequote = new bx_savequote(); bx_quotereq_carinfo quotereq = new bx_quotereq_carinfo(); List <bx_quoteresult> listquoteresult = new List <bx_quoteresult>(); bx_quoteresult quoteresult = new bx_quoteresult(); List <bx_submit_info> listsubmitinfo = new List <bx_submit_info>(); bx_submit_info submitinfo = new bx_submit_info(); //险种信息 string strsavequote = listhistory.FirstOrDefault().savequote; savequote = !string.IsNullOrEmpty(strsavequote) && !strsavequote.Equals("null") ? strsavequote.FromJson <bx_savequote>() : null; //请求车辆信息 string strquotereq = listhistory.FirstOrDefault().quotereq; quotereq = !string.IsNullOrEmpty(strquotereq) && !strquotereq.Equals("null") ? strquotereq.FromJson <bx_quotereq_carinfo>() : null; //保费结果 string strquoteresult = string.Empty; //报价结果 string strsubmitinfo = string.Empty; foreach (var history in listhistory) { //保费结果 strquoteresult = history.quoteresult; if (!string.IsNullOrEmpty(strquoteresult) && !strquoteresult.Equals("null")) { quoteresult = new bx_quoteresult(); quoteresult = strquoteresult.FromJson <bx_quoteresult>(); if (quoteresult != null) { listquoteresult.Add(quoteresult); } } //报价结果 strsubmitinfo = history.submitinfo; if (!string.IsNullOrEmpty(strsubmitinfo) && !strsubmitinfo.Equals("null")) { submitinfo = new bx_submit_info(); submitinfo = strsubmitinfo.FromJson <bx_submit_info>(); if (submitinfo != null) { listsubmitinfo.Add(submitinfo); } } } string createtime = listhistory.FirstOrDefault().updatetime.HasValue ? listhistory.FirstOrDefault().updatetime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; return(new Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> >(savequote, quotereq, listquoteresult, listsubmitinfo, createtime, listquote)); } catch (Exception ex) { logErr.Info(string.Format("报价历史解析出错,buid:{0};groupspan:{1};\n异常信息:{2}\n{3}", buid, groupspan, ex.StackTrace, ex.Message)); } return(new Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> >(null, null, null, null, null, listquote)); }
public BaojiaItemViewModel ConvertToViewModel(GetBjdItemResponse bjdItemResponse) { bj_baodanxinxi xinxi = bjdItemResponse.Baodanxinxi; bj_baodanxianzhong xianzhong = bjdItemResponse.Baodanxianzhong; List <bx_claim_detail> claimDetail = bjdItemResponse.ClaimDetail; bx_savequote savequote = bjdItemResponse.Savequote; AgentViewModelByBJ AgentDetail = bjdItemResponse.AgentDetail; List <bx_preferential_activity> Activitys = bjdItemResponse.Activitys; var item = new BaojiaItemViewModel(); #region BaoJiaInfo item.BaoJiaInfo = new BaojiaInfoViewModel { CarOwner = xinxi.CarOwner, BizStartDate = xinxi.BizStartDate.ToString(), ForceStartDate = xinxi.ForceStartDate.ToString(), CarBrandModel = xinxi.CarBrandModel, CarLicense = xinxi.CarLicense, CompanyId = xinxi.CompanyId.HasValue ? SourceGroupAlgorithm.GetNewSource(xinxi.CompanyId.Value) : 0, // CompanyName = xinxi., ChannelId = xinxi.ChannelId.HasValue ? xinxi.ChannelId.Value : 0, InsureIdType = xinxi.InsureIdType, InsureIdNum = xinxi.InsureIdNum, //新增的4个费率 NonClaimRate = xinxi.NonClaimRate.HasValue ? xinxi.NonClaimRate.Value : 0, MultiDiscountRate = xinxi.MultiDiscountRate.HasValue ? xinxi.MultiDiscountRate.Value : 0, AvgMileRate = xinxi.AvgMileRate.HasValue ? xinxi.AvgMileRate.Value : 0, RiskRate = xinxi.RiskRate.HasValue ? xinxi.RiskRate.Value : 0, BizNum = xinxi.BizNum, ForceNum = xinxi.ForceNum, //座位数 CarSeat = xinxi.CarSeated, VehicleInfo = xinxi.VehicleInfo, JqVehicleClaimType = xinxi.JqVehicleClaimType, SyVehicleClaimType = xinxi.SyVehicleClaimType, LastBizEndDate = xinxi.BizEndDate.HasValue ? xinxi.BizEndDate.Value.Date == DateTime.MinValue.Date ? "" : xinxi.BizEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", LastForceEndDate = xinxi.ForceEndDate.HasValue ? xinxi.ForceEndDate.Value.Date == DateTime.MinValue.Date ? "" : xinxi.ForceEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", ActivityContent = string.IsNullOrEmpty(xinxi.activity_content) ? "" : xinxi.activity_content }; if (!string.IsNullOrEmpty(xinxi.TotalRate)) { item.BaoJiaInfo.TotalRate = xinxi.TotalRate; } else { item.BaoJiaInfo.TotalRate = (item.BaoJiaInfo.NonClaimRate * item.BaoJiaInfo.MultiDiscountRate * item.BaoJiaInfo.AvgMileRate * item.BaoJiaInfo.RiskRate).ToString("f4"); } #endregion #region XianZhongInfo item.XianZhongInfo = new BaoxianXianZhongViewModel { //BizRate = xinxi.BizRate.HasValue ? xinxi.BizRate.Value : 0, //ForceRate = xinxi.ForceRate.HasValue?xinxi.ForceRate.Value:0, BizRate = xinxi.ManualBizRate.HasValue ? xinxi.ManualBizRate.Value : 0, ForceRate = xinxi.ManualForceRate.HasValue ? xinxi.ManualForceRate.Value : 0, //20170221新增增值税 AddValueTaxRate = xinxi.AddValueTaxRate.HasValue ? xinxi.AddValueTaxRate.Value : 0, BizTotal = xianzhong.BizTotal.HasValue ? xianzhong.BizTotal.Value : 0, BoLi = new XianZhongUnit { BaoE = xianzhong.BoLiBaoE.HasValue ? xianzhong.BoLiBaoE.Value : 0, BaoFei = xianzhong.BoLiBaoFei.HasValue ? xianzhong.BoLiBaoFei.Value : 0 }, BuJiMianCheSun = new XianZhongUnit { BaoE = (xianzhong.BuJiMianCheSun.HasValue ? xianzhong.BuJiMianCheSun.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianCheSun.HasValue ? xianzhong.BuJiMianCheSun.Value : 0 }, //BuJiMianCheSun = xianzhong.BuJiMianCheSun.HasValue ? xianzhong.BuJiMianCheSun.Value : 0, BuJiMianDaoQiang = new XianZhongUnit { BaoE = (xianzhong.BuJiMianDaoQiang.HasValue ? xianzhong.BuJiMianDaoQiang.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianDaoQiang.HasValue ? xianzhong.BuJiMianDaoQiang.Value : 0 }, //BuJiMianDaoQiang = xianzhong.BuJiMianDaoQiang.HasValue ? xianzhong.BuJiMianDaoQiang.Value : 0, BuJiMianFuJia = new XianZhongUnit { BaoE = (xianzhong.BuJiMianFuJian.HasValue ? xianzhong.BuJiMianFuJian.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianFuJian.HasValue ? xianzhong.BuJiMianFuJian.Value : 0 }, //BuJiMianFuJia = xianzhong.BuJiMianFuJian.HasValue ? xianzhong.BuJiMianFuJian.Value : 0, BuJiMianRenYuan = new XianZhongUnit { BaoE = (xianzhong.BuJiMianRenYuan.HasValue ? xianzhong.BuJiMianRenYuan.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianRenYuan.HasValue ? xianzhong.BuJiMianRenYuan.Value : 0 }, //BuJiMianRenYuan = xianzhong.BuJiMianRenYuan.HasValue ? xianzhong.BuJiMianRenYuan.Value : 0, BuJiMianSanZhe = new XianZhongUnit { BaoE = (xianzhong.BuJiMianSanZhe.HasValue ? xianzhong.BuJiMianSanZhe.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianSanZhe.HasValue ? xianzhong.BuJiMianSanZhe.Value : 0 }, //BuJiMianSanZhe = xianzhong.BuJiMianSanZhe.HasValue ? xianzhong.BuJiMianSanZhe.Value : 0, CheDeng = new XianZhongUnit { BaoE = xianzhong.CheDengBaoE.HasValue ? xianzhong.CheDengBaoE.Value : 0, BaoFei = xianzhong.CheDengBaoFei.HasValue ? xianzhong.CheDengBaoFei.Value : 0 }, ChengKe = new XianZhongUnit { BaoE = xianzhong.ChengKeBaoE.HasValue ? xianzhong.ChengKeBaoE.Value : 0, BaoFei = xianzhong.ChengKeBaoFei.HasValue ? xianzhong.ChengKeBaoFei.Value : 0 }, ChengKeBaoENum = xianzhong.ChengKeBaoENum.HasValue ? xianzhong.ChengKeBaoENum.Value : 0, CheSun = new XianZhongUnit { BaoE = xianzhong.CheSunBaoE.HasValue ? xianzhong.CheSunBaoE.Value : 0, BaoFei = xianzhong.CheSunBaoFei.HasValue ? xianzhong.CheSunBaoFei.Value : 0 }, DaoQiang = new XianZhongUnit { BaoE = xianzhong.DaoQiangBaoE.HasValue ? xianzhong.DaoQiangBaoE.Value : 0, BaoFei = xianzhong.DaoQiangBaoFei.HasValue ? xianzhong.DaoQiangBaoFei.Value : 0 }, ForceTotal = xianzhong.ForceTotal.HasValue ? xianzhong.ForceTotal.Value : 0, HuaHen = new XianZhongUnit { BaoE = xianzhong.HuaHenBaoE.HasValue ? xianzhong.HuaHenBaoE.Value : 0, BaoFei = xianzhong.HuaHenBaoFei.HasValue ? xianzhong.HuaHenBaoFei.Value : 0 }, SanZhe = new XianZhongUnit { BaoE = xianzhong.SanZheBaoE.HasValue ? xianzhong.SanZheBaoE.Value : 0, BaoFei = xianzhong.SanZheBaoFei.HasValue ? xianzhong.SanZheBaoFei.Value : 0 }, SheShui = new XianZhongUnit { BaoE = xianzhong.SheShuiBaoE.HasValue ? xianzhong.SheShuiBaoE.Value : 0, BaoFei = xianzhong.SheShuiBaoFei.HasValue ? xianzhong.SheShuiBaoFei.Value : 0 }, SiJi = new XianZhongUnit { BaoE = xianzhong.SiJiBaoE.HasValue ? xianzhong.SiJiBaoE.Value : 0, BaoFei = xianzhong.SiJiBaoFei.HasValue ? xianzhong.SiJiBaoFei.Value : 0, }, TaxTotal = xianzhong.TaxTotal.HasValue ? xianzhong.TaxTotal.Value : 0, TeYue = new XianZhongUnit { BaoE = xianzhong.TeYueBaoE.HasValue ? xianzhong.TeYueBaoE.Value : 0, BaoFei = xianzhong.TeYueBaoFei.HasValue ? xianzhong.TeYueBaoFei.Value : 0 }, ZiRan = new XianZhongUnit { BaoE = xianzhong.ZiRanBaoE.HasValue ? xianzhong.ZiRanBaoE.Value : 0, BaoFei = xianzhong.ZiRanBaoFei.HasValue ? xianzhong.ZiRanBaoFei.Value : 0 }, //2.1.5版本修改 新增6个字段 BuJiMianChengKe = new XianZhongUnit { BaoE = (xianzhong.BuJiMianChengKe.HasValue ? xianzhong.BuJiMianChengKe.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianChengKe.HasValue ? xianzhong.BuJiMianChengKe.Value : 0 }, BuJiMianSiJi = new XianZhongUnit { BaoE = (xianzhong.BuJiMianSiJi.HasValue ? xianzhong.BuJiMianSiJi.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianSiJi.HasValue ? xianzhong.BuJiMianSiJi.Value : 0 }, BuJiMianHuaHen = new XianZhongUnit { BaoE = (xianzhong.BuJiMianHuaHen.HasValue ? xianzhong.BuJiMianHuaHen.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianHuaHen.HasValue ? xianzhong.BuJiMianHuaHen.Value : 0 }, BuJiMianSheShui = new XianZhongUnit { BaoE = (xianzhong.BuJiMianSheShui.HasValue ? xianzhong.BuJiMianSheShui.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianSheShui.HasValue ? xianzhong.BuJiMianSheShui.Value : 0 }, BuJiMianZiRan = new XianZhongUnit { BaoE = (xianzhong.BuJiMianZiRan.HasValue ? xianzhong.BuJiMianZiRan.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianZiRan.HasValue ? xianzhong.BuJiMianZiRan.Value : 0 }, BuJiMianJingShenSunShi = new XianZhongUnit { BaoE = (xianzhong.BuJiMianJingShenSunShi.HasValue ? xianzhong.BuJiMianJingShenSunShi.Value : 0) > 0 ? 1 : 0, BaoFei = xianzhong.BuJiMianJingShenSunShi.HasValue ? xianzhong.BuJiMianJingShenSunShi.Value : 0 }, SanFangTeYue = new XianZhongUnit { BaoE = xianzhong.SanFangTeYueBaoE.HasValue ? xianzhong.SanFangTeYueBaoE.Value : 0, BaoFei = xianzhong.SanFangTeYueBaoFei.HasValue ? xianzhong.SanFangTeYueBaoFei.Value : 0 }, JingShenSunShi = new XianZhongUnit { BaoE = xianzhong.JingShenSunShiBaoE.HasValue ? xianzhong.JingShenSunShiBaoE.Value : 0, BaoFei = xianzhong.JingShenSunShiBaoFei.HasValue ? xianzhong.JingShenSunShiBaoFei.Value : 0 }, HuoWuZeRen = new XianZhongUnit { BaoE = xianzhong.HuoWuZeRenBaoE.HasValue ? xianzhong.HuoWuZeRenBaoE.Value : 0, BaoFei = xianzhong.HuoWuZeRenBaoFei.HasValue ? xianzhong.HuoWuZeRenBaoFei.Value : 0 }, SheBeiSunShi = new XianZhongUnit { BaoE = xianzhong.SheBeiSunShiBaoE.HasValue ? xianzhong.SheBeiSunShiBaoE.Value : 0, BaoFei = xianzhong.SheBeiSunShiBaoFei.HasValue ? xianzhong.SheBeiSunShiBaoFei.Value : 0 }, BuJiMianSheBeiSunShi = new XianZhongUnit { BaoE = xianzhong.BuJiMianSheBeiSunShiBaoE.HasValue ? xianzhong.BuJiMianSheBeiSunShiBaoE.Value : 0, BaoFei = xianzhong.BuJiMianSheBeiSunShiBaoFei.HasValue ? xianzhong.BuJiMianSheBeiSunShiBaoFei.Value : 0 }, XiuLiChang = new XianZhongUnit { BaoE = xianzhong.XiuLiChangBaoE.HasValue ? xianzhong.XiuLiChangBaoE.Value : 0, BaoFei = xianzhong.XiuLiChangBaoFei.HasValue ? xianzhong.XiuLiChangBaoFei.Value : 0 }, FeiYongBuChang = new XianZhongUnit { BaoE = xianzhong.FeiYongBuChangBaoE.HasValue ? xianzhong.FeiYongBuChangBaoE.Value : 0, BaoFei = xianzhong.FeiYongBuChangBaoFei.HasValue ? xianzhong.FeiYongBuChangBaoFei.Value : 0 }, SanZheJieJiaRi = new XianZhongUnit { BaoE = xianzhong.SanZheJieJiaRiBaoE.HasValue ? xianzhong.SanZheJieJiaRiBaoE.Value : 0, BaoFei = xianzhong.SanZheJieJiaRiBaoFei.HasValue ? xianzhong.SanZheJieJiaRiBaoFei.Value : 0 }, FybcDays = xianzhong.FybcDays.HasValue ? xianzhong.FybcDays.Value : 0, //2.1.5修改 结束 JiaYiTotal = xianzhong.JiaYiTotal ?? 0 }; #endregion #region 业务员信息 2017-09-06 item.AgentDetail = new AgentViewModelByBJ { AgentId = xinxi.AgentId ?? 0 }; #endregion #region 优惠活动信息 2017-09-06 if (Activitys != null) { item.ActivityCount = Activitys.Count; #region ActivityDetail List <PreActivity> list = new List <PreActivity>(); PreActivity Activitydetail; foreach (var i in Activitys) { Activitydetail = new PreActivity(); Activitydetail.ActivityName = i.activity_name; Activitydetail.ActivityContent = i.activity_content; list.Add(Activitydetail); } item.Activitys = list; #endregion } #endregion #region 出险信息 item.ClaimInfo = new ClaimInfo { LossBizCount = xinxi.loss_biz_count, LossBizAmount = String.Format("{0:F}", xinxi.loss_biz_amount), LossForceCount = xinxi.loss_force_count, LossForceAmount = String.Format("{0:F}", xinxi.loss_force_amount) }; #endregion if (savequote != null) { item.XianZhongInfo.XiuLiChangType = savequote.HcXiuLiChangType ?? -1; } if (claimDetail != null) { item.ClaimCount = claimDetail.Count; #region ClaimDetail List <ClaimDetailViewModel> list = new List <ClaimDetailViewModel>(); ClaimDetailViewModel detail; foreach (var i in claimDetail) { detail = new ClaimDetailViewModel(); detail.Buid = i.b_uid; detail.CreateTime = i.create_time; detail.StrCreateTime = i.create_time.HasValue ? i.create_time.Value.ToString("yyyy-MM-dd") : ""; detail.EndCaseTime = i.endcase_time; detail.StrEndCaseTime = i.endcase_time.HasValue ? i.endcase_time.Value.ToString("yyyy-MM-dd") : ""; detail.Id = i.id; detail.Liid = i.li_id; detail.LossTime = i.loss_time; detail.StrLossTime = i.loss_time.HasValue ? i.loss_time.Value.ToString("yyyy-MM-dd") : ""; detail.PayAmount = i.pay_amount; detail.PayCompanyName = i.pay_company_name; detail.PayCompanyNo = i.pay_company_no; list.Add(detail); } item.ClaimDetail = list; #endregion } return(item); }
public static OrderDetailResponse ConverToViewModel(this OrderCacheResponse orderModel) { OrderDetailResponse orderDetail = new OrderDetailResponse(); #region 实例化 //新实例start var carOrder = new CarOrder(); var userInfo = new UserInfo(); var claimDetails = new List <ClaimDetail>(); var precisePrice = new PrecisePrice(); //新实例end //原有实例start bx_car_order bxCarOrder = orderModel.BxCarOrder; bx_userinfo bxUserInfo = orderModel.BxUserInfo; bx_quoteresult bxQuoteResult = orderModel.BxQuoteResult; bx_savequote bxSaveQuote = orderModel.BxSaveQuote; bx_submit_info bxSubmitInfo = orderModel.BxSubmitInfo; bx_lastinfo bxLastInfo = orderModel.BxLastInfo; bx_quoteresult_carinfo bxCarInfo = orderModel.BxCarInfo; List <bx_claim_detail> bxClaimDetails = orderModel.BxClaimDetails; InsuranceStartDate qrStartDate = orderModel.QrStartDate; //原有实例end #endregion #region CarOrder转换 if (bxCarOrder != null) { carOrder.AgentName = string.Empty; carOrder.AgentMobile = string.Empty; if (bxCarOrder.cur_agent.HasValue) { carOrder.Agent = bxCarOrder.cur_agent.Value; //调用代理人列表 IAgentRepository agentRepository = new AgentRepository(); var curAgent = agentRepository.GetAgent(bxCarOrder.cur_agent.Value); if (curAgent != null) { carOrder.AgentName = curAgent.AgentName; carOrder.AgentMobile = curAgent.Mobile; } } carOrder.OpenId = bxCarOrder.openid; carOrder.Mobile = bxCarOrder.mobile; carOrder.ContactsName = bxCarOrder.contacts_name; carOrder.OrderStatus = bxCarOrder.order_status.HasValue ? bxCarOrder.order_status.Value : 0; carOrder.GetOrderTime = bxCarOrder.GetOrderTime.ToString(); carOrder.CreateTime = bxCarOrder.create_time.ToString(); carOrder.OrderId = bxCarOrder.id; carOrder.Buid = bxCarOrder.buid.HasValue ? bxCarOrder.buid.Value : 0; carOrder.Source = bxCarOrder.source.HasValue ? bxCarOrder.source.Value : 0; carOrder.Source = SourceGroupAlgorithm.GetNewSource((int)carOrder.Source); carOrder.InsuredName = bxCarOrder.insured_name; carOrder.IdType = bxCarOrder.id_type.HasValue ? bxCarOrder.id_type.Value : 2; //默认空时,赋值个“其他” carOrder.IdNum = bxCarOrder.id_num; carOrder.IdImgFirst = bxCarOrder.id_img_firs; carOrder.IdImgSecond = bxCarOrder.id_img_secd; carOrder.ImageUrls = bxCarOrder.imageUrls; carOrder.ProvinceName = string.Empty; carOrder.CityName = string.Empty; carOrder.AreaName = string.Empty; carOrder.DistributionAddress = bxCarOrder.distribution_address; carOrder.DistributionName = bxCarOrder.distribution_name; carOrder.DistributionPhone = bxCarOrder.distribution_phone; carOrder.DistributionTime = bxCarOrder.distribution_time.HasValue ? bxCarOrder.distribution_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty; carOrder.InsurancePrice = bxCarOrder.insurance_price.HasValue ? (double)bxCarOrder.insurance_price.Value : 0; carOrder.CarriagePrice = bxCarOrder.carriage_price.HasValue ? (double)bxCarOrder.carriage_price.Value : 0; carOrder.TotalPrice = bxCarOrder.total_price.HasValue ? (double)bxCarOrder.total_price.Value : 0; carOrder.Receipt = bxCarOrder.receipt_title; carOrder.ReceiptHead = bxCarOrder.receipt_head.HasValue ? bxCarOrder.receipt_head.Value : 0; carOrder.PayType = bxCarOrder.pay_type.HasValue ? bxCarOrder.pay_type.Value : 0; carOrder.DistributionType = bxCarOrder.distribution_type.HasValue ? bxCarOrder.distribution_type.Value : 0; } #endregion #region UserInfo转换 if (bxUserInfo != null) { userInfo.LicenseNo = bxUserInfo.LicenseNo; userInfo.LicenseOwner = bxUserInfo.LicenseOwner; userInfo.IdType = bxUserInfo.OwnerIdCardType; //默认空时,赋值个“其他” userInfo.InsuredName = bxUserInfo.InsuredName; userInfo.InsuredMobile = bxUserInfo.InsuredMobile; userInfo.InsuredAddress = bxUserInfo.InsuredAddress; userInfo.InsuredIdType = bxUserInfo.InsuredIdType.HasValue ? bxUserInfo.InsuredIdType.Value : 6; //默认空时,赋值个“其他” userInfo.CredentislasNum = bxUserInfo.InsuredIdCard; userInfo.Email = bxUserInfo.Email; userInfo.CityCode = !string.IsNullOrEmpty(bxUserInfo.CityCode) ? int.Parse(bxUserInfo.CityCode) : 0; //CarUsedType如下 userInfo.EngineNo = bxUserInfo.EngineNo; userInfo.CarVin = bxUserInfo.CarVIN; //PurchasePrice如下 //SeatCount如下 userInfo.ModleName = bxUserInfo.MoldName; userInfo.RegisterDate = bxUserInfo.RegisterDate; //LastEndDate如下 //LastBusinessEndDdate如下 //ForceStartDate如下 //BizStartDate如下 //ClaimCount如下 } #endregion #region QuoteResultCarInfo转换 if (bxCarInfo != null) { userInfo.CarUsedType = bxCarInfo.car_used_type.HasValue ? bxCarInfo.car_used_type.Value : 0; userInfo.PurchasePrice = bxCarInfo.purchase_price.HasValue ? (double)bxCarInfo.purchase_price.Value : 0; userInfo.SeatCount = bxCarInfo.seat_count.HasValue ? bxCarInfo.seat_count.Value : 0; } #endregion #region ClaimDetails转换 if (bxClaimDetails != null) { userInfo.ClaimCount = bxClaimDetails.Count; var claim = new ClaimDetail(); var claimDetail = new bx_claim_detail(); for (int i = 0; i < userInfo.ClaimCount; i++) { claim = new ClaimDetail(); claimDetail = new bx_claim_detail(); claimDetail = bxClaimDetails[i]; claim.EndcaseTime = claimDetail.endcase_time.HasValue ? claimDetail.endcase_time.Value.ToString() : string.Empty; claim.LossTime = claimDetail.loss_time.HasValue ? claimDetail.loss_time.Value.ToString() : string.Empty; claim.PayAmount = claimDetail.pay_amount.HasValue ? claimDetail.pay_amount.Value : 0; claim.PayCompanyName = claimDetail.pay_company_name; claimDetails.Add(claim); } } #endregion #region SaveQuote、QuoteResult、SubmitInfo转换 if (bxSaveQuote != null) { bool isquoteresult = true; if (bxQuoteResult == null) { isquoteresult = false; bxQuoteResult = new bx_quoteresult(); } precisePrice.BizTotal = bxQuoteResult.BizTotal.HasValue ? bxQuoteResult.BizTotal.Value : 0; precisePrice.ForceTotal = bxQuoteResult.ForceTotal ?? 0; precisePrice.TaxTotal = bxQuoteResult.TaxTotal ?? 0; precisePrice.Source = bxQuoteResult.Source ?? 0; precisePrice.Source = SourceGroupAlgorithm.GetNewSource((int)precisePrice.Source); precisePrice.JiaoQiang = bxSaveQuote.JiaoQiang.HasValue ? bxSaveQuote.JiaoQiang.Value : 1; if (bxSubmitInfo != null) { precisePrice.QuoteStatus = bxSubmitInfo.quote_status.HasValue ? bxSubmitInfo.quote_status.Value : 0; precisePrice.QuoteResult = bxSubmitInfo.quote_result; precisePrice.SubmitStatus = bxSubmitInfo.submit_status.HasValue ? bxSubmitInfo.submit_status.Value : 0; precisePrice.SubmitResult = bxSubmitInfo.submit_result; precisePrice.BizTno = bxSubmitInfo.biz_tno; precisePrice.ForceTno = bxSubmitInfo.force_pno; precisePrice.BizSysRate = bxSubmitInfo.biz_rate.HasValue ? (double)bxSubmitInfo.biz_rate.Value : 0; precisePrice.ForceSysRate = bxSubmitInfo.force_rate.HasValue ? (double)bxSubmitInfo.force_rate.Value : 0; //BenefitRate } precisePrice.CheSun = new XianZhongUnit { BaoE = isquoteresult ? (bxQuoteResult.CheSunBE.HasValue ? bxQuoteResult.CheSunBE.Value : 0) : (bxSaveQuote.CheSun.HasValue ? bxSaveQuote.CheSun.Value : 0), BaoFei = bxQuoteResult.CheSun.HasValue ? bxQuoteResult.CheSun.Value : 0 }; precisePrice.SanZhe = new XianZhongUnit { BaoE = bxSaveQuote.SanZhe.HasValue ? bxSaveQuote.SanZhe.Value : 0, BaoFei = bxQuoteResult.SanZhe.HasValue ? bxQuoteResult.SanZhe.Value : 0 }; precisePrice.DaoQiang = new XianZhongUnit { BaoE = isquoteresult ? (bxQuoteResult.DaoQiangBE.HasValue ? bxQuoteResult.DaoQiangBE.Value : 0) : (bxSaveQuote.DaoQiang.HasValue ? bxSaveQuote.DaoQiang.Value : 0), BaoFei = bxQuoteResult.DaoQiang.HasValue ? bxQuoteResult.DaoQiang.Value : 0 }; precisePrice.SiJi = new XianZhongUnit { BaoE = bxSaveQuote.SiJi.HasValue ? bxSaveQuote.SiJi.Value : 0, BaoFei = bxQuoteResult.SiJi.HasValue ? bxQuoteResult.SiJi.Value : 0 }; precisePrice.ChengKe = new XianZhongUnit { BaoE = bxSaveQuote.ChengKe.HasValue ? bxSaveQuote.ChengKe.Value : 0, BaoFei = bxQuoteResult.ChengKe.HasValue ? bxQuoteResult.ChengKe.Value : 0 }; precisePrice.BoLi = new XianZhongUnit { BaoE = bxSaveQuote.BoLi.HasValue ? bxSaveQuote.BoLi.Value : 0, BaoFei = bxQuoteResult.BoLi.HasValue ? bxQuoteResult.BoLi.Value : 0 }; precisePrice.HuaHen = new XianZhongUnit { BaoE = bxSaveQuote.HuaHen.HasValue ? bxSaveQuote.HuaHen.Value : 0, BaoFei = bxQuoteResult.HuaHen.HasValue ? bxQuoteResult.HuaHen.Value : 0 }; precisePrice.BuJiMianCheSun = new XianZhongUnit { BaoE = bxSaveQuote.BuJiMianCheSun.HasValue ? bxSaveQuote.BuJiMianCheSun.Value : 0, BaoFei = bxQuoteResult.BuJiMianCheSun.HasValue ? bxQuoteResult.BuJiMianCheSun.Value : 0 }; precisePrice.BuJiMianSanZhe = new XianZhongUnit { BaoE = bxSaveQuote.BuJiMianSanZhe.HasValue ? bxSaveQuote.BuJiMianSanZhe.Value : 0, BaoFei = bxQuoteResult.BuJiMianSanZhe.HasValue ? bxQuoteResult.BuJiMianSanZhe.Value : 0 }; precisePrice.BuJiMianDaoQiang = new XianZhongUnit { BaoE = bxSaveQuote.BuJiMianDaoQiang.HasValue ? bxSaveQuote.BuJiMianDaoQiang.Value : 0, BaoFei = bxQuoteResult.BuJiMianDaoQiang.HasValue ? bxQuoteResult.BuJiMianDaoQiang.Value : 0 }; precisePrice.BuJiMianChengKe = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianChengKe.HasValue ? bxSaveQuote.BuJiMianChengKe.Value : 0, BaoFei = bxQuoteResult.BuJiMianChengKe.HasValue ? bxQuoteResult.BuJiMianChengKe.Value : 0 }; precisePrice.BuJiMianSiJi = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianSiJi.HasValue ? bxSaveQuote.BuJiMianSiJi.Value : 0, BaoFei = bxQuoteResult.BuJiMianSiJi.HasValue ? bxQuoteResult.BuJiMianSiJi.Value : 0 }; precisePrice.BuJiMianHuaHen = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianHuaHen.HasValue ? bxSaveQuote.BuJiMianHuaHen.Value : 0, BaoFei = bxQuoteResult.BuJiMianHuaHen.HasValue ? bxQuoteResult.BuJiMianHuaHen.Value : 0 }; precisePrice.BuJiMianSheShui = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianSheShui.HasValue ? bxSaveQuote.BuJiMianSheShui.Value : 0, BaoFei = bxQuoteResult.BuJiMianSheShui.HasValue ? bxQuoteResult.BuJiMianSheShui.Value : 0 }; precisePrice.BuJiMianZiRan = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianZiRan.HasValue ? bxSaveQuote.BuJiMianZiRan.Value : 0, BaoFei = bxQuoteResult.BuJiMianZiRan.HasValue ? bxQuoteResult.BuJiMianZiRan.Value : 0 }; precisePrice.BuJiMianJingShenSunShi = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianJingShenSunShi.HasValue ? bxSaveQuote.BuJiMianJingShenSunShi.Value : 0, BaoFei = bxQuoteResult.BuJiMianJingShenSunShi.HasValue ? bxQuoteResult.BuJiMianJingShenSunShi.Value : 0 }; precisePrice.SheShui = new XianZhongUnit { BaoE = bxSaveQuote.SheShui.HasValue ? bxSaveQuote.SheShui.Value : 0, BaoFei = bxQuoteResult.SheShui.HasValue ? bxQuoteResult.SheShui.Value : 0 }; precisePrice.ZiRan = new XianZhongUnit { BaoE = isquoteresult ? (bxQuoteResult.ZiRanBE.HasValue ? bxQuoteResult.ZiRanBE.Value : 0) : (bxSaveQuote.ZiRan.HasValue ? bxSaveQuote.ZiRan.Value : 0), BaoFei = bxQuoteResult.ZiRan.HasValue ? bxQuoteResult.ZiRan.Value : 0 }; precisePrice.HcSheBeiSunshi = new XianZhongUnit { BaoE = bxSaveQuote.HcSheBeiSunshi.HasValue ? bxSaveQuote.HcSheBeiSunshi.Value : 0, BaoFei = bxQuoteResult.HcSheBeiSunshi.HasValue ? bxQuoteResult.HcSheBeiSunshi.Value : 0 }; precisePrice.HcHuoWuZeRen = new XianZhongUnit { BaoE = bxSaveQuote.HcHuoWuZeRen.HasValue ? bxSaveQuote.HcHuoWuZeRen.Value : 0, BaoFei = bxQuoteResult.HcHuoWuZeRen.HasValue ? bxQuoteResult.HcHuoWuZeRen.Value : 0 }; precisePrice.HcFeiYongBuChang = new XianZhongUnit { BaoE = bxSaveQuote.HcFeiYongBuChang.HasValue ? bxSaveQuote.HcFeiYongBuChang.Value : 0, BaoFei = bxQuoteResult.HcFeiYongBuChang.HasValue ? bxQuoteResult.HcFeiYongBuChang.Value : 0 }; precisePrice.HcJingShenSunShi = new XianZhongUnit { BaoE = bxSaveQuote.HcJingShenSunShi.HasValue ? bxSaveQuote.HcJingShenSunShi.Value : 0, BaoFei = bxQuoteResult.HcJingShenSunShi.HasValue ? bxQuoteResult.HcJingShenSunShi.Value : 0 }; precisePrice.HcSanFangTeYue = new XianZhongUnit { BaoE = bxSaveQuote.HcSanFangTeYue.HasValue ? bxSaveQuote.HcSanFangTeYue.Value : 0, BaoFei = bxQuoteResult.HcSanFangTeYue.HasValue ? bxQuoteResult.HcSanFangTeYue.Value : 0 }; precisePrice.HcXiuLiChang = new XianZhongUnit { BaoE = bxSaveQuote.HcXiuLiChang.HasValue ? bxSaveQuote.HcXiuLiChang.Value : 0, BaoFei = bxQuoteResult.HcXiuLiChang.HasValue ? bxQuoteResult.HcXiuLiChang.Value : 0 }; precisePrice.HcXiuLiChangType = bxSaveQuote.HcXiuLiChangType.HasValue ? bxSaveQuote.HcXiuLiChangType.Value.ToString() : "-1"; precisePrice.RateFactor1 = bxQuoteResult.RateFactor1.HasValue ? (double)bxQuoteResult.RateFactor1.Value : 0; precisePrice.RateFactor2 = bxQuoteResult.RateFactor2.HasValue ? (double)bxQuoteResult.RateFactor2.Value : 0; precisePrice.RateFactor3 = bxQuoteResult.RateFactor3.HasValue ? (double)bxQuoteResult.RateFactor3.Value : 0; precisePrice.RateFactor4 = bxQuoteResult.RateFactor4.HasValue ? (double)bxQuoteResult.RateFactor4.Value : 0; } #endregion #region LastInfo转换 if (bxLastInfo != null) { userInfo.LastEndDate = bxLastInfo.last_end_date; userInfo.LastBusinessEndDdate = bxLastInfo.last_business_end_date; } #endregion #region 保险起始时间 if (qrStartDate != null) { userInfo.ForceStartDate = qrStartDate.ForceStartDate.HasValue ? qrStartDate.ForceStartDate.Value.ToString() : string.Empty; userInfo.BizStartDate = qrStartDate.BizStartDate.HasValue ? qrStartDate.BizStartDate.Value.ToString() : string.Empty; } #endregion orderDetail.CarOrder = carOrder; orderDetail.ClaimDetail = claimDetails; orderDetail.PrecisePrice = precisePrice; orderDetail.UserInfo = userInfo; return(orderDetail); }
public MyBaoJiaViewModel SetPrecisePriceItem(MyBaoJiaViewModel my, bx_userinfo userinfo, GetMyBjdDetailRequest request, List <bx_quoteresult_carinfo> quoteresultCarinfo, int reqseatcount) { var sourceList = _setPrecisePriceItem.FindSource(userinfo, request); //获取图片bx_picture List <bx_picture> picList = _pictureRepository.GetAllList(o => o.b_uid == userinfo.Id); //报价单资源对象 bx_savequote sq = _saveQuoteRepository.GetSavequoteByBuid(userinfo.Id); List <bx_quoteresult> qrList = _quoteResultRepository.GetQuoteResultList(userinfo.Id); List <bx_submit_info> siList = _submitInfoRepository.GetSubmitInfoList(userinfo.Id); List <bx_ywxdetail> ywxList = _ywxdetailRepository.GetList(userinfo.Id); //渠道列表 List <AgentConfigNameModel> agentChannelList = new List <AgentConfigNameModel>(); if (siList.Any()) { agentChannelList = _agentConfigRepository.FindListById(siList.Select(l => l.channel_id).Join(",")); } //图片url List <IsUploadImg> isUploadImg = new List <IsUploadImg>(); //报价信息模型,包括险种和报价 List <MyPrecisePriceItemViewModel> listquoteTotal = new List <MyPrecisePriceItemViewModel>(); var hebaodianweis = _hebaoDianweiRepository.FindList(userinfo.Id, SourceGroupAlgorithm.GetOldSources(sourceList.ToArray())); if (sourceList.Any() && userinfo.QuoteStatus > -1) { foreach (int itk in sourceList) { //20160905修改source1248=>0123,传入的新数据转换 var oit = SourceGroupAlgorithm.GetOldSource(itk);//获取到旧的source值 var submit = siList.FirstOrDefault(i => i.source == oit); var qr = qrList.FirstOrDefault(i => i.Source == oit); var jy = ywxList.Where(i => i.source == oit).ToList(); if (oit == 3) { if (!string.IsNullOrEmpty(request.NewRate) && qr != null) { qr.NewRate = decimal.Parse(request.NewRate); _quoteResultRepository.Update(qr); } else if (string.IsNullOrEmpty(request.NewRate) && qr != null && qr.NewRate != 0 && qr.NewRate != null) { request.NewRate = qr.NewRate.ToString(); } if (!string.IsNullOrEmpty(request.NewRate)) { my.NewRate = double.Parse(request.NewRate).ToString("#0.00000"); } } var model = ConvertToViewModelNew(oit, sq, qr, submit, userinfo.QuoteStatus.Value, agentChannelList, userinfo.CarVIN, jy, request.NewRate); var hebaodianwei = hebaodianweis.FirstOrDefault(heb => heb.source == oit); if (hebaodianwei != null && my.IsShowCalc == 0) { model.BizSysRate = hebaodianwei.system_biz_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_biz_rate.Value) : 0; model.ForceSysRate = hebaodianwei.system_force_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_force_rate.Value) : 0; //优惠费率 model.BenefitRate = hebaodianwei.agent_id == hebaodianwei.parent_agent_id ? Convert.ToDecimal(hebaodianwei.zhike_biz_rate.Value) : Convert.ToDecimal(hebaodianwei.agent_biz_rate.Value); } var qcinfo = quoteresultCarinfo.FirstOrDefault(l => l.source == oit); if (qcinfo != null) { model.CarUsedType = qcinfo.car_used_type ?? 0; model.SeatCount = qcinfo.seat_count ?? 0;//座位数赋值 } if (model.SeatCount == 0) { //如果报价结果没拿到座位数,将请求的赋值进去 model.SeatCount = reqseatcount; } model.JingSuanKouJing = submit != null ? (submit.RbJSKJ ?? "") : ""; listquoteTotal.Add(model); //拼装上传的图片模型 if (picList.Any()) { bx_picture picture = picList.FirstOrDefault(l => l.source == oit); if (picture != null && picture.id != 0) { IsUploadImg newmodel = new IsUploadImg() { IsUpload = 1, Source = itk }; isUploadImg.Add(newmodel); } } } my.PrecisePriceItem = listquoteTotal; my.IsUploadImg = isUploadImg; } else { my.PrecisePriceItem = new List <MyPrecisePriceItemViewModel>(); } return(my); }
public MyPrecisePriceItemViewModel ConvertToViewModelNew(int source, bx_savequote savequote, bx_quoteresult quoteresult, bx_submit_info submitInfo, int quoteStatus, List <AgentConfigNameModel> agentChannelList, string carVin, List <bx_ywxdetail> jiayi, string strRate = null) { double?newRate = null; if (!string.IsNullOrEmpty(strRate) && source == 3) { newRate = double.Parse(strRate); } if (savequote == null) { savequote = new bx_savequote(); } if (submitInfo == null) { submitInfo = new bx_submit_info(); } var isquoteresult = true; if (quoteresult == null) { isquoteresult = false; quoteresult = new bx_quoteresult(); } var model = new MyPrecisePriceItemViewModel() { BizRate = (double)(submitInfo.biz_rate.HasValue ? submitInfo.biz_rate.Value : 0), ForceRate = (double)(submitInfo.force_rate.HasValue ? submitInfo.force_rate.Value : 0), BizTotal = quoteresult.BizTotal.HasValue ? (newRate == null ? quoteresult.BizTotal.Value : System.Math.Round((double)quoteresult.BizTotal.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0, ForceTotal = quoteresult.ForceTotal ?? 0, TaxTotal = quoteresult.TaxTotal ?? 0, Source = SourceGroupAlgorithm.GetNewSource(source), QuoteStatus = submitInfo.quote_status.HasValue ? submitInfo.quote_status.Value : 0, QuoteResult = !string.IsNullOrEmpty(submitInfo.quote_result) ? submitInfo.quote_result : "", SubmitStatus = submitInfo.submit_status.HasValue ? submitInfo.submit_status.Value : 0, SubmitResult = !string.IsNullOrEmpty(submitInfo.submit_result) ? submitInfo.submit_result : "", JiaoQiang = savequote.JiaoQiang.HasValue ? savequote.JiaoQiang.Value : 1, CheSun = new XianZhongUnit { //BaoE = savequote.CheSun.HasValue ? savequote.CheSun.Value : 0, BaoE = isquoteresult ? (quoteresult.CheSunBE.HasValue ? quoteresult.CheSunBE.Value : 0) : (savequote.CheSun.HasValue ? savequote.CheSun.Value : 0), BaoFei = quoteresult.CheSun.HasValue ? (newRate == null ? quoteresult.CheSun.Value : System.Math.Round((double)quoteresult.CheSun.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, SanZhe = new XianZhongUnit { BaoE = savequote.SanZhe.HasValue ? savequote.SanZhe.Value : 0, BaoFei = quoteresult.SanZhe.HasValue ? (newRate == null ? quoteresult.SanZhe.Value : System.Math.Round((double)quoteresult.SanZhe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, DaoQiang = new XianZhongUnit { BaoE = isquoteresult ? (quoteresult.DaoQiangBE.HasValue ? quoteresult.DaoQiangBE.Value : 0) : (savequote.DaoQiang.HasValue ? savequote.DaoQiang.Value : 0), BaoFei = quoteresult.DaoQiang.HasValue ? (newRate == null ? quoteresult.DaoQiang.Value : System.Math.Round((double)quoteresult.DaoQiang.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, SanZheJieJiaRi = new XianZhongUnit { BaoE = (savequote.SanZheJieJiaRi.HasValue ? savequote.SanZheJieJiaRi.Value : 0) > 0 ? 1 : 0, BaoFei = quoteresult.SanZheJieJiaRi.HasValue ? (newRate == null ? quoteresult.SanZheJieJiaRi.Value : System.Math.Round((double)quoteresult.SanZheJieJiaRi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, SiJi = new XianZhongUnit { BaoE = savequote.SiJi.HasValue ? savequote.SiJi.Value : 0, BaoFei = quoteresult.SiJi.HasValue ? (newRate == null ? quoteresult.SiJi.Value : System.Math.Round((double)quoteresult.SiJi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, ChengKe = new XianZhongUnit { BaoE = savequote.ChengKe.HasValue ? savequote.ChengKe.Value : 0, BaoFei = quoteresult.ChengKe.HasValue ? (newRate == null ? quoteresult.ChengKe.Value : System.Math.Round((double)quoteresult.ChengKe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BoLi = new XianZhongUnit { BaoE = savequote.BoLi.HasValue ? savequote.BoLi.Value : 0, BaoFei = quoteresult.BoLi.HasValue ? (newRate == null ? quoteresult.BoLi.Value : System.Math.Round((double)quoteresult.BoLi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HuaHen = new XianZhongUnit { BaoE = savequote.HuaHen.HasValue ? savequote.HuaHen.Value : 0, BaoFei = quoteresult.HuaHen.HasValue ? (newRate == null ? quoteresult.HuaHen.Value : System.Math.Round((double)quoteresult.HuaHen.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianCheSun = new XianZhongUnit { BaoE = savequote.BuJiMianCheSun.HasValue ? savequote.BuJiMianCheSun.Value : 0, BaoFei = quoteresult.BuJiMianCheSun.HasValue ? (newRate == null ? quoteresult.BuJiMianCheSun.Value : System.Math.Round((double)quoteresult.BuJiMianCheSun.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianSanZhe = new XianZhongUnit { BaoE = savequote.BuJiMianSanZhe.HasValue ? savequote.BuJiMianSanZhe.Value : 0, BaoFei = quoteresult.BuJiMianSanZhe.HasValue ? (newRate == null ? quoteresult.BuJiMianSanZhe.Value : System.Math.Round((double)quoteresult.BuJiMianSanZhe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianDaoQiang = new XianZhongUnit { BaoE = savequote.BuJiMianDaoQiang.HasValue ? savequote.BuJiMianDaoQiang.Value : 0, BaoFei = quoteresult.BuJiMianDaoQiang.HasValue ? (newRate == null ? quoteresult.BuJiMianDaoQiang.Value : System.Math.Round((double)quoteresult.BuJiMianDaoQiang.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianRenYuan = new XianZhongUnit { BaoE = savequote.BuJiMianRenYuan.HasValue ? savequote.BuJiMianRenYuan.Value : 0, BaoFei = quoteresult.BuJiMianRenYuan.HasValue ? (newRate == null ? quoteresult.BuJiMianRenYuan.Value : System.Math.Round((double)quoteresult.BuJiMianRenYuan.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianFuJia = new XianZhongUnit { BaoE = savequote.BuJiMianFuJian.HasValue ? savequote.BuJiMianFuJian.Value : 0, BaoFei = quoteresult.BuJiMianFuJian.HasValue ? (newRate == null ? quoteresult.BuJiMianFuJian.Value : System.Math.Round((double)quoteresult.BuJiMianFuJian.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, //2.1.5版本 修改 增加6个字段 BuJiMianChengKe = new XianZhongUnit() { BaoE = savequote.BuJiMianChengKe.HasValue ? savequote.BuJiMianChengKe.Value : 0, BaoFei = quoteresult.BuJiMianChengKe.HasValue ? (newRate == null ? quoteresult.BuJiMianChengKe.Value : System.Math.Round((double)quoteresult.BuJiMianChengKe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianSiJi = new XianZhongUnit() { BaoE = savequote.BuJiMianSiJi.HasValue ? savequote.BuJiMianSiJi.Value : 0, BaoFei = quoteresult.BuJiMianSiJi.HasValue ? (newRate == null ? quoteresult.BuJiMianSiJi.Value : System.Math.Round((double)quoteresult.BuJiMianSiJi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianHuaHen = new XianZhongUnit() { BaoE = savequote.BuJiMianHuaHen.HasValue ? savequote.BuJiMianHuaHen.Value : 0, BaoFei = quoteresult.BuJiMianHuaHen.HasValue ? (newRate == null ? quoteresult.BuJiMianHuaHen.Value : System.Math.Round((double)quoteresult.BuJiMianHuaHen.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianSheShui = new XianZhongUnit() { BaoE = savequote.BuJiMianSheShui.HasValue ? savequote.BuJiMianSheShui.Value : 0, BaoFei = quoteresult.BuJiMianSheShui.HasValue ? (newRate == null ? quoteresult.BuJiMianSheShui.Value : System.Math.Round((double)quoteresult.BuJiMianSheShui.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianZiRan = new XianZhongUnit() { BaoE = savequote.BuJiMianZiRan.HasValue ? savequote.BuJiMianZiRan.Value : 0, BaoFei = quoteresult.BuJiMianZiRan.HasValue ? (newRate == null ? quoteresult.BuJiMianZiRan.Value : System.Math.Round((double)quoteresult.BuJiMianZiRan.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianJingShenSunShi = new XianZhongUnit() { BaoE = savequote.BuJiMianJingShenSunShi.HasValue ? savequote.BuJiMianJingShenSunShi.Value : 0, BaoFei = quoteresult.BuJiMianJingShenSunShi.HasValue ? (newRate == null ? quoteresult.BuJiMianJingShenSunShi.Value : System.Math.Round((double)quoteresult.BuJiMianJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, //2.1.5修改结束 //2.1.5修改补充 HcSheBeiSunshi = new XianZhongUnit { BaoE = savequote.HcSheBeiSunshi.HasValue ? savequote.HcSheBeiSunshi.Value : 0, BaoFei = quoteresult.HcSheBeiSunshi.HasValue ? (newRate == null ? quoteresult.HcSheBeiSunshi.Value : System.Math.Round((double)quoteresult.HcSheBeiSunshi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcHuoWuZeRen = new XianZhongUnit { BaoE = savequote.HcHuoWuZeRen.HasValue ? savequote.HcHuoWuZeRen.Value : 0, BaoFei = quoteresult.HcHuoWuZeRen.HasValue ? (newRate == null ? quoteresult.HcHuoWuZeRen.Value : System.Math.Round((double)quoteresult.HcHuoWuZeRen.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, //HcFeiYongBuChang = new XianZhongUnit //{ // BaoE = savequote.HcFeiYongBuChang.HasValue ? savequote.HcFeiYongBuChang.Value : 0, // BaoFei = quoteresult.HcFeiYongBuChang.HasValue ? quoteresult.HcFeiYongBuChang.Value : 0 //}, HcJingShenSunShi = new XianZhongUnit { BaoE = savequote.HcJingShenSunShi.HasValue ? savequote.HcJingShenSunShi.Value : 0, BaoFei = quoteresult.HcJingShenSunShi.HasValue ? (newRate == null ? quoteresult.HcJingShenSunShi.Value : System.Math.Round((double)quoteresult.HcJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcSanFangTeYue = new XianZhongUnit { BaoE = savequote.HcSanFangTeYue.HasValue ? savequote.HcSanFangTeYue.Value : 0, BaoFei = quoteresult.HcSanFangTeYue.HasValue ? (newRate == null ? quoteresult.HcSanFangTeYue.Value : System.Math.Round((double)quoteresult.HcSanFangTeYue.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcXiuLiChang = new XianZhongUnit { BaoE = savequote.HcXiuLiChang.HasValue ? savequote.HcXiuLiChang.Value : 0, BaoFei = quoteresult.HcXiuLiChang.HasValue ? (newRate == null ? quoteresult.HcXiuLiChang.Value : System.Math.Round((double)quoteresult.HcXiuLiChang.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcXiuLiChangType = savequote.HcXiuLiChangType.HasValue ? savequote.HcXiuLiChangType.Value.ToString() : string.Empty, //2.1.5修改补充结束 SheShui = new XianZhongUnit { BaoE = savequote.SheShui.HasValue ? savequote.SheShui.Value : 0, BaoFei = quoteresult.SheShui.HasValue ? (newRate == null ? quoteresult.SheShui.Value : System.Math.Round((double)quoteresult.SheShui.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, CheDeng = new XianZhongUnit { BaoE = savequote.CheDeng.HasValue ? savequote.CheDeng.Value : 0, BaoFei = quoteresult.CheDeng.HasValue ? (newRate == null ? quoteresult.CheDeng.Value : System.Math.Round((double)quoteresult.CheDeng.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, ZiRan = new XianZhongUnit { BaoE = isquoteresult ? (quoteresult.ZiRanBE.HasValue ? quoteresult.ZiRanBE.Value : 0) : (savequote.ZiRan.HasValue ? savequote.ZiRan.Value : 0), BaoFei = quoteresult.ZiRan.HasValue ? (newRate == null ? quoteresult.ZiRan.Value : System.Math.Round((double)quoteresult.ZiRan.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, RateFactor1 = quoteresult.RateFactor1.HasValue ? quoteresult.RateFactor1.Value : 0, RateFactor2 = quoteresult.RateFactor2.HasValue ? quoteresult.RateFactor2.Value : 0, RateFactor3 = quoteresult.RateFactor3.HasValue ? quoteresult.RateFactor3.Value : 0, RateFactor4 = quoteresult.RateFactor4.HasValue ? quoteresult.RateFactor4.Value : 0, TotalRate = (quoteresult.TotalRate ?? 0).ToString(CultureInfo.InvariantCulture), BizTno = string.IsNullOrEmpty(submitInfo.biz_tno) ? string.Empty : submitInfo.biz_tno, ForceTno = string.IsNullOrEmpty(submitInfo.force_tno) ? string.Empty : submitInfo.force_tno, Fybc = new XianZhongUnit { BaoE = savequote.HcFeiYongBuChang.HasValue ? savequote.HcFeiYongBuChang.Value : 0, BaoFei = quoteresult.HcFeiYongBuChang.HasValue ? quoteresult.HcFeiYongBuChang.Value : 0 }, FybcDays = new XianZhongUnit() { BaoE = savequote.FeiYongBuChangDays.HasValue ? savequote.FeiYongBuChangDays.Value : 0, BaoFei = savequote.FeiYongBuChangDays.HasValue ? savequote.FeiYongBuChangDays.Value : 0 }, SheBeiSunShi = new XianZhongUnit { BaoE = savequote.HcSheBeiSunshi ?? 0, BaoFei = quoteresult.HcSheBeiSunshi ?? 0 }, BjmSheBeiSunShi = new XianZhongUnit { BaoE = savequote.BuJiMianSheBeiSunshi ?? 0, BaoFei = quoteresult.BuJiMianSheBeiSunshi ?? 0 }, OrderNo = string.IsNullOrEmpty(submitInfo.orderNo) ? "" : submitInfo.orderNo }; //安心三者,划痕特殊处理 if (quoteresult.Source == 12) { if (model.SanZhe.BaoE > 3000000) { model.SanZhe.BaoE = 3000000; } if (model.HuaHen.BaoE > 0) { model.HuaHen.BaoE = 10000; } //安心的国产车如果上了进口,则改为国产玻璃 if (model.BoLi.BaoE == 2) { if (!string.IsNullOrEmpty(carVin)) { if (carVin.StartsWith("L")) { model.BoLi.BaoE = 1; } } else { model.BoLi.BaoE = 1; } } } if (!quoteresult.TotalRate.HasValue) { model.TotalRate = (model.RateFactor1 * model.RateFactor2 * model.RateFactor3 * model.RateFactor4).ToString("f4"); } List <SheBei> sheBeis = new List <SheBei>(); if (!string.IsNullOrWhiteSpace(savequote.SheBeiSunShiConfig)) { var items = savequote.SheBeiSunShiConfig.FromJson <List <bx_devicedetail> >(); foreach (bx_devicedetail devicedetail in items) { var sb = new SheBei() { DN = string.IsNullOrWhiteSpace(devicedetail.device_name) ? string.Empty : devicedetail.device_name, DA = devicedetail.device_amount ?? 0, DD = devicedetail.device_depreciationamount ?? devicedetail.device_depreciationamount.Value, DQ = devicedetail.device_quantity ?? devicedetail.device_quantity.Value, DT = devicedetail.device_type ?? devicedetail.device_type.Value, PD = devicedetail.purchase_date.HasValue ? devicedetail.purchase_date.Value.ToString("yyyy-MM-dd") : string.Empty }; sheBeis.Add(sb); } } model.SheBeis = sheBeis; if (submitInfo.source == 0 || submitInfo.source == 3) { if (savequote.HcXiuLiChangType == 1) { if (savequote.HcXiuLiChang < 0.15) { model.HcXiuLiChang.BaoE = 0.15; } } } //取核保渠道 if (submitInfo.channel_id.HasValue && agentChannelList.Any()) { var channelmodel = agentChannelList.FirstOrDefault(s => s.Id == submitInfo.channel_id.Value); if (channelmodel != null) { var channel = new ChannelInfo { ChannelId = submitInfo.channel_id.Value, ChannelName = channelmodel.ConfigUkeyName ?? "", IsPaicApi = channelmodel.IsPaicApi.ToString() }; model.Channel = channel; } } if (model.Channel == null) {//如果没给model.Channel赋值,默认实例化 model.Channel = new ChannelInfo() { ChannelId = 0, ChannelName = "", IsPaicApi = "0" }; } //20181123add驾意险 double jiayitotal = 0; model.JiaYi = jiayi.ConvertViewModel(model.QuoteStatus, out jiayitotal); model.JiaYiTotal = jiayitotal.ToString(); if (quoteStatus == 0) { model.QuoteResult = model.QuoteStatus == 1 ? "报价失败" : (model.QuoteResult ?? ""); model.SubmitResult = model.QuoteStatus == 1 ? "报价失败未核保" : (model.SubmitResult ?? ""); model.QuoteStatus = 0; model.SubmitStatus = 5;//报价失败未核保 //险种 //model.BizRate = 0; //model.ForceRate = 0; model.BizTotal = 0; model.ForceTotal = 0; model.TaxTotal = 0; model.CheSun.BaoFei = 0; model.SanZhe.BaoFei = 0; model.DaoQiang.BaoFei = 0; model.SiJi.BaoFei = 0; model.ChengKe.BaoFei = 0; model.BoLi.BaoFei = 0; model.HuaHen.BaoFei = 0; model.BuJiMianCheSun.BaoFei = 0; model.BuJiMianSanZhe.BaoFei = 0; model.BuJiMianDaoQiang.BaoFei = 0; model.BuJiMianRenYuan.BaoFei = 0; model.BuJiMianFuJia.BaoFei = 0; model.BuJiMianChengKe.BaoFei = 0; model.BuJiMianSiJi.BaoFei = 0; model.BuJiMianHuaHen.BaoFei = 0; model.BuJiMianSheShui.BaoFei = 0; model.BuJiMianZiRan.BaoFei = 0; model.BuJiMianJingShenSunShi.BaoFei = 0; model.HcSheBeiSunshi.BaoFei = 0; model.HcHuoWuZeRen.BaoFei = 0; //model.HcFeiYongBuChang.BaoFei = 0; model.HcJingShenSunShi.BaoFei = 0; model.HcSanFangTeYue.BaoFei = 0; model.HcXiuLiChang.BaoFei = 0; model.SheShui.BaoFei = 0; model.CheDeng.BaoFei = 0; model.ZiRan.BaoFei = 0; //model.RateFactor1 = 0; //model.RateFactor2 = 0; //model.RateFactor3 = 0; //model.RateFactor4 = 0; //model.BizTno = "", //model.ForceTno = "", model.Fybc.BaoFei = 0; model.FybcDays.BaoFei = 0; model.SheBeiSunShi.BaoFei = 0; model.BjmSheBeiSunShi.BaoFei = 0; } model.PingAnScore = (quoteresult.PingAnScore ?? 0).ToString(CultureInfo.InvariantCulture); model.RepeatSubmitResult = (submitInfo.is_repeat_submit ?? 0).ToString(); model.ExpectedLossRate = (quoteresult.biz_expected_loss_rate ?? 0).ToString(); if (submitInfo.source == 2) { model.VersionType = submitInfo.VersionType == "Rb_Marketing_version" ? "1" : "0"; } else { model.VersionType = "0"; } #region 是否为人保版本第三代 model.IsRB3Version = "0"; if (!string.IsNullOrWhiteSpace(submitInfo.VersionType)) { switch (submitInfo.VersionType) { case "Rb_Marketing_version": model.IsRB3Version = "0"; break; case "Rb_VFour_JL_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_LN_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_HuBei_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_HB_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_CQ_Artificial_version": model.IsRB3Version = "0"; break; default: model.IsRB3Version = "1"; break; } } #endregion model.ValidateCar = new ValidateCar() { BizValidateCar = (submitInfo.BizcInspectorNme ?? 0).ToString(), ForceValidateCar = (submitInfo.ForcecInspectorNme ?? 0).ToString(), IsValidateCar = ((submitInfo.ForcecInspectorNme ?? 0) | (submitInfo.BizcInspectorNme ?? 0)).ToString() }; //新增错误编码和结果 model.QuoteErrorCode = submitInfo.ErrorCodeToC.HasValue ? submitInfo.ErrorCodeToC.Value.ToString() : ""; model.QuoteErrorResult = submitInfo.quote_result_toc ?? ""; model.ActualDiscounts = (quoteresult.ActualDiscounts ?? 0).ToString(); return(model); }
public MyBaoJiaViewModel SetPrecisePriceItem(MyBaoJiaViewModel my, bx_userinfo userinfo, List <bx_quoteresult_carinfo> quoteresultCarinfo, List <long> listquote01, bool allfail, bx_savequote sq, List <bx_quoteresult> qrList, List <bx_submit_info> siList) { string newRate = string.Empty; //var sourceList = _setPrecisePriceItem.FindSource(userinfo, request); //获取图片bx_picture //List<bx_picture> picList = _pictureRepository.GetAllList(o => o.b_uid == userinfo.Id); //报价单资源对象 //bx_savequote sq = _saveQuoteRepository.GetSavequoteByBuid(userinfo.Id); //List<bx_quoteresult> qrList = _quoteResultRepository.GetQuoteResultList(userinfo.Id); //List<bx_submit_info> siList = _submitInfoRepository.GetSubmitInfoList(userinfo.Id); //渠道列表 List <AgentConfigNameModel> agentChannelList = new List <AgentConfigNameModel>(); if (siList.Any()) { agentChannelList = _agentConfigRepository.FindListById(siList.Select(l => l.channel_id).Join(",")); } //图片url List <IsUploadImg> isUploadImg = new List <IsUploadImg>(); //报价信息模型,包括险种和报价 List <MyPrecisePriceItemViewModel> listquoteTotal = new List <MyPrecisePriceItemViewModel>(); var hebaodianweis = _hebaoDianweiRepository.FindList(userinfo.Id, listquote01.ToArray()); if (listquote01.Any()) { foreach (int oit in listquote01) { //20160905修改source1248=>0123,传入的新数据转换 var submit = siList.FirstOrDefault(i => i.source == oit); var qr = qrList.FirstOrDefault(i => i.Source == oit); if (oit == 3) { if (!string.IsNullOrEmpty(newRate) && qr != null) { qr.NewRate = decimal.Parse(newRate); _quoteResultRepository.Update(qr); } else if (string.IsNullOrEmpty(newRate) && qr != null && qr.NewRate != 0 && qr.NewRate != null) { newRate = qr.NewRate.ToString(); } if (!string.IsNullOrEmpty(newRate)) { my.NewRate = double.Parse(newRate).ToString("#0.00000"); } } var model = ConvertToViewModelNew(oit, sq, qr, submit, allfail, agentChannelList, userinfo.CarVIN, newRate); var hebaodianwei = hebaodianweis.FirstOrDefault(heb => heb.source == oit); if (hebaodianwei != null && my.IsShowCalc == 0) { model.BizSysRate = hebaodianwei.system_biz_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_biz_rate.Value) : 0; model.ForceSysRate = hebaodianwei.system_force_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_force_rate.Value) : 0; //优惠费率 model.BenefitRate = hebaodianwei.agent_id == hebaodianwei.parent_agent_id ? Convert.ToDecimal(hebaodianwei.zhike_biz_rate.Value) : Convert.ToDecimal(hebaodianwei.agent_biz_rate.Value); } var qcinfo = quoteresultCarinfo.FirstOrDefault(l => l.source == oit); if (qcinfo != null) { model.CarUsedType = qcinfo.car_used_type.HasValue ? qcinfo.car_used_type.Value : 0; } model.JingSuanKouJing = submit != null ? (submit.RbJSKJ ?? "") : ""; listquoteTotal.Add(model); } my.PrecisePriceItem = listquoteTotal; my.IsUploadImg = new List <IsUploadImg>(); } else { my.PrecisePriceItem = new List <MyPrecisePriceItemViewModel>(); } return(my); }
public long CreateOrder(bx_car_order order, bx_address address, bx_lastinfo lastinfo, bx_userinfo userinfo, bx_savequote savequote, bx_submit_info submitInfo, bx_quoteresult quoteresult, bx_quoteresult_carinfo carInfo, List <bx_claim_detail> claimDetails) { //如果此四张表数据为空,提示插入失败 //if (userinfo == null || savequote == null || submitInfo == null || quoteresult == null) if (userinfo == null) { return(0); } long orderid = 0; using (TransactionScope scope = new TransactionScope()) { try { //插入订单 var neworder = DataContextFactory.GetDataContext().bx_car_order.Add(order); DataContextFactory.GetDataContext().SaveChanges(); orderid = neworder.id; if (orderid > 0) { #region CarOrderUserInfoRepository bx_order_userinfo orderUserinfo = new bx_order_userinfo() { Id = userinfo.Id, LicenseNo = userinfo.LicenseNo, OpenId = userinfo.OpenId, CityCode = userinfo.CityCode, EngineNo = userinfo.EngineNo, CarVIN = userinfo.CarVIN, MoldName = userinfo.MoldName, RegisterDate = userinfo.RegisterDate, Agent = userinfo.Agent, LicenseOwner = userinfo.LicenseOwner, CarType = carInfo != null ? carInfo.car_type : null, CarUsedType = carInfo != null ? carInfo.car_used_type : null, JiaoQiangEndDate = lastinfo != null ? (!string.IsNullOrEmpty(lastinfo.last_end_date) ? lastinfo.last_end_date : "") : "", ShangYeEndDate = lastinfo != null ? (!string.IsNullOrEmpty(lastinfo.last_business_end_date) ? lastinfo.last_business_end_date : "") : "", //2017.2.7新增 LastYearSource = userinfo.LastYearSource, InsuredName = userinfo.InsuredName, InsuredMobile = userinfo.InsuredMobile, InsuredIdCard = userinfo.InsuredIdCard, InsuredAddress = userinfo.InsuredAddress, RenewalType = userinfo.RenewalType, InsuredIdType = userinfo.InsuredIdType, OwnerIdCardType = userinfo.OwnerIdCardType, Email = userinfo.Email, nonclaim_discount_rate = lastinfo != null ? lastinfo.nonclaim_discount_rate : null, last_year_acctimes = lastinfo != null ? lastinfo.last_year_acctimes : null, last_year_claimamount = lastinfo != null ? lastinfo.last_year_claimamount : null, last_year_claimtimes = lastinfo != null ? lastinfo.last_year_claimtimes : null, //end新增 OrderId = orderid }; #endregion var re_ui = DataContextFactory.GetDataContext().bx_order_userinfo.Add(orderUserinfo); DataContextFactory.GetDataContext().SaveChanges(); if (quoteresult != null) { #region CarOrderQuoteResultRepository bx_order_quoteresult orderQuoteresult = new bx_order_quoteresult() { B_Uid = quoteresult.B_Uid, CreateTime = quoteresult.CreateTime, CheSun = quoteresult.CheSun, SanZhe = quoteresult.SanZhe, DaoQiang = quoteresult.DaoQiang, SiJi = quoteresult.SiJi, ChengKe = quoteresult.ChengKe, BoLi = quoteresult.BoLi, HuaHen = quoteresult.HuaHen, BuJiMianCheSun = quoteresult.BuJiMianCheSun, BuJiMianSanZhe = quoteresult.BuJiMianSanZhe, BuJiMianDaoQiang = quoteresult.BuJiMianDaoQiang, BuJiMianRenYuan = quoteresult.BuJiMianRenYuan, BuJiMianFuJian = quoteresult.BuJiMianFuJian, //2.1.5版本修改 增加6个字段 BuJiMianChengKe = quoteresult.BuJiMianChengKe, BuJiMianSiJi = quoteresult.BuJiMianSiJi, BuJiMianHuaHen = quoteresult.BuJiMianHuaHen, BuJiMianSheShui = quoteresult.BuJiMianSheShui, BuJiMianZiRan = quoteresult.BuJiMianZiRan, BuJiMianJingShenSunShi = quoteresult.BuJiMianJingShenSunShi, TeYue = quoteresult.TeYue, SheShui = quoteresult.SheShui, CheDeng = quoteresult.CheDeng, ZiRan = quoteresult.ZiRan, BizTotal = quoteresult.BizTotal, ForceTotal = quoteresult.ForceTotal, TaxTotal = quoteresult.TaxTotal, BizContent = quoteresult.BizContent, ForceContent = quoteresult.ForceContent, SavedAmount = quoteresult.SavedAmount, Source = quoteresult.Source, BizStartDate = quoteresult.BizStartDate, ForceStartDate = quoteresult.ForceStartDate, HcSheBeiSunshi = quoteresult.HcSheBeiSunshi, HcHuoWuZeRen = quoteresult.HcHuoWuZeRen, HcFeiYongBuChang = quoteresult.HcFeiYongBuChang, HcJingShenSunShi = quoteresult.HcJingShenSunShi, HcSanFangTeYue = quoteresult.HcSanFangTeYue, HcXiuLiChang = quoteresult.HcXiuLiChang, InsuredName = quoteresult.InsuredName, InsuredIdCard = quoteresult.InsuredIdCard, InsuredIdType = quoteresult.InsuredIdType, InsuredMobile = quoteresult.InsuredMobile, HolderName = quoteresult.HolderName, HolderIdCard = quoteresult.HolderIdCard, HolderIdType = quoteresult.HolderIdType, HolderMobile = quoteresult.HolderMobile, RateFactor1 = quoteresult.RateFactor1, RateFactor2 = quoteresult.RateFactor2, RateFactor3 = quoteresult.RateFactor3, RateFactor4 = quoteresult.RateFactor4, //2017.2.7新增 HcXiuLiChangType = quoteresult.HcXiuLiChangType, CheSunBE = quoteresult.CheSunBE, ZiRanBE = quoteresult.ZiRanBE, DaoQiangBE = quoteresult.DaoQiangBE, //end新增 OrderId = orderid }; #endregion var re_qr = DataContextFactory.GetDataContext().bx_order_quoteresult.Add(orderQuoteresult); DataContextFactory.GetDataContext().SaveChanges(); } if (savequote != null) { #region CarOrderSaveQuoteRepository bx_order_savequote orderSavequote = new bx_order_savequote() { B_Uid = savequote.B_Uid, CheSun = savequote.CheSun, SanZhe = savequote.SanZhe, DaoQiang = savequote.DaoQiang, SiJi = savequote.SiJi, ChengKe = savequote.ChengKe, BoLi = savequote.BoLi, HuaHen = savequote.HuaHen, BuJiMianCheSun = savequote.BuJiMianCheSun, BuJiMianSanZhe = savequote.BuJiMianSanZhe, BuJiMianDaoQiang = savequote.BuJiMianDaoQiang, BuJiMianRenYuan = savequote.BuJiMianRenYuan, BuJiMianFuJian = savequote.BuJiMianFuJian, //2.1.5版本修改 增加6个字段 BuJiMianChengKe = savequote.BuJiMianChengKe, BuJiMianSiJi = savequote.BuJiMianSiJi, BuJiMianHuaHen = savequote.BuJiMianHuaHen, BuJiMianSheShui = savequote.BuJiMianSheShui, BuJiMianZiRan = savequote.BuJiMianZiRan, BuJiMianJingShenSunShi = savequote.BuJiMianJingShenSunShi, TeYue = savequote.TeYue, SheShui = savequote.SheShui, CheDeng = savequote.CheDeng, ZiRan = savequote.ZiRan, IsRenewal = savequote.IsRenewal, CreateTime = savequote.CreateTime, JiaoQiang = savequote.JiaoQiang, BizStartDate = savequote.BizStartDate, HcSheBeiSunshi = savequote.HcSheBeiSunshi, HcHuoWuZeRen = savequote.HcHuoWuZeRen, HcFeiYongBuChang = savequote.HcFeiYongBuChang, HcJingShenSunShi = savequote.HcJingShenSunShi, HcSanFangTeYue = savequote.HcSanFangTeYue, HcXiuLiChang = savequote.HcXiuLiChang, //2017.2.7新增 SheBeiSunShiConfig = savequote.SheBeiSunShiConfig, FeiYongBuChangConfig = savequote.FeiYongBuChangConfig, XiuLiChangConfig = savequote.XiuLiChangConfig, co_real_value = savequote.co_real_value, //end新增 OrderId = orderid }; #endregion var re_sqr = DataContextFactory.GetDataContext().bx_order_savequote.Add(orderSavequote); DataContextFactory.GetDataContext().SaveChanges(); } if (submitInfo != null) { #region CarOrderSubmitInfoRepository bx_order_submit_info orderSubmitInfo = new bx_order_submit_info() { b_uid = submitInfo.b_uid, license_no = submitInfo.license_no, mobile = submitInfo.mobile, source = submitInfo.source, biz_tno = submitInfo.biz_tno, biz_pno = submitInfo.biz_pno, biz_start_time = submitInfo.biz_start_time, biz_end_time = submitInfo.biz_end_time, force_tno = submitInfo.force_tno, force_pno = submitInfo.force_pno, force_start_time = submitInfo.force_start_time, force_end_time = submitInfo.force_end_time, submit_status = submitInfo.submit_status, submit_result = submitInfo.submit_result, quote_status = submitInfo.quote_status, quote_result = submitInfo.quote_result, biz_rate = submitInfo.biz_rate, force_rate = submitInfo.force_rate, create_time = submitInfo.create_time, update_time = submitInfo.update_time, submit_result_toc = submitInfo.submit_result_toc, quote_result_toc = submitInfo.quote_result_toc, channel_id = submitInfo.channel_id, //2017.2.7新增 err_code = submitInfo.err_code, //end新增 OrderId = orderid }; #endregion var re_si = DataContextFactory.GetDataContext().bx_order_submit_info.Add(orderSubmitInfo); DataContextFactory.GetDataContext().SaveChanges(); } scope.Complete(); } } //catch (DbEntityValidationException dbEx) //{ // foreach (var validationErrors in dbEx.EntityValidationErrors) // { // foreach (var validationError in validationErrors.ValidationErrors) // { // logError.Info(string.Format("Property: {0} Error: {1}", // validationError.PropertyName, // validationError.ErrorMessage)); // } // } //} catch (Exception ex) { logError.Info("发生异常:事务订单号(" + orderid + ")\n" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } finally { //orderid = 0; scope.Dispose(); } } return(orderid); }