Exemplo n.º 1
0
        /// <summary>
        /// 根据产品类型获取对应产品类目下的产品Pids
        /// </summary>
        /// <param name="productType"></param>
        /// <returns></returns>
        public async Task <Tuple <List <string>, string> > GetAllPidsFromCache(string productType)
        {
            List <string> result;
            var           message = string.Empty;

            try
            {
                var key = $"GetAllPids/{productType}";
                using (var cacheHelper = CacheHelper.CreateCacheClient(CacheClientName))
                {
                    var cacheResult = await cacheHelper.GetOrSetAsync(key, () =>
                                                                      GetAllPids(productType), TimeSpan.FromMinutes(10));

                    if (cacheResult.Success)
                    {
                        result  = cacheResult.Value?.Item1;
                        message = cacheResult.Value?.Item2;
                    }
                    else
                    {
                        var data = await GetAllPids(productType);

                        result  = data.Item1;
                        message = data.Item2;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error("GetAllPidsFromCache", ex);
                result  = null;
                message = ex.Message;
            }
            return(Tuple.Create(result, message));
        }
Exemplo n.º 2
0
        public static bool NewAddActivity(string activityName, DateTime startTime, DateTime endTime, string webUrl, string activityRules, string sourceId, CRMSourceType sourceName, string user)
        {
            var result = false;

            try
            {
                using (var client = new CRMClient())
                {
                    var getResult = client.NewAddActivity(new Service.CallCenter.Models.Activity()
                    {
                        ActivityName = activityName,
                        StartTime    = startTime,
                        EndTime      = endTime,
                        SellingPoint = webUrl,
                        Detail       = activityRules,
                        SourceId     = sourceId + sourceName.ToString(),
                        SourceName   = sourceName.ToString(),
                        CreateUser   = user
                    });
                    result = getResult.Result.IsSuccess;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 选择优先级
        /// </summary>
        /// <returns></returns>
        public async Task <Tuple <List <VendorProductPriorityConfigModel>, int> > SelectVendorProductPriorityConfigPriority
            (string productType, string configType, int provinceId, int cityId, PagerModel pager)
        {
            var result     = new List <VendorProductPriorityConfigModel>();
            var totalCount = 0;

            try
            {
                var regionIds = cityId > 0 ? new List <int>(1)
                {
                    cityId
                }
                    : provinceId > 0 ? await _regionService.GetCityIdsByRegionId(provinceId, true)
                        : new List <int>(1)
                {
                    provinceId
                };
                var searchResult = _dbScopeManagerConfigRead.Execute(conn =>
                                                                     _dal.SearchVendorProductPriorityConfig(conn, productType, configType, regionIds, pager));
                result     = searchResult?.Item1;
                totalCount = searchResult?.Item2 ?? 0;
            }
            catch (Exception ex)
            {
                _logger.Error("SelectVendorProductPriorityConfigPriority", ex);
            }
            return(Tuple.Create(result, totalCount));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取需要发送支付通知的订单
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="orderType"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IEnumerable <OrderLists> SelectNeedSendOrder(DateTime startTime, DateTime endTime, string orderType)
        {
            List <OrderLists> result = new List <OrderLists>();

            try
            {
                var data          = dbScopeReadManager.Execute(conn => DALThirdReplaceOrder.SelectNeedSendOrder(conn, startTime, endTime, orderType));
                var sendOrderList = dbTuhuLogScopeReadManager.Execute(conn => DALThirdReplaceOrder.SelectSendOrderPayNoticeOrderIds(conn));
                if (data != null && data.Any())
                {
                    if (sendOrderList == null || !sendOrderList.Any())
                    {
                        result = data;
                    }
                    else
                    {
                        data.ForEach(x =>
                        {
                            if (sendOrderList.Where(y => y == x.PKID).Count() <= 0)
                            {
                                result.Add(x);
                            }
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 5
0
        public static VideoUploadResponse UploadVideo(byte[] buffer, string extension, string fileName, string uploadDomain)
        {
            VideoUploadResponse result = null;

            try
            {
                if (buffer != null && !string.IsNullOrEmpty(extension) &&
                    !string.IsNullOrEmpty(fileName) &&
                    !string.IsNullOrEmpty(uploadDomain))
                {
                    using (var client = new FileUploadClient())
                    {
                        var getResult = client.UploadVideo(new FileUploadRequest()
                        {
                            Contents      = buffer,
                            DirectoryName = uploadDomain,
                            Extension     = extension
                        });
                        getResult.ThrowIfException(true);
                        if (getResult.Success && getResult.Exception == null)
                        {
                            result = getResult.Result;
                            buffer = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
        /// <summary>
        /// 添加或更新蓄电池券后价展示配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpSertBatteryCouponPriceDisplay(BatteryCouponPriceDisplayModel model)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                       _dal.GetBatteryCouponPriceDisplay(conn, model.Pid));
                if (oldValue == null)
                {
                    var pkid = dbScopeManagerConfiguration.Execute
                                   (conn => _dal.AddBatteryCouponPriceDisplay(conn, model));
                    result = pkid > 0;
                    if (result)
                    {
                        model.PKID               = pkid;
                        model.CreateDateTime     = DateTime.Now;
                        model.LastUpdateDateTime = DateTime.Now;
                        var log = new BatteryOprLogModel
                        {
                            LogType       = "BatteryCouponPriceDisplay",
                            IdentityId    = model.Pid,
                            OperationType = "Add",
                            OldValue      = null,
                            NewValue      = JsonConvert.SerializeObject(model),
                            Remarks       = $"添加蓄电池:{model.Pid}的券后价展示配置",
                            Operator      = _user,
                        };
                        LoggerManager.InsertLog("BatteryOprLog", log);
                    }
                }
                else
                {
                    model.CreateDateTime     = oldValue.CreateDateTime;
                    model.LastUpdateDateTime = DateTime.Now;
                    result = dbScopeManagerConfiguration.Execute(conn =>
                                                                 _dal.UpdateBatteryCouponPriceDisplay(conn, model));
                    if (result)
                    {
                        var log = new BatteryOprLogModel
                        {
                            LogType       = "BatteryCouponPriceDisplay",
                            IdentityId    = model.Pid,
                            OperationType = "Update",
                            OldValue      = JsonConvert.SerializeObject(oldValue),
                            NewValue      = JsonConvert.SerializeObject(model),
                            Remarks       = $"更新蓄电池:{model.Pid}的券后价展示配置",
                            Operator      = _user,
                        };
                        LoggerManager.InsertLog("BatteryOprLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpSertBatteryCouponPriceDisplay", ex);
            }
            return(result);
        }
        /// <summary>
        /// 添加或更新券后价展示配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpSertVendorProductCouponPriceConfig(VendorProductCouponPriceConfigModel model, string user)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                       _dal.GetVendorProductCouponPriceConfig(conn, model.ProductType, model.Pid));
                if (oldValue == null)
                {
                    var pkid = dbScopeManagerConfiguration.Execute
                                   (conn => _dal.AddVendorProductCouponPriceConfig(conn, model));
                    result = pkid > 0;
                    if (result)
                    {
                        model.PKID               = pkid;
                        model.CreateDateTime     = DateTime.Now;
                        model.LastUpdateDateTime = DateTime.Now;
                        var log = new OprVendorProductModel()
                        {
                            LogType     = "VendorProductCouponPriceConfig",
                            IdentityId  = $"{model.ProductType}_{model.Pid}",
                            OldValue    = null,
                            NewValue    = JsonConvert.SerializeObject(model),
                            Remarks     = $"添加{model.ProductType}:{model.Pid}的券后价展示配置",
                            OperateUser = user,
                        };
                        LoggerManager.InsertLog("OprVendorProduct", log);
                    }
                }
                else
                {
                    model.CreateDateTime     = oldValue.CreateDateTime;
                    model.LastUpdateDateTime = DateTime.Now;
                    result = dbScopeManagerConfiguration.Execute(conn =>
                                                                 _dal.UpdateVendorProductCouponPriceConfig(conn, model));
                    if (result)
                    {
                        var log = new OprVendorProductModel()
                        {
                            LogType     = "VendorProductCouponPriceConfig",
                            IdentityId  = $"{model.ProductType}_{model.Pid}",
                            OldValue    = JsonConvert.SerializeObject(oldValue),
                            NewValue    = JsonConvert.SerializeObject(model),
                            Remarks     = $"更新{model.ProductType}:{model.Pid}的券后价展示配置",
                            OperateUser = user,
                        };
                        LoggerManager.InsertLog("OprVendorProduct", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpSertVendorProductCouponPriceConfig", ex);
            }
            return(result);
        }
Exemplo n.º 8
0
 private static void LogPrint(LoggingCommon.ILog log)
 {
     log.Info("info message");
     log.Error(new InvalidDataException("just testing"));
     log.Debug("debug message");
     log.Warn("warn message");
     log.Error("error message");
     log.Fatal("fatal message");
 }
        /// <summary>
        /// 当前等级和类型的车型档次配置
        /// </summary>
        /// <param name="type"></param>
        /// <param name="vehicleLevel"></param>
        /// <returns></returns>
        public VehicleLevelModel SelectSprayPaintVehicleByLevel(string type, string vehicleLevel)
        {
            var result = new VehicleLevelModel();

            try
            {
                var configs = GRAlwaysOnReadDbScopeManager.Execute(conn =>
                                                                   DalSprayPaintVehicle.SelectSprayPaintVehicleByLevel(conn, type, vehicleLevel));
                if (configs != null && configs.Any())
                {
                    result = Convert2VehicleLevels(configs).FirstOrDefault(s => s.VehicleLevel.Equals(vehicleLevel));
                    var serviceInfo  = GetPaintServiceInfo();
                    var paintService = CFAlwaysOnReadDbScopeManager.Execute(conn => DalSprayPaintVehicle.SelectPaintServiceInfo(conn, result.VehicleLevel));
                    foreach (var service in paintService)
                    {
                        PaintService info = new PaintService
                        {
                            VehicleLevel = result.VehicleLevel,
                            ServiceId    = service.ServiceId,
                            DisplayIndex = service.DisplayIndex,
                            ServiceName  = serviceInfo.FirstOrDefault(p => p.ServiceId.Equals(service.ServiceId))?.ServersName
                        };
                        result.PaintService.Add(info);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("SelectSprayPaintVehicleByLevel", ex);
            }
            return(result);
        }
 /// <summary>
 /// 获取三方渠道链接申请列表
 /// </summary>
 /// <param name="recordCount"></param>
 /// <param name="orderChannel"></param>
 /// <param name="businessType"></param>
 /// <param name="status"></param>
 /// <param name="pageSize"></param>
 /// <param name="pageIndex"></param>
 /// <returns></returns>
 public List <ThirdPartyOrderChannellinkModel> GetTPOrderChannellinkList(out int recordCount, string orderChannel, string businessType, int status = 0, int pageSize = 10, int pageIndex = 1)
 {
     try
     {
         var result = DataAccess.DAO.DALThirdPartyOrderChannelLink.GetTPOrderChannellinkList(out recordCount, orderChannel, businessType, status, pageSize, pageIndex);
         foreach (var item in result)
         {
             var addList = new List <string>();
             if (item.IsAggregatePage)
             {
                 addList.Add("聚合页");
             }
             if (item.IsAuthorizedLogin)
             {
                 addList.Add("授权登录");
             }
             if (item.IsPartnerReceivSilver)
             {
                 addList.Add("合作方收银");
             }
             if (item.IsOrderBack)
             {
                 addList.Add("订单回传");
             }
             if (item.IsViewOrders)
             {
                 addList.Add("查看订单(浮层)");
             }
             if (item.IsViewCoupons)
             {
                 addList.Add("查看优惠券(浮层)");
             }
             if (item.IsContactUserService)
             {
                 addList.Add("联系客服(浮层)");
             }
             if (item.IsBackTop)
             {
                 addList.Add("返回顶部(浮层)");
             }
             var additionalResult = string.Join("、", addList);
             if (string.IsNullOrWhiteSpace(additionalResult))
             {
                 additionalResult = "无";
             }
             item.AdditionalRequirement = additionalResult;
         }
         return(result);
     }
     catch (Exception ex)
     {
         Logger.Error("GetTPOrderChannellinkList", ex);
         throw ex;
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// 获取标签配置
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IEnumerable <ArticleTabConfig> SelectArticleTabConfig(int pageIndex, int pageSize)
        {
            IEnumerable <ArticleTabConfig> result = null;

            try
            {
                result = dbScopeReadManager.Execute(conn => DalTagConfig.GetArticleTabConfig(conn, pageIndex, pageSize));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 获取三方码配置信息
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public List <ServiceCodeSourceConfig> GetServiceCodeSourceConfig(int pageIndex, int pageSize)
        {
            List <ServiceCodeSourceConfig> result = null;

            try
            {
                result = dbScopeReadManager.Execute(conn => DALThirdParty.GetServiceCodeSourceConfig(conn, pageIndex, pageSize));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 13
0
 /// <summary>
 /// 根据类别查询品牌名称
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public string[] GetProductPrioritySettingsBrand(string category)
 {
     try
     {
         return(TuhuProductcatalogReadDbScopeManager.Execute(conn =>
         {
             return DalProduct.GetProductBrand(conn, category);
         }));
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message, ex);
     }
     return(null);
 }
Exemplo n.º 14
0
        public List <NewCouponActivity> GetNewCouponConfig(string activityName, Guid activityId, int pageIndex, int pageSize)
        {
            List <NewCouponActivity> result = new List <NewCouponActivity>();

            try
            {
                result = dbScopeReadManager.Execute(conn => DALNewCoupon.SelectNewCouponConfig(conn, activityId, activityName, pageIndex, pageSize));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return(result);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 批量根据服务码获取服务码信息
        /// </summary>
        /// <param name="codes"></param>
        /// <returns></returns>
        public static IEnumerable <BeautyServicePackageDetailCode> GetBeautyServicePackageDetailCodesByCodes(IEnumerable <string> codes)
        {
            IEnumerable <BeautyServicePackageDetailCode> result = null;

            try
            {
                result = BeautyServicePackageDal.SelectBeautyServicePackageDetailCodesByCodes(codes);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            };

            return(result);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 获取限购配置
        /// </summary>
        /// <param name="packageDetailId"></param>
        /// <returns></returns>
        public BeautyServicePackageLimitConfig GetBeautyServicePackageLimitConfig()
        {
            BeautyServicePackageLimitConfig result = null;

            try
            {
                result = BeautyServicePackageDal.SelectBeautyServicePackageLimitConfigByPackageDetailId(config.PackageDetailId);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            }

            return(result);
        }
        public bool UpdateInstallTypeConfig(InstallTypeConfig config, string user)
        {
            bool result = false;

            if (config != null)
            {
                try
                {
                    string packageType = config.PackageType;
                    string imageUrl    = config.ImageUrl;

                    var prevData = GetInstallTypeConfigs();

                    dbScopeManager.CreateTransaction(conn =>
                    {
                        dalInstallType.UpdateImage(conn, packageType, imageUrl);
                        foreach (var installType in config.InstallTypes)
                        {
                            installType.TextFormat = JsonConvert.SerializeObject(installType.TextFormats);
                            dalInstallType.Update(conn, packageType, installType.Type, installType.IsDefault, installType.TextFormat);
                        }

                        result = true;
                    });

                    if (result)
                    {
                        var resultData = GetInstallTypeConfigs();
                        var log        = new
                        {
                            ObjectId    = packageType,
                            ObjectType  = "UpdateBaoYangInstallType",
                            BeforeValue = JsonConvert.SerializeObject(prevData.FirstOrDefault(o => string.Equals(o.PackageType, packageType))),
                            AfterValue  = JsonConvert.SerializeObject(resultData.FirstOrDefault(o => string.Equals(o.PackageType, packageType))),
                            Remark      = "",
                            Creator     = user
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex);
                }
            }

            return(result);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 车品相关商品,价格信息查询
        /// </summary>
        /// <param name="catalogId">类别id</param>
        /// <param name="onSale">是否上架:-1.全部 0.否 1.是 </param>
        /// <param name="isDaifa">是否代发:-1.全部 0.否 1.是 </param>
        /// <param name="stockOut">是否缺货:-1.全部 0.否 1.是 </param>
        /// <param name="hasPintuanPrice">是否有拼团价格:-1.全部 0.否 1.是 </param>
        /// <param name="keyWord">搜索关键词</param>
        /// <param name="keyWordSearchType">关键字查询方式:1.商品名称 2.商品PID</param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public static async Task <List <CarProductPriceModel> > GetCarProductMutliPriceByCatalog(string catalogId, int onSale,
                                                                                                 int isDaifa, int stockOut, int hasPintuanPrice, string keyWord, int keyWordSearchType, int page, int pageSize, string ProductName = "")
        {
            var list = new List <CarProductPriceModel>();
            var pids = new List <string>();

            try
            {
                var res = await GetPidsByFilter(catalogId, onSale, isDaifa, stockOut, hasPintuanPrice, keyWord, keyWordSearchType, page, pageSize, ProductName);

                if (!res.Success || res.Result.Pager.Total <= 0)
                {
                    return(list);
                }

                pids = res.Result.Source.ToList();


                //IConnectionManager cm = new ConnectionManager(conn_Gungnir);
                using (var conn = new SqlConnection(conn_Gungnir))
                {
                    list = await FullPriceData(pids, conn);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return(list);
            }
            return(list);
        }
Exemplo n.º 19
0
        public void Log <TState>(ML.LogLevel logLevel, ML.EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            var msg = formatter(state, exception);

            switch (logLevel)
            {
            case ML.LogLevel.Critical:
                logger.Fatal(msg);
                return;

            case ML.LogLevel.Debug:
                logger.Debug(msg);
                return;

            case ML.LogLevel.Error:
                logger.Error(msg);
                return;

            case ML.LogLevel.Information:
                logger.Info(msg);
                return;

            case ML.LogLevel.Trace:
                logger.Trace(msg);
                return;

            case ML.LogLevel.Warning:
                logger.Warn(msg);
                return;
            }
        }
        /// <summary>
        /// 查询进行中活动所有配置买三送一的数据
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static IEnumerable <SE_GiftManageConfigModel> SelectGiveAwayList(SqlConnection connection, int id = 0)
        {
            try
            {
                using (IDbConnection conn = connection)
                {
                    var sql = @"SELECT  P_PID,Id
                                    FROM    Configuration..SE_GiftManageConfig
                                    WHERE   GiveAway = 1
                                            AND State = 1
		                                    AND Type = 4
                                            AND ValidTimeEnd > GETDATE()
                                            AND ValidTimeBegin < GETDATE()";
                    if (id > 0)
                    {
                        sql += $"AND Id != {id}";
                    }
                    return(conn.Query <SE_GiftManageConfigModel>(sql));
                }
            }
            catch (Exception ex)
            {
                logger.Error($"SelectGiveAwayList:{ex.Message}", ex);
                return(new List <SE_GiftManageConfigModel>());
            }
        }
Exemplo n.º 21
0
        public static IEnumerable <CarPriceManagementResponse> SelectPurchaseInfoByPID(List <string> pids)
        {
            IEnumerable <CarPriceManagementResponse> result = new List <CarPriceManagementResponse>();

            try
            {
                if (pids != null && pids.Any())
                {
                    List <CarPriceManagementRequest> pidList = new List <CarPriceManagementRequest>();
                    pids.ForEach(x => pidList.Add(new CarPriceManagementRequest()
                    {
                        PID = x
                    }));
                    using (var client = new PurchaseClient())
                    {
                        var getResult = client.SelectPurchaseInfoByPID(pidList);
                        getResult.ThrowIfException(true);
                        result = getResult.Result;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 22
0
        public IEnumerable <BeautyServicePackageSimpleModel> GetPackagesByPackageType(string packageType)
        {
            var packages = null as IEnumerable <BeautyServicePackageSimpleModel>;

            try
            {
                packages = TuhuGrouponDbScopeManagerReadOnly.Execute(conn => handler.GetPackagesByPackageType(conn, packageType));
            }
            catch (Exception ex)
            {
                Logger.Error("GetPackagesByPackageType", ex);
            }
            return(packages);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 添加或更新选车攻略配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpSertVehicleArticle(VehicleArticleModel model)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                       DalVehicleArticle.GetVehicleArticle(conn, model));
                if (oldValue == null)
                {
                    model.CreateDateTime = DateTime.Now;
                    var pkid = dbScopeManagerConfiguration.Execute
                                   (conn => DalVehicleArticle.AddVehicleArticle(conn, model));
                    result = pkid > 0;
                    if (result)
                    {
                        model.PKID = pkid;
                        model.LastUpdateDateTime = DateTime.Now;
                        var log = new VehicleArticleOprLogModel
                        {
                            LogType       = "VehicleArticle",
                            IdentityId    = $"{model.VehicleId}_{model.PaiLiang}_{model.Nian}",
                            OperationType = "Add",
                            OldValue      = null,
                            NewValue      = JsonConvert.SerializeObject(model),
                            Remarks       = $"添加选车攻略:{model.VehicleId}_{model.PaiLiang}_{model.Nian}的配置",
                            Operator      = _user,
                        };
                        LoggerManager.InsertLog("VehicleArticleOprLog", log);
                    }
                }
                else
                {
                    model.CreateDateTime     = oldValue.CreateDateTime;
                    model.LastUpdateDateTime = DateTime.Now;
                    result = dbScopeManagerConfiguration.Execute(conn =>
                                                                 DalVehicleArticle.UpdateVehicleArticle(conn, model));
                    if (result)
                    {
                        var log = new VehicleArticleOprLogModel
                        {
                            LogType       = "VehicleArticle",
                            IdentityId    = $"{model.VehicleId}_{model.PaiLiang}_{model.Nian}",
                            OperationType = "Update",
                            OldValue      = JsonConvert.SerializeObject(oldValue),
                            NewValue      = JsonConvert.SerializeObject(model),
                            Remarks       = $"更新选车攻略:{ model.VehicleId }_{ model.PaiLiang }_{ model.Nian }的配置",
                            Operator      = _user,
                        };
                        LoggerManager.InsertLog("VehicleArticleOprLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpSertVehicleArticle", ex);
            }
            return(result);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 根据门店ShopId列表获取简略门店详细信息
        /// </summary>
        /// <param name="shopIds"></param>
        /// <returns></returns>
        public static IEnumerable <ShopSimpleDetailModel> SelectShopSimpleDetails(List <int> shopIds)
        {
            IEnumerable <ShopSimpleDetailModel> result = null;

            try
            {
                using (var client = new Tuhu.Service.Shop.ShopClient())
                {
                    var getResult = client.SelectShopSimpleDetails(shopIds);
                    getResult.ThrowIfException(true);
                    result = getResult.Result;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
        /// <summary>
        /// 获取团购商品信息
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="activityStatus"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public List <GroupBuyingProductGroupConfigEntity> SelectGroupBuyingV2Config(GroupBuyingProductGroupConfigEntity filter, string activityStatus, int pageIndex, int pageSize)
        {
            List <GroupBuyingProductGroupConfigEntity> result = new List <GroupBuyingProductGroupConfigEntity>();

            try
            {
                List <GroupBuyingStockModel> stockInfo = new List <GroupBuyingStockModel>();
                dbScopeReadManager.Execute(conn =>
                {
                    if (!string.IsNullOrEmpty(filter.PID) || !string.IsNullOrEmpty(filter.ProductName))
                    {
                        var filterData = DalGroupBuyingProductGroupConfig.GetGroupBuyingProductConfig(conn,
                                                                                                      filter.PID, filter.ProductName);
                        if (filterData != null && filterData.Any())
                        {
                            result = DalGroupBuyingProductGroupConfig.GetGroupBuyingV2Config(conn, filter,
                                                                                             activityStatus, filterData.Select(x => x.ProductGroupId).ToList(), pageIndex, pageSize);
                        }
                    }
                    else
                    {
                        result = DalGroupBuyingProductGroupConfig.GetGroupBuyingV2Config(conn, filter,
                                                                                         activityStatus, new List <string> {
                            filter.ProductGroupId
                        }, pageIndex, pageSize);
                    }
                    if (result != null && result.Any())
                    {
                        result.ForEach(x =>
                        {
                            x.GroupProductDetails = DalGroupBuyingProductGroupConfig.GetGroupBuyingV2ProductConfigByGroupId(conn, new List <string> {
                                x.ProductGroupId
                            });
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 添加年检代办配置
        /// </summary>
        /// <param name="model"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool AddVehicleAnnualInspectionAgent(VehicleAnnualInspectionAgentModel model, string user)
        {
            var result = false;

            try
            {
                var oldValue = GetVehicleAnnualInspectionAgent(model.ServicePid, model.TelNum, model.CarNoPrefix);
                if (oldValue == null)
                {
                    var pkid = dbScopeManagerConfiguration.Execute
                                   (conn => DalVehicleAnnualInspectionAgent.AddVehicleAnnualInspectionAgent(conn, model));
                    result     = pkid > 0;
                    model.PKID = pkid;
                }
                else if (oldValue.IsDeleted)
                {
                    model.PKID = oldValue.PKID;
                    result     = dbScopeManagerConfiguration.Execute
                                     (conn => DalVehicleAnnualInspectionAgent.UpdateVehicleAnnualInspectionAgent(conn, model));
                }
                model.CreateDateTime     = DateTime.Now;
                model.LastUpdateDateTime = DateTime.Now;
                var log = new AnnualInspectionOprLogModel
                {
                    LogType       = "VehicleAnnualInspectionAgent",
                    IdentityId    = $"{model.CarNoPrefix}_{model.ServicePid}_{model.TelNum}",
                    OperationType = "Add",
                    OldValue      = null,
                    NewValue      = JsonConvert.SerializeObject(model),
                    Remarks       = $"添加{model.CarNoPrefix},供应商:{model.VenderShortName}," +
                                    $"服务Pid:{model.ServicePid},联系人:{model.Contact},联系电话:{model.TelNum}," +
                                    $"的{model.ServiceName}服务",
                    Operator = user,
                };
                LoggerManager.InsertLog("AnnualInspectOprLog", log);
            }
            catch (Exception ex)
            {
                result = false;
                Logger.Error("AddVehicleAnnualInspectionAgent", ex);
            }
            return(result);
        }
Exemplo n.º 27
0
        public static OrderModel FetchOrderByOrderId(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = orderClient.FetchOrderByOrderId(orderId);
                    fetchResult.ThrowIfException(true);
                    order = fetchResult.Success ? fetchResult.Result : null;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(order);
        }
 public static IEnumerable <SE_GiftManageConfigModel> SelectGiveAwayList(int id = 0)
 {
     try
     {
         return(SE_GiftManageConfigDAL.SelectGiveAwayList(ProcessConnection.OpenConfigurationReadOnly, id));
     }
     catch (Exception ex)
     {
         logger.Error($"SelectGiveAwayList:{ex.Message}", ex);
         return(new List <SE_GiftManageConfigModel>());
     }
 }
Exemplo n.º 29
0
        public static List <DataAccess.Entity.Discovery.Category> GetYouXuanCategoryList()
        {
            List <DataAccess.Entity.Discovery.Category> result = new List <DataAccess.Entity.Discovery.Category>();

            try
            {
                result = CategoryDal.GetALLYouXuanCategoryList(ProcessConnection.OpenMarketingReadOnly);
                if (result != null && result.Any())
                {
                    result = result.Where(x => x.ParentId == 0).Select(t => new DataAccess.Entity.Discovery.Category
                    {
                        Id               = t.Id,
                        Name             = t.Name,
                        Image            = t.Image,
                        Disable          = t.Disable,
                        Describe         = t.Describe,
                        ChildrenCategory = result.Where(ct => ct.ParentId == t.Id).ToList()
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 30
0
        public static bool UpdateInsuranceIndex(List <int> insuranceIds)
        {
            bool success = false;

            try
            {
                dbScopeManager.CreateTransaction(conn =>
                {
                    var index = 0;
                    foreach (var insuranceId in insuranceIds)
                    {
                        DalCarInsuranceConfig.UpdateInsuranceIndex(conn, insuranceId, ++index);
                    }
                    success = true;
                });
            }
            catch (Exception ex)
            {
                Logger.Error("UpdateInsuranceIndex", ex);
            }
            return(success);
        }