Beispiel #1
0
        private GetRepeatSubmitResponse RepeatSubmitResponseFactory(bx_lastinfo lastinfo, RepeatInfoFormatModel formatInfo)
        {
            var response = new GetRepeatSubmitResponse();

            if (lastinfo != null)
            {
                response.RepeatSubmitMessage = formatInfo.RepeatMsg;
                response.ForceExpireDate     = string.IsNullOrWhiteSpace(lastinfo.last_end_date)
                    ? string.Empty
                    : DateTime.Parse(lastinfo.last_end_date).ToString("yyyy-MM-dd HH:mm:ss");
                response.BusinessExpireDate = string.IsNullOrWhiteSpace(lastinfo.last_business_end_date)
                    ? string.Empty
                    : DateTime.Parse(lastinfo.last_business_end_date).ToString("yyyy-MM-dd HH:mm:ss");
                response.RepeatSubmitResult  = formatInfo.RepeatType;
                response.CompositeRepeatType = formatInfo.CompositeRepeatType;
                response.RepeatSubmitPerComp = formatInfo.RepeatPerCompany;
            }
            else
            {
                response.RepeatSubmitMessage = "没有重复投保";
                response.RepeatSubmitResult  = 0;
                response.ForceExpireDate     = string.Empty;
                response.BusinessExpireDate  = string.Empty;
                response.CompositeRepeatType = 0;
                response.RepeatSubmitPerComp = new Dictionary <int, int>();
            }

            return(response);
        }
Beispiel #2
0
        public bx_lastinfo GetByBuid(long buid)
        {
            bx_lastinfo lastinfo = new bx_lastinfo();

            try
            {
                lastinfo = DataContextFactory.GetDataContext().bx_lastinfo.FirstOrDefault(x => x.b_uid == buid);
            }
            catch (Exception ex)
            {
                logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException);
            }
            return(lastinfo);
        }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
        /// <summary>
        /// 续保信息的userinfo部分
        /// </summary>
        /// <param name="userinfo"></param>
        /// <param name="renewal"></param>
        /// <param name="carinfo"></param>
        /// <param name="lastinfo"></param>
        /// <param name="timeFormat"></param>
        /// <returns></returns>
        public static UserInfoViewModel ConvertToViewModel(this bx_userinfo userinfo, bx_car_renewal renewal, bx_carinfo carinfo, bx_lastinfo lastinfo, int timeFormat = 0)
        {
            var model = new UserInfoViewModel();

            model.Buid = userinfo.Id.ToString();
            try
            {
                if (renewal != null)
                {
                    model.BizNo         = string.IsNullOrWhiteSpace(renewal.BizNO) ? string.Empty : renewal.BizNO;
                    model.ForceNo       = string.IsNullOrWhiteSpace(renewal.ForceNO) ? string.Empty : renewal.ForceNO;
                    model.InsuredIdCard = string.IsNullOrWhiteSpace(renewal.InsuredIdCard)
                        ? string.Empty
                        : renewal.InsuredIdCard;
                    model.InsuredIdType = renewal.InsuredIdType.HasValue ? renewal.InsuredIdType.Value : 0;
                    //model.InsuredMobile = string.IsNullOrWhiteSpace(renewal.InsuredMobile)
                    //    ? string.Empty
                    //    : renewal.InsuredMobile.IndexOf("*", System.StringComparison.Ordinal) >= 0 ? string.Empty : renewal.InsuredMobile;
                    //model.HolderMobile = string.IsNullOrWhiteSpace(renewal.HolderMobile)
                    //    ? string.Empty
                    //    : renewal.HolderMobile.IndexOf("*", System.StringComparison.Ordinal) >= 0 ? string.Empty : renewal.HolderMobile;
                    model.InsuredMobile = string.Empty;
                    model.HolderMobile  = string.Empty;

                    model.HolderIdCard = string.IsNullOrWhiteSpace(renewal.HolderIdCard)
                        ? string.Empty
                        : renewal.HolderIdCard;
                    model.HolderIdType = renewal.HolderIdType.HasValue ? renewal.HolderIdType.Value : 0;
                    model.HolderName   = string.IsNullOrWhiteSpace(renewal.HolderName)
                        ? string.Empty
                        : renewal.HolderName;

                    //model.LicenseOwner = string.IsNullOrWhiteSpace(renewal) ? string.Empty : renewal.HolderName;
                    model.PostedName  = string.IsNullOrWhiteSpace(renewal.HolderName) ? string.Empty : renewal.HolderName;
                    model.InsuredName = string.IsNullOrWhiteSpace(renewal.InsuredName) ? string.Empty : renewal.InsuredName;
                    model.RateFactor1 = renewal.RateFactor1.HasValue ? renewal.RateFactor1.Value : 0;
                    model.RateFactor2 = renewal.RateFactor2.HasValue ? renewal.RateFactor2.Value : 0;
                    model.RateFactor3 = renewal.RateFactor3.HasValue ? renewal.RateFactor3.Value : 0;
                    model.RateFactor4 = renewal.RateFactor4.HasValue ? renewal.RateFactor4.Value : 0;


                    model.ForceExpireDate    = renewal.LastForceEndDate.HasValue ? (timeFormat == 1 ? renewal.LastForceEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : renewal.LastForceEndDate.Value.ToString("yyyy-MM-dd")) : string.Empty;
                    model.BusinessExpireDate = renewal.LastBizEndDate.HasValue ? (timeFormat == 1 ? renewal.LastBizEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : renewal.LastBizEndDate.Value.ToString("yyyy-MM-dd")) : string.Empty;
                    model.NextForceStartDate = (renewal.NextForceStartDate.HasValue
                        ? (timeFormat == 1 ? renewal.NextForceStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : renewal.NextForceStartDate.Value.ToString("yyyy-MM-dd"))
                        : string.Empty);
                    model.NextBusinessStartDate = (renewal.NextBizStartDate.HasValue
                        ? (timeFormat == 1 ? renewal.NextBizStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : renewal.NextBizStartDate.Value.ToString("yyyy-MM-dd"))
                        : 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");
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(model.NextForceStartDate))
                    {
                        var nf = DateTime.Parse(model.NextForceStartDate);
                        if (nf.Date == DateTime.MinValue.Date)
                        {
                            model.NextForceStartDate = "";
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(model.NextBusinessStartDate))
                    {
                        var nb = DateTime.Parse(model.NextBusinessStartDate);
                        if (nb.Date == DateTime.MinValue.Date)
                        {
                            model.NextBusinessStartDate = "";
                        }
                    }
                    model.Organization = renewal.Organization ?? string.Empty;
                    //新增的投保人生日和性别
                    model.HolderBirthday = renewal.HolderBirthday ?? string.Empty;
                    if (!string.IsNullOrEmpty(model.HolderBirthday) && Convert.ToDateTime(model.HolderBirthday).Year == DateTime.MinValue.Year)
                    {
                        model.HolderBirthday = string.Empty;
                    }
                    model.HolderSex = (renewal.HolderSex ?? 0).ToString();
                    //新增的被保险人生日和性别
                    model.InsuredBirthday = renewal.InsuredBirthday ?? string.Empty;
                    if (!string.IsNullOrEmpty(model.InsuredBirthday) && Convert.ToDateTime(model.InsuredBirthday).Year == DateTime.MinValue.Year)
                    {
                        model.InsuredBirthday = string.Empty;
                    }
                    model.InsuredSex = (renewal.InsuredSex ?? 0).ToString();
                }
                else
                {
                    model.ForceExpireDate       = string.Empty;
                    model.BusinessExpireDate    = string.Empty;
                    model.NextForceStartDate    = string.Empty;
                    model.NextBusinessStartDate = string.Empty;


                    model.InsuredIdCard = string.Empty;
                    model.InsuredIdType = 0;
                    model.InsuredMobile = string.Empty;
                    model.HolderMobile  = string.Empty;
                    model.HolderIdCard  = string.Empty;
                    model.HolderIdType  = 0;
                    model.HolderName    = string.Empty;
                    model.RateFactor1   = 0;
                    model.RateFactor2   = 0;
                    model.RateFactor3   = 0;
                    model.RateFactor4   = 0;
                    model.BizNo         = string.Empty;
                    model.ForceNo       = string.Empty;
                    model.PostedName    = string.Empty;
                    model.InsuredName   = string.Empty;
                    model.Organization  = string.Empty;

                    model.HolderBirthday  = string.Empty;
                    model.HolderSex       = string.Empty;
                    model.InsuredBirthday = string.Empty;
                    model.InsuredSex      = string.Empty;
                }
                if (carinfo != null)
                {
                    model.FuelType     = carinfo.fuel_type.HasValue ? carinfo.fuel_type.Value : 0;
                    model.ProofType    = carinfo.proof_type.HasValue ? carinfo.proof_type.Value : 0;
                    model.LicenseColor = carinfo.license_color.HasValue ? carinfo.license_color.Value : 0;
                    model.ClauseType   = carinfo.clause_type.HasValue ? carinfo.clause_type.Value : 0;
                    model.RunRegion    = carinfo.run_region.HasValue ? carinfo.run_region.Value : 0;

                    model.CarUsedType     = carinfo.car_used_type.HasValue ? carinfo.car_used_type.Value : 0;
                    model.CredentislasNum = string.IsNullOrWhiteSpace(carinfo.owner_idno) ? string.Empty : carinfo.owner_idno;
                    model.IdType          = carinfo.owner_idno_type.HasValue ? carinfo.owner_idno_type.Value : 0;
                    model.PurchasePrice   = (double)(carinfo.purchase_price.HasValue ? carinfo.purchase_price.Value : 0);
                    model.SeatCount       = carinfo.seat_count.HasValue ? carinfo.seat_count.Value : 0;
                    model.ExhaustScale    = carinfo.exhaust_scale.HasValue ? carinfo.exhaust_scale.ToString() : "0";
                    model.LicenseOwner    = string.IsNullOrWhiteSpace(carinfo.license_owner) ? string.Empty : carinfo.license_owner;
                    model.CarType         = (carinfo.car_type ?? 0).ToString();
                    model.CarVin          = carinfo.vin_no ?? string.Empty;
                    model.EngineNo        = carinfo.engine_no ?? string.Empty;
                    model.RegisterDate    = carinfo.register_date.HasValue ? carinfo.register_date.Value.ToString("yyyy-MM-dd") : string.Empty;
                    model.ModleName       = carinfo.mold_name ?? string.Empty;
                    //新增的车主生日和性别
                    model.OwnerBirthday = carinfo.OwnerBirthday ?? string.Empty;
                    if (!string.IsNullOrEmpty(model.OwnerBirthday) && Convert.ToDateTime(model.OwnerBirthday).Year == DateTime.MinValue.Year)
                    {
                        model.OwnerBirthday = string.Empty;
                    }
                    model.OwnerSex = (carinfo.OwnerSex ?? 0).ToString();
                }
                else
                {
                    model.FuelType     = 0;
                    model.ProofType    = 0;
                    model.LicenseColor = 0;
                    model.ClauseType   = 0;
                    model.RunRegion    = 0;

                    model.CarUsedType     = 0;
                    model.CredentislasNum = string.Empty;
                    model.IdType          = 0;
                    model.ExhaustScale    = string.Empty;
                    model.LicenseOwner    = string.Empty;
                    model.CarType         = string.Empty;
                    model.CarVin          = string.IsNullOrWhiteSpace(userinfo.CarVIN) ? string.Empty : userinfo.CarVIN;
                    model.EngineNo        = string.IsNullOrWhiteSpace(userinfo.EngineNo) ? string.Empty : userinfo.EngineNo;
                    model.RegisterDate    = string.IsNullOrWhiteSpace(userinfo.RegisterDate) ? string.Empty : userinfo.RegisterDate;
                    model.ModleName       = string.IsNullOrWhiteSpace(userinfo.MoldName) ? string.Empty : userinfo.MoldName;

                    model.OwnerSex      = string.Empty;
                    model.OwnerBirthday = string.Empty;
                }
                //model.CarVin = string.IsNullOrWhiteSpace(userinfo.CarVIN) ? string.Empty : userinfo.CarVIN;
                model.CityCode = !string.IsNullOrWhiteSpace(userinfo.CityCode) ? Convert.ToInt32(userinfo.CityCode) : 1;
                //model.EngineNo = string.IsNullOrWhiteSpace(userinfo.EngineNo) ? string.Empty : userinfo.EngineNo;
                model.LicenseNo = string.IsNullOrWhiteSpace(userinfo.LicenseNo) ? string.Empty : userinfo.LicenseNo;
                //model.LicenseOwner = string.IsNullOrWhiteSpace(userinfo.LicenseOwner) ? string.Empty : userinfo.LicenseOwner;
                //model.ModleName = string.IsNullOrWhiteSpace(userinfo.MoldName) ? string.Empty : userinfo.MoldName;
                //model.RegisterDate = string.IsNullOrWhiteSpace(userinfo.RegisterDate) ? string.Empty : userinfo.RegisterDate;
                if (!string.IsNullOrWhiteSpace(model.RegisterDate))
                {
                    if (model.RegisterDate.Equals(DateTime.MinValue.ToString("yyyy-MM-dd")))
                    {
                        model.RegisterDate = "";
                    }
                }
                //model.PostedName = model.HolderName;
                //model.InsuredName = string.IsNullOrWhiteSpace(userinfo.InsuredName) ? string.Empty : userinfo.InsuredName;
                model.HolderName     = null;
                model.RenewalCarType = (userinfo.RenewalCarType ?? 0).ToString();
            }
            catch (Exception ex)
            {
                log.Info("模型转换报错:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException);
            }



            return(model);
        }
Beispiel #5
0
        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 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);
        }