Example #1
0
        public bx_order_savequote GetSavequoteByBuid(long buid)
        {
            bx_order_savequote savequote = new bx_order_savequote();

            try
            {
                savequote = DataContextFactory.GetDataContext().bx_order_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);
        }
Example #2
0
        public int Update(bx_order_savequote savequote)
        {
            int count = 0;

            try
            {
                DataContextFactory.GetDataContext().bx_order_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);
        }
Example #3
0
        public long Add(bx_order_savequote savequote)
        {
            long count = 0;

            try
            {
                var item         = DataContextFactory.GetDataContext().bx_order_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 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);
        }