/// <summary> /// 报价信息的 userinfo部分 /// </summary> /// <param name="userinfo"></param> /// <param name="lastinfo"></param> /// <param name="quoteresult"></param> /// <param name="resultcarinfo"></param> /// <param name="timeFormat"></param> /// <returns></returns> public static GetPrecisePriceOfUserInfoViewModel ConvertToPreciseViewModel(this bx_userinfo userinfo, bx_lastinfo lastinfo, bx_quoteresult quoteresult, bx_quoteresult_carinfo resultcarinfo, int timeFormat = 0) { var model = new GetPrecisePriceOfUserInfoViewModel(); if (lastinfo != null) { model.ForceExpireDate = lastinfo.last_end_date ?? string.Empty; model.BusinessExpireDate = lastinfo.last_business_end_date ?? string.Empty; if (!string.IsNullOrWhiteSpace(model.ForceExpireDate)) { var fd = DateTime.Parse(model.ForceExpireDate); if (fd.Date == DateTime.MinValue.Date) { model.ForceExpireDate = ""; } else { model.ForceExpireDate = timeFormat == 1 ? DateTime.Parse(model.ForceExpireDate).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(model.ForceExpireDate).ToString("yyyy-MM-dd"); } } if (!string.IsNullOrWhiteSpace(model.BusinessExpireDate)) { var bd = DateTime.Parse(model.BusinessExpireDate); if (bd.Date == DateTime.MinValue.Date) { model.BusinessExpireDate = ""; } else { model.BusinessExpireDate = timeFormat == 1 ? DateTime.Parse(model.BusinessExpireDate).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(model.BusinessExpireDate).ToString("yyyy-MM-dd"); } } } else { model.ForceExpireDate = string.Empty; model.BusinessExpireDate = string.Empty; } if (quoteresult != null) { model.InsuredName = string.IsNullOrWhiteSpace(quoteresult.InsuredName) ? string.Empty : quoteresult.InsuredName; model.InsuredIdCard = string.IsNullOrWhiteSpace(quoteresult.InsuredIdCard) ? string.Empty : quoteresult.InsuredIdCard; model.InsuredIdType = quoteresult.InsuredIdType.HasValue ? quoteresult.InsuredIdType.Value : 0; model.InsuredMobile = string.IsNullOrWhiteSpace(quoteresult.InsuredMobile) ? string.Empty : quoteresult.InsuredMobile; model.HolderName = string.IsNullOrWhiteSpace(quoteresult.HolderName) ? string.Empty : quoteresult.HolderName; model.HolderIdCard = string.IsNullOrWhiteSpace(quoteresult.HolderIdCard) ? string.Empty : quoteresult.HolderIdCard; model.HolderIdType = quoteresult.HolderIdType.HasValue ? quoteresult.HolderIdType.Value : 0; model.HolderMobile = string.IsNullOrWhiteSpace(quoteresult.HolderMobile) ? string.Empty : quoteresult.HolderMobile;; model.BusinessStartDate = quoteresult.BizStartDate.HasValue ? (timeFormat == 1 ? quoteresult.BizStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : quoteresult.BizStartDate.Value.ToString("yyyy-MM-dd")) : string.Empty; model.ForceStartDate = quoteresult.ForceStartDate.HasValue ? (timeFormat == 1 ? quoteresult.ForceStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : quoteresult.ForceStartDate.Value.ToString("yyyy-MM-dd")) : string.Empty; if (!string.IsNullOrWhiteSpace(model.BusinessStartDate)) { var st = DateTime.Parse(model.BusinessStartDate); if (st.Date == DateTime.MinValue.Date) { model.BusinessStartDate = ""; } else { model.BusinessStartDate = timeFormat == 1 ? DateTime.Parse(model.BusinessStartDate).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(model.BusinessStartDate).ToString("yyyy-MM-dd"); model.BusinessEndDate = timeFormat == 1 ? DateTime.Parse(model.BusinessStartDate).AddYears(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(model.BusinessStartDate).AddYears(1).AddDays(-1).ToString("yyyy-MM-dd"); } } if (!string.IsNullOrWhiteSpace(model.ForceStartDate)) { var st = DateTime.Parse(model.ForceStartDate); if (st.Date == DateTime.MinValue.Date) { model.ForceStartDate = ""; } else { model.ForceStartDate = timeFormat == 1 ? DateTime.Parse(model.ForceStartDate).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(model.ForceStartDate).ToString("yyyy-MM-dd"); model.ForceEndDate = timeFormat == 1 ? DateTime.Parse(model.ForceStartDate).AddYears(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(model.ForceStartDate).AddYears(1).AddDays(-1).ToString("yyyy-MM-dd"); } } } else { model.InsuredName = string.Empty; model.InsuredIdCard = string.Empty; model.InsuredIdType = 0; model.InsuredMobile = string.Empty; model.HolderName = string.Empty; model.HolderIdCard = string.Empty; model.HolderIdType = 0; model.HolderMobile = string.Empty; model.BusinessStartDate = string.Empty; model.ForceStartDate = string.Empty; } if (resultcarinfo != null) { model.AutoMoldCode = !string.IsNullOrWhiteSpace(resultcarinfo.auto_model_code) ? resultcarinfo.auto_model_code : string.Empty; model.VehicleInfo = VehicleInfoMapper.VehicleInfoMethod(resultcarinfo); } else { model.AutoMoldCode = string.Empty; model.VehicleInfo = string.Empty; } model.LicenseNo = userinfo.LicenseNo; model.Mobile = string.IsNullOrWhiteSpace(userinfo.Mobile) ? string.Empty : userinfo.Mobile; model.Email = string.IsNullOrWhiteSpace(userinfo.Email) ? string.Empty : userinfo.Email; //天猫--宝马合作 c端 if (userinfo.Agent == "67396") { model.Mobile = string.Empty; model.InsuredMobile = string.Empty; model.HolderMobile = string.Empty; } if (userinfo != null) { model.CarOwnerPerson = new RelationPerson { Address = userinfo.OwnerCertiAddress ?? string.Empty, Email = userinfo.Email ?? string.Empty, IdCard = userinfo.IdCard ?? string.Empty, IdType = userinfo.OwnerIdCardType, Mobile = userinfo.Mobile ?? string.Empty, Name = userinfo.LicenseOwner ?? string.Empty, Sex = userinfo.OwnerSex ?? 1, Authority = userinfo.OwnerIssuer ?? string.Empty, Birthday = userinfo.OwnerBirthday ?? string.Empty, CertiEndDate = userinfo.OwnerCertiEnddate ?? string.Empty, CertiStartDate = userinfo.OwnerCertiStartdate ?? string.Empty, Nation = userinfo.OwnerNation ?? string.Empty }; model.HolderPerson = new RelationPerson() { Address = userinfo.HolderAddress ?? string.Empty, Email = string.IsNullOrWhiteSpace(userinfo.HolderEmail) ? model.CarOwnerPerson.Email : userinfo.HolderEmail, IdCard = userinfo.HolderIdCard ?? string.Empty, IdType = userinfo.HolderIdType ?? 0, Mobile = userinfo.HolderMobile ?? string.Empty, Name = userinfo.HolderName ?? string.Empty, Sex = userinfo.HolderSex ?? 1, Authority = userinfo.HolderIssuer ?? string.Empty, Birthday = userinfo.HolderBirthday ?? string.Empty, CertiEndDate = userinfo.HolderCertiEnddate ?? string.Empty, CertiStartDate = userinfo.HolderCertiStartdate ?? string.Empty, Nation = userinfo.HolderNation ?? string.Empty }; model.InsuredPerson = new RelationPerson { Address = userinfo.InsuredAddress ?? string.Empty, Email = string.IsNullOrWhiteSpace(userinfo.InsuredEmail) ? model.CarOwnerPerson.Email : userinfo.InsuredEmail, IdCard = userinfo.InsuredIdCard ?? string.Empty, IdType = userinfo.InsuredIdType ?? 0, Mobile = userinfo.InsuredMobile ?? string.Empty, Name = userinfo.InsuredName ?? string.Empty, Sex = userinfo.InsuredSex ?? 1, Authority = userinfo.InsuredIssuer ?? string.Empty, Birthday = userinfo.InsuredBirthday ?? string.Empty, CertiEndDate = userinfo.InsuredCertiEnddate ?? string.Empty, CertiStartDate = userinfo.InsuredCertiStartdate ?? string.Empty, Nation = userinfo.InsuredNation ?? string.Empty }; model.SixDigitsAfterIdCard = userinfo.SixDigitsAfterIdCard ?? ""; } return(model); }
public static GetPrecisePriceViewModel GetPrecisePrice(GetPrecisePriceRequest request) { var viewModel = new GetPrecisePriceViewModel(); GetPrecisePriceOfUserInfoViewModel UserInfo = new GetPrecisePriceOfUserInfoViewModel(); UserInfo.LicenseNo = "京FF1234"; UserInfo.ForceExpireDate = "2017-01-19"; UserInfo.BusinessExpireDate = "2017-01-19"; UserInfo.BusinessStartDate = "2016-07-17"; UserInfo.ForceStartDate = ""; UserInfo.InsuredName = "姚毅"; UserInfo.InsuredIdCard = "110108196905241319"; UserInfo.InsuredIdType = 1; UserInfo.InsuredMobile = "13154582463"; UserInfo.HolderName = "姚毅"; UserInfo.HolderIdCard = "110108196905241319"; UserInfo.HolderIdType = 1; UserInfo.HolderMobile = "13154582463"; viewModel.UserInfo = UserInfo; PrecisePriceItemViewModel Item = new PrecisePriceItemViewModel(); Item.BizRate = 0;; Item.ForceRate = 0; Item.BizTotal = 8438.24; Item.ForceTotal = 0; Item.TaxTotal = 0; Item.Source = 1; Item.QuoteStatus = 1; Item.QuoteResult = "成功"; XianZhongUnit CheSun = new XianZhongUnit(); CheSun.BaoE = 358244; CheSun.BaoFei = 4234.46; Item.CheSun = CheSun; XianZhongUnit SanZhe = new XianZhongUnit(); SanZhe.BaoE = 500000; SanZhe.BaoFei = 1063.52; Item.SanZhe = SanZhe; XianZhongUnit DaoQiang = new XianZhongUnit(); DaoQiang.BaoE = 358244; DaoQiang.BaoFei = 1458.49; Item.DaoQiang = DaoQiang; XianZhongUnit SiJi = new XianZhongUnit(); SiJi.BaoE = 0; SiJi.BaoFei = 0; Item.SiJi = SiJi; XianZhongUnit ChengKe = new XianZhongUnit(); ChengKe.BaoE = 0; ChengKe.BaoFei = 0; Item.ChengKe = ChengKe; XianZhongUnit BoLi = new XianZhongUnit(); BoLi.BaoE = 1; BoLi.BaoFei = 595.38; Item.BoLi = BoLi; XianZhongUnit HuaHen = new XianZhongUnit(); HuaHen.BaoE = 0; HuaHen.BaoFei = 0; Item.HuaHen = HuaHen; XianZhongUnit SheShui = new XianZhongUnit(); SheShui.BaoE = 0; SheShui.BaoFei = 0; Item.SheShui = SheShui; //XianZhongUnit CheDeng = new XianZhongUnit(); //CheDeng.BaoE = 0; //CheDeng.BaoFei = 0; //Item.CheDeng = CheDeng; XianZhongUnit ZiRan = new XianZhongUnit(); ZiRan.BaoE = 0; ZiRan.BaoFei = 0; Item.ZiRan = ZiRan; XianZhongUnit BuJiMianChengKe = new XianZhongUnit(); BuJiMianChengKe.BaoE = 0; BuJiMianChengKe.BaoFei = 0; Item.BuJiMianChengKe = BuJiMianChengKe; XianZhongUnit BuJiMianSiJi = new XianZhongUnit(); BuJiMianSiJi.BaoE = 0; BuJiMianSiJi.BaoFei = 0; Item.BuJiMianSiJi = BuJiMianSiJi; XianZhongUnit BuJiMianHuaHen = new XianZhongUnit(); BuJiMianHuaHen.BaoE = 0; BuJiMianHuaHen.BaoFei = 0; Item.BuJiMianHuaHen = BuJiMianHuaHen; XianZhongUnit BuJiMianSheShui = new XianZhongUnit(); BuJiMianSheShui.BaoE = 0; BuJiMianSheShui.BaoFei = 0; Item.BuJiMianSheShui = BuJiMianSheShui; XianZhongUnit BuJiMianZiRan = new XianZhongUnit(); BuJiMianZiRan.BaoE = 0; BuJiMianZiRan.BaoFei = 0; Item.BuJiMianZiRan = BuJiMianZiRan; XianZhongUnit BuJiMianJingShenSunShi = new XianZhongUnit(); BuJiMianJingShenSunShi.BaoE = 0; BuJiMianJingShenSunShi.BaoFei = 0; Item.BuJiMianJingShenSunShi = BuJiMianJingShenSunShi; XianZhongUnit BuJiMianCheSun = new XianZhongUnit(); BuJiMianCheSun.BaoE = 1; BuJiMianCheSun.BaoFei = 635.16; Item.BuJiMianCheSun = BuJiMianCheSun; XianZhongUnit BuJiMianSanZhe = new XianZhongUnit(); BuJiMianSanZhe.BaoE = 1; BuJiMianSanZhe.BaoFei = 159.53; Item.BuJiMianSanZhe = BuJiMianSanZhe; XianZhongUnit BuJiMianDaoQiang = new XianZhongUnit(); BuJiMianDaoQiang.BaoE = 1; BuJiMianDaoQiang.BaoFei = 291.69; Item.BuJiMianDaoQiang = BuJiMianDaoQiang; //XianZhongUnit BuJiMianRenYuan = new XianZhongUnit(); //BuJiMianRenYuan.BaoE = 0; //BuJiMianRenYuan.BaoFei = 0; //Item.BuJiMianRenYuan = BuJiMianRenYuan; //XianZhongUnit BuJiMianFuJia = new XianZhongUnit(); //BuJiMianFuJia.BaoE = 0; //BuJiMianFuJia.BaoFei = 0; //Item.BuJiMianFuJia = BuJiMianFuJia; XianZhongUnit HcSheBeiSunshi = new XianZhongUnit(); HcSheBeiSunshi.BaoE = 0; HcSheBeiSunshi.BaoFei = 0; Item.HcSheBeiSunshi = HcSheBeiSunshi; XianZhongUnit HcHuoWuZeRen = new XianZhongUnit(); HcHuoWuZeRen.BaoE = 0; HcHuoWuZeRen.BaoFei = 0; Item.HcHuoWuZeRen = HcHuoWuZeRen; XianZhongUnit HcFeiYongBuChang = new XianZhongUnit(); HcFeiYongBuChang.BaoE = 0; HcFeiYongBuChang.BaoFei = 0; Item.HcFeiYongBuChang = HcFeiYongBuChang; XianZhongUnit HcJingShenSunShi = new XianZhongUnit(); HcJingShenSunShi.BaoE = 0; HcJingShenSunShi.BaoFei = 0; Item.HcJingShenSunShi = HcJingShenSunShi; XianZhongUnit HcSanFangTeYue = new XianZhongUnit(); HcSanFangTeYue.BaoE = 0; HcSanFangTeYue.BaoFei = 0; Item.HcSanFangTeYue = HcSanFangTeYue; XianZhongUnit HcXiuLiChang = new XianZhongUnit(); HcXiuLiChang.BaoE = 0; HcXiuLiChang.BaoFei = 0; Item.HcXiuLiChang = HcXiuLiChang; Item.RateFactor1 = 0; Item.RateFactor2 = decimal.Parse("0.85"); Item.RateFactor3 = decimal.Parse("0.85"); Item.RateFactor4 = 0; viewModel.Item = Item; QuoteResultCarInfoViewModel CarInfo = new QuoteResultCarInfoViewModel(); viewModel.CarInfo = CarInfo; viewModel.CustKey = request.CustKey; viewModel.CheckCode = request.CheckCode; return(viewModel); }