コード例 #1
0
        /// <summary>
        /// 添加配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public BaoYangResultEntity <bool> InsertBatteryLevelUp(BatteryLevelUpEntity model, string name)
        {
            var result = new BaoYangResultEntity <bool>();

            try
            {
                result = SaveCheckBatteryLevelUp(model);
                if (result.Status)
                {
                    result = dbScopeManagerBaoYang.Execute(conn =>
                    {
                        result.Data = DALBatteryLevelUp.InsertBatteryLevelUp(conn, model);
                        return(result);
                    });
                    if (result.Data)
                    {
                        SaveBatteryLevelUpLog(null, model, name);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                result = new BaoYangResultEntity <bool>()
                {
                    Status = false, Msg = "修改失败"
                };
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 查询年检代办配置
        /// </summary>
        /// <param name="servicePid"></param>
        /// <param name="carNoPrefix"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Tuple <List <VehicleAnnualInspectionAgentModel>, int> SelectVehicleAnnualInspectionAgent
            (string servicePid, string carNoPrefix, int pageIndex, int pageSize)
        {
            var result     = null as List <VehicleAnnualInspectionAgentModel>;
            var totalCount = 0;

            try
            {
                var configs = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                      DalVehicleAnnualInspectionAgent.SelectVehicleAnnualInspectionAgent(conn, servicePid, carNoPrefix, pageIndex, pageSize, out totalCount))
                              ?? new List <VehicleAnnualInspectionAgentModel>();
                var allService = GetAllAnnualInspectionService();
                configs.ForEach(
                    f =>
                {
                    var service   = allService.Where(w => string.Equals(w.ServicePid, f.ServicePid))?.FirstOrDefault();
                    f.ServiceName = service?.ServiceName;
                });
                result = configs;
            }
            catch (Exception ex)
            {
                result = null;
                Logger.Error("SelectVehicleAnnualInspectionAgent", ex);
            }
            return(Tuple.Create(result, totalCount));
        }
コード例 #3
0
        public Tuple <bool, string> InsertRebateConfig(RebateConfigModel data, string user)
        {
            var result = 0;
            var msg    = string.Empty;

            try
            {
                dbScopeManager.Execute(conn =>
                {
                    var existedData = DALRebateConfig.SelectRebateApplyConfigByParam(conn, data);
                    existedData     = existedData.Where(_ => String.Equals(_.Source, "爱卡") || String.Equals(_.Source, "汽车之家")).ToList();
                    if (existedData?.Where(x => String.Equals(x.OrderId, data.OrderId)).Count() > 0 ||
                        existedData?.Where(x => String.Equals(x.UserPhone, data.UserPhone)).Count() > 0)
                    {
                        msg = "每个客户只能参与一次(包含手机号、订单号、微信号)均视为同一客户";
                    }
                    else
                    {
                        data.RebateMoney = 58M;
                        data.Status      = Status.Applying;
                        result           = DALRebateConfig.InsertRebateConfig(conn, data);
                    }
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            InsertLog(result.ToString(), "InsertRebateConfig", result > 0 ? "添加成功" : "添加失败", $"PKID:{result.ToString()},Status:Applying", string.Empty, string.Empty, user);
            return(Tuple.Create(result > 0, msg));
        }
コード例 #4
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool AddBaoYangBatteryCoverArea(BaoYangBatteryCoverArea item)
        {
            var success = false;

            try
            {
                item.PKID = dbScopeManagerBaoYang.Execute(conn => _battery.AddBaoYangBatteryCoverArea(conn, item));
                if (item.PKID > 0)
                {
                    success = true;
                }
                if (success)
                {
                    var key = $"BaoYangBatteryCoverAreaConfigs/{{0}}/{item.CityId}";
                    RemoveCache(new[] { key });
                    InsertBaoYangOprLog(new BaoYangOprLog
                    {
                        Remarks     = "Add",
                        OperateUser = _operator,
                        NewValue    = JsonConvert.SerializeObject(item),
                        OldValue    = string.Empty,
                        IdentityID  = item.PKID.ToString(),
                        LogType     = "BaoYangBatteryCoverArea",
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            }
            return(success);
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
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));
        }
コード例 #7
0
        /// <summary>
        /// 插入透明工场配置记录
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        public bool ImportLiveWorkShopConfig(List <LiveWorkShopConfigModel> models)
        {
            var result = false;

            try
            {
                var existsConfig = dbScopeManagerConfigRead.Execute(conn => DalLiveWorkShopConfig.GetExistLiveWorkShopConfig(conn));
                var delConfig    = existsConfig.Where(s => !models.Any(m => string.Equals(m.TypeName, s.TypeName) && m.SortNumber == s.SortNumber)).Select(v => v.PKID).ToList();
                dbScopeManagerConfig.CreateTransaction(conn =>
                {
                    foreach (var model in models)
                    {
                        DalLiveWorkShopConfig.ImportLiveWorkShopConfig(conn, model);
                    }
                    foreach (var pkid in delConfig)
                    {
                        DalLiveWorkShopConfig.DeleteLiveWorkShopConfig(conn, pkid);
                    }
                });
                result = true;
            }
            catch (Exception ex)
            {
                Logger.Error("ImportLiveWorkShopConfig", ex);
            }
            return(result);
        }
コード例 #8
0
        /// <summary>
        /// 添加模块权限
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public Tuple <bool, string> InsertActivityBoardPowerConfig(ActivityBoardPermissionConfig data)
        {
            var result = false;
            var msg    = "数据为空";

            try
            {
                if (data != null)
                {
                    dbScopeManager.Execute(conn =>
                    {
                        var info = DALActivityBoardPower.SelectPowerConfigByUserEmail(conn, data.UserEmail.Trim(), data.ModuleType);
                        if (info == null)
                        {
                            result = DALActivityBoardPower.InsertActivityBoardPowerConfig(conn, data) > 0;
                        }
                        else
                        {
                            msg = "此用户的该模块权限已配置";
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                msg = "操作异常";
                logger.Log(Level.Error, ex, "InsertActivityBoardPowerConfig");
            }

            return(Tuple.Create(result, msg));
        }
コード例 #9
0
        /// <summary>
        /// 编辑覆盖区域
        /// </summary>
        /// <param name="model"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool EditCoverArea(VendorProductCoverAreaModel model, string user)
        {
            bool result = false;

            try
            {
                var oldValue = _dbScopeManagerConfigRead.Execute(conn =>
                                                                 _dal.GetVendorProductConverAreaByPKID(conn, model.PKID));
                if (oldValue != null && !oldValue.IsDeleted)
                {
                    model.CreateDateTime     = oldValue.CreateDateTime;
                    model.LastUpdateDateTime = DateTime.Now;
                    result = _dbScopeManagerConfig.Execute(conn => _dal.EditVendorProductCoverArea(conn, model));
                    if (result)
                    {
                        _baoYangManager.InsertLog("OprVendorProduct", new OprVendorProductModel()
                        {
                            LogType        = "VendorProductCoverArea",
                            IdentityId     = $"{model.ProductType}_{model.CoverType}_{model.CoverRegionId}_{model.Brand ?? model.Pid}",
                            OldValue       = JsonConvert.SerializeObject(oldValue),
                            NewValue       = JsonConvert.SerializeObject(model),
                            OperateUser    = user,
                            Remarks        = "Update",
                            CreateDateTime = DateTime.Now
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error("EditCoverArea", ex);
            }
            return(result);
        }
コード例 #10
0
        /// <summary>
        /// 特殊车型附加安装费开关控制
        /// </summary>
        /// <param name="isOpen"></param>
        /// <returns></returns>
        public bool UpdateVehicleAdditionalPriceSwitch(bool isOpen)
        {
            var result = false;

            try
            {
                var switchStatus = dbScopeManagerConfigRead.Execute(conn => DalBaoYangInstallFeeConfig.IsExistVehicleAdditionalPriceSwitch(conn));
                if (string.IsNullOrWhiteSpace(switchStatus))
                {
                    result = dbScopeManagerConfig.Execute(conn => DalBaoYangInstallFeeConfig.AddVehicleAdditionalPriceSwitch(conn, isOpen));
                }
                else
                {
                    result = dbScopeManagerConfig.Execute(conn => DalBaoYangInstallFeeConfig.UpdateVehicleAdditionalPriceSwitch(conn, isOpen));
                }
                if (result)
                {
                    RefreshVehicleAdditionalPriceCache();
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpdateVehicleAdditionalPriceSwitch", ex);
            }
            return(result);
        }
コード例 #11
0
        public List <TirePatternChangeLog> SelectTirePatternChangeLog(string pattern)
        {
            Func <SqlConnection, List <TirePatternChangeLog> > action =
                (connection) => DalTirePatternConfig.SelectTirePatternChangeLog(connection, pattern);

            return(dbManager.Execute(action));
        }
コード例 #12
0
        /// <summary>
        /// 添加配置
        /// </summary>
        /// <param name="priority"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool AddBatteryFastDeliveryPriority(BatteryFastDeliveryPriority priority, string user)
        {
            var success = false;

            try
            {
                priority.PKID = dbScopeManagerGungnir.Execute(conn => DalBatteryFastDelivery.AddBatteryFastDeliveryPriority(conn, priority));
                success       = priority.PKID > 0;
                if (success)
                {
                    RecordOperationLog(new BaoYangOprLog
                    {
                        IdentityID  = priority.PKID.ToString(),
                        LogType     = "BatteryFastDeliveryPriority",
                        NewValue    = JsonConvert.SerializeObject(priority),
                        OldValue    = string.Empty,
                        OperateUser = user,
                        Remarks     = "add",
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(nameof(AddBatteryFastDeliveryPriority), ex);
            }
            return(success);
        }
コード例 #13
0
 public Dictionary <string, ProductSalesPredic> RefreshProductSalespredictBIData()
 {
     try
     {
         var list = dbScopeManagerBI.Execute(
             conn => ProductLibraryConfigDAL.QueryProductSalesInfo(conn));
         var data      = list.GroupBy(x => x.PID).ToDictionary(k => k.Key, v => v.FirstOrDefault());
         int pageSize  = 1000;
         int pageTotal = (data.Count - 1) / pageSize + 1;
         //每次存进去1000条
         for (var pageIndex = 1; pageIndex <= pageTotal; pageIndex++)
         {
             var result = data.Skip((pageIndex - 1) * pageSize).Take(pageSize)
                          .ToDictionary(x => x.Key, x => (object)x.Value);
             using (var client = CacheHelper.CreateHashClient("ProductSalespredictBIData", TimeSpan.FromDays(1)))
             {
                 client.Set(result);
             }
         }
         return(data);
     }
     catch (Exception ex)
     {
         logger.Log(Level.Error, ex.ToString());
     }
     return(new Dictionary <string, ProductSalesPredic>());
 }
コード例 #14
0
        public List <BatteryFastDeliveryForViewModel> GetAllBatteryForView(int fastDeliveryId)
        {
            List <BatteryFastDeliveryForViewModel> allBattery = null;

            try
            {
                var sort = new List <string> {
                    "风帆", "瓦尔塔"
                };
                var batteries = dbScopeManagerProductRead.Execute(conn =>
                                                                  DalBatteryFastDelivery.GetAllBattery(conn)//获取所有的蓄电池信息
                                                                  );
                allBattery = batteries.OrderBy(x =>
                {
                    var index = sort.FindIndex(o => x.Brand.Contains(o));
                    if (index < 0)
                    {
                        index = int.MaxValue;
                    }
                    return(index);
                }).ToList();
                if (fastDeliveryId > 0)
                {
                    var existBattery = dbScopeManagerConfigRead.Execute(conn =>
                                                                        DalBatteryFastDelivery.GetBatteryFastDeliveryProductsByFastDeliveryId(conn, fastDeliveryId.ToString())
                                                                        ).Select(s => s.ProductPid).ToList();//勾选已选中的蓄电池
                    allBattery.ForEach(s => s.IsChecked = existBattery.Contains(s.PID));
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllBatteryForView", ex);
            }
            return(allBattery);
        }
コード例 #15
0
        /// <summary>
        /// 添加活动信息
        /// </summary>
        /// <param name="data"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool InsertThirdPartActivity(ThirdPartActivity data, string user)
        {
            var result = 0;

            try
            {
                if (data != null)
                {
                    dbScopeManager.Execute(conn =>
                    {
                        result = DALThirdPartActivity.InsertThirdPartActivity(conn, data);
                    });
                }
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex, "InsertThirdPartActivity");
            }

            if (result > 0)
            {
                ActivityBoardManager.InsertLog("InsertThirdPartActivity", result.ToString(),
                                               $"Data:{JsonConvert.SerializeObject(data)}", result > 0 ? "添加成功" : "添加失败", user, LogType);
                CallCRMService.NewAddActivity(data.ActivityName, data.StartTime, data.EndTime, data.WebUrl, data.ActivityRules, result.ToString(), CRMSourceType.ActivityBoaardThirdParty, user);
            }

            return(result > 0);
        }
コード例 #16
0
        public List <RebateConfigModel> SelectRebateConfig(Status status, string orderId, string phone,
                                                           string wxId, string remarks, string timeType, DateTime?startTime, DateTime?endTime,
                                                           string wxName, string principalPerson, string rebateMoney, string source, int pageIndex, int pageSize)
        {
            var result = new List <RebateConfigModel>();

            try
            {
                dbScopeReadManager.Execute(conn =>
                {
                    result = DALRebateConfig.GetRebateConfig(conn, status, orderId ?? string.Empty, phone, wxId, remarks,
                                                             timeType, startTime, endTime, wxName, principalPerson, rebateMoney, source, pageIndex, pageSize);
                    if (result != null && result.Any() && pageSize != 9999999)
                    {
                        var pay = PayService.QueryWxPayStatus("途虎朋友圈点赞返现", "WX_QIYEFUKUAN", result.Select(x => x.OrderId.ToString()).ToList());
                        foreach (var item in result)
                        {
                            var payInfo      = pay?.Where(x => String.Equals(x.OrderNo, item.OrderId.ToString()))?.FirstOrDefault();
                            item.PayStatus   = payInfo?.PayStatus ?? 0;
                            item.RedOutbizNo = payInfo?.WxPayOrderNo ?? string.Empty;
                            item.Reason      = payInfo?.Reason ?? string.Empty;
                            item.UserPhone   = item.UserPhone.Substring(0, 3) + "****" + item.UserPhone.Substring(item.UserPhone.Length - 4, 4);
                            item.ImgList     = DALRebateConfig.GetRebateApplyImageConfig(conn, item.PKID, ImgSource.UserImg);
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
コード例 #17
0
        public List <DianpingGroupConfig> GetGroupConfigs(int pageIndex, int pageSize,
                                                          string dianpingId, string dianpingBrand, string dianpingName, string tuhuProductId, int status)
        {
            var groups = dbScopeReadManager.Execute(conn => dalGroupConfig.SelectGroupConfigs(conn, pageIndex,
                                                                                              pageSize, dianpingId, dianpingBrand, dianpingName, tuhuProductId, status));

            if (groups != null && groups.Any())
            {
                var ids = groups.Select(o => o.TuhuProductId).Distinct();

                Dictionary <string, string> names = new Dictionary <string, string>();
                foreach (var id in ids)
                {
                    var name = GetTuhuProductName(id);
                    if (!string.IsNullOrEmpty(name))
                    {
                        names[id] = name;
                    }
                }

                foreach (var group in groups)
                {
                    if (names.ContainsKey(group.TuhuProductId))
                    {
                        group.TuhuProductName = names[group.TuhuProductId];
                    }
                }
            }

            return(groups);
        }
コード例 #18
0
        public bool AddTipBannerTypeConfig(TipBannerTypeConfigModel model, string user)
        {
            var result = false;

            try
            {
                var pkid = dbScopeManagerConfig.Execute(conn => DalTipBannerConfig.AddTipBannerTypeConfig(conn, model));
                if (pkid > 0)
                {
                    result       = true;
                    model.TypeId = pkid;
                    var log = new BaoYangOprLog
                    {
                        LogType     = "TipBannerTypeConfig",
                        IdentityID  = model.TypeName,
                        OldValue    = null,
                        NewValue    = JsonConvert.SerializeObject(model),
                        Remarks     = "AddType",
                        OperateUser = user,
                    };
                    LoggerManager.InsertLog("BYOprLog", log);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("AddTipBannerTypeConfig", ex);
            }

            return(result);
        }
コード例 #19
0
        public List <RebateConfigModel> SelectRebateConfig(Status status, string orderId, string phone,
                                                           string wxId, string remarks, string timeType, DateTime?startTime, DateTime?endTime,
                                                           string wxName, string principalPerson, string rebateMoney, int pageIndex, int pageSize)
        {
            var result = new List <RebateConfigModel>();

            try
            {
                dbScopeReadManager.Execute(conn =>
                {
                    result = DALRebateConfig.GetRebateConfig(conn, status, orderId ?? string.Empty, phone, wxId, remarks,
                                                             timeType, startTime, endTime, wxName, principalPerson, rebateMoney, pageIndex, pageSize);
                    if (result != null && result.Any())
                    {
                        foreach (var item in result)
                        {
                            item.ImgList = DALRebateConfig.GetRebateApplyImageConfig(conn, item.PKID, ImgSource.UserImg);
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
コード例 #20
0
        /// <summary>
        /// 查询喷漆打折配置
        /// </summary>
        /// <param name="servicePid"></param>
        /// <param name="carNoPrefix"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Tuple <List <PaintDiscountConfigModel>, int> SelectPaintDiscountConfig
            (string servicePid, int pageIndex, int pageSize)
        {
            var result     = null as List <PaintDiscountConfigModel>;
            var totalCount = 0;

            try
            {
                var configs = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                      DalPaintDiscountConfig.SelectPaintDiscountConfig(conn, servicePid, pageIndex, pageSize, out totalCount))
                              ?? new List <PaintDiscountConfigModel>();
                var allService = GetAllPaintDiscountService();
                configs.ForEach(
                    f =>
                {
                    var service   = allService.Where(w => string.Equals(w.ServicePid, f.ServicePid))?.FirstOrDefault();
                    f.ServiceName = service?.ServiceName;
                });
                result = configs;
            }
            catch (Exception ex)
            {
                result = null;
                Logger.Error("SelectPaintDiscountConfig", ex);
            }
            return(Tuple.Create(result, totalCount));
        }
コード例 #21
0
        public Tuple <bool, bool> DeleteBatteryFastDelivery(int fastDeliveryId, int regionId)
        {
            var result      = false;
            var cacheResult = true;

            try
            {
                var products = dbScopeManagerConfigRead.Execute(conn => DalBatteryFastDelivery.GetBatteryFastDeliveryProductsByFastDeliveryId(conn, fastDeliveryId.ToString()))
                               .Select(s => s.ProductPid).ToList();
                if (products.Any())
                {
                    dbScopeManagerConfig.CreateTransaction(conn =>
                    {
                        var delMain    = DalBatteryFastDelivery.DeleteBatteryFastDelivery(conn, fastDeliveryId);
                        var delProduct = DalBatteryFastDelivery.DeleteBatteryProductsByFastDeliveryId(conn, fastDeliveryId);
                        if (delMain && delProduct)
                        {
                            cacheResult = RefreshFastDeliveryServiceCache(regionId, products);
                            result      = true;
                        }
                    });
                }
                else
                {
                    result = dbScopeManagerConfig.Execute(conn => DalBatteryFastDelivery.DeleteBatteryFastDelivery(conn, fastDeliveryId));
                }
            }
            catch (Exception ex)
            {
                Logger.Error("DeleteBatteryFastDelivery", ex);
            }
            return(Tuple.Create(result, cacheResult));
        }
コード例 #22
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);
        }
コード例 #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);
        }
コード例 #24
0
        /// <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);
        }
コード例 #25
0
        public string GetConfigXml(string configName)
        {
            var result = string.Empty;

            result = dbScopeManagerBY.Execute(conn => DalBaoYangConfig.SelectConfig(conn, configName));

            return(result);
        }
コード例 #26
0
        /// <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);
        }
コード例 #27
0
        public List <InstallTypeConfig> GetInstallTypeConfigs()
        {
            var result = dbScopeManagerRead.Execute(conn => dalInstallType.SelectInstallTypeConfig(conn));

            if (result != null && result.Any())
            {
                IEnumerable <BaoYangPackageDescription> packages = null;
                using (var client = new BaoYangClient())
                {
                    var sericeResult = client.GetBaoYangPackageDescription();
                    if (sericeResult.Success && sericeResult.Result != null)
                    {
                        packages = sericeResult.Result;
                    }
                }

                if (packages != null)
                {
                    foreach (var config in result)
                    {
                        if (packages.Any(o => string.Equals(o.PackageType, config.PackageType)))
                        {
                            var package = packages.First(o => string.Equals(o.PackageType, config.PackageType));
                            config.PackageName  = package.ZhName;
                            config.InstallTypes = config.InstallTypes.Where(o => !string.IsNullOrEmpty(o.Name)).ToList();
                            foreach (var installType in config.InstallTypes)
                            {
                                foreach (var type in installType.BaoYangTypeList)
                                {
                                    if (installType.BaoYangTypeNameList == null)
                                    {
                                        installType.BaoYangTypeNameList = new List <string>();
                                    }

                                    if (package.Items.Any(o => string.Equals(o.BaoYangType, type)))
                                    {
                                        var item = package.Items.First(o => string.Equals(o.BaoYangType, type));

                                        installType.BaoYangTypeNameList.Add(item.ZhName);
                                    }
                                }

                                installType.BaoYangTypeNames = string.Join(",", installType.BaoYangTypeNameList);

                                if (!string.IsNullOrEmpty(installType.TextFormat))
                                {
                                    installType.TextFormats = JsonConvert.DeserializeObject <List <InstallTypeText> >(installType.TextFormat);
                                }
                            }
                        }
                    }
                }
            }

            return(result.Where(o => o.InstallTypes.Count > 1).ToList());
        }
コード例 #28
0
        public bool UpdateVipBaoYangPackage(VipBaoYangPackageViewModel package)
        {
            var success = false;

            try
            {
                var inputPackage = new VipBaoYangPackageDbModel(package);
                var dbPackage    = dbScopeReadManager.Execute(conn => DALVipBaoYangPackage.SelectVipBaoYangPackageByPkid(conn, package.PKID));
                if (dbPackage != null)
                {
                    var oldData = JsonConvert.SerializeObject(dbPackage);
                    dbPackage.Brands = inputPackage.Brands;

                    success = dbScopeManager.Execute(conn => DALVipBaoYangPackage.UpdateVipBaoYangPackage(conn, dbPackage));
                    if (success)
                    {
                        dbPackage.LastUpdateDateTime = DateTime.Now;
                        var newData = JsonConvert.SerializeObject(dbPackage);
                        InsertLog(dbPackage.PID, oldData, newData, "Update", package.CreateUser);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return(success);
        }
コード例 #29
0
        /// <summary>
        /// 获取配置列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public BaoYangResultEntity <Tuple <int, List <BatteryLevelUpReslut> > > GetBatteryLeveUpList(BatteryLevelUpRequest model)
        {
            var result = new BaoYangResultEntity <Tuple <int, List <BatteryLevelUpReslut> > >()
            {
                Status = false
            };

            try
            {
                List <BatteryLevelUpReslut> list = new List <BatteryLevelUpReslut>();
                var btaaeryTuple = dbScopeManagerBaoYangRead.Execute(conn =>
                {
                    var data = DALBatteryLevelUp.GetBatteryLeveUpList(conn, model);
                    return(data);
                });
                var pids = btaaeryTuple.Item2.Select(x => x.NewPID).ToList();
                pids.AddRange(btaaeryTuple.Item2.Select(x => x.OriginalPID).ToList());
                pids = pids.Distinct().ToList();
                var productDic = new ProductManager().SelectProductDetail(pids);
                foreach (var item in btaaeryTuple.Item2)
                {
                    BatteryLevelUpReslut resultModel = new BatteryLevelUpReslut()
                    {
                        Copywriting        = item.Copywriting,
                        NewPID             = item.NewPID,
                        OriginalPID        = item.OriginalPID,
                        CreateDateTime     = item.CreateDateTime,
                        IsEnabled          = item.IsEnabled,
                        PKID               = item.PKID,
                        LsatUpdateDateTime = item.LsatUpdateDateTime
                    };
                    if (productDic.ContainsKey(item.NewPID))
                    {
                        resultModel.NewDisplayName = productDic[item.NewPID].Name;
                    }
                    if (productDic.ContainsKey(item.OriginalPID))
                    {
                        resultModel.OriginalDisplayName = productDic[item.OriginalPID].Name;
                    }
                    list.Add(resultModel);
                }
                result.Data   = Tuple.Create(btaaeryTuple.Item1, list);
                result.Status = true;
                return(result);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                result = new BaoYangResultEntity <Tuple <int, List <BatteryLevelUpReslut> > >()
                {
                    Status = false, Msg = "获取失败"
                };
            }
            return(result);
        }
コード例 #30
0
        /// <summary>
        /// 编辑优先级
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        public bool UpSertVendorProductPriorityConfigPriority(VendorProductPriorityConfigModel model, string user)
        {
            var result = false;

            try
            {
                var oldValue = _dbScopeManagerConfigRead.Execute(conn =>
                                                                 _dal.GetVendorProductPriorityConfigByPKID(conn, model.PKID));
                if (oldValue != null)
                {
                    model.CreateDateTime     = oldValue.CreateDateTime;
                    model.LastUpdateDateTime = DateTime.Now;
                    result = _dbScopeManagerConfig.Execute(conn => _dal.EditVendorProductPriorityConfig(conn, model));
                    if (result)
                    {
                        _baoYangManager.InsertLog("OprVendorProduct", new OprVendorProductModel()
                        {
                            LogType        = "VendorProductPriorityConfig",
                            IdentityId     = $"{model.ProductType}_{model.ConfigType}_{model.VehicleId ?? model.RegionId.ToString()}",
                            OldValue       = JsonConvert.SerializeObject(oldValue),
                            NewValue       = JsonConvert.SerializeObject(model),
                            OperateUser    = user,
                            Remarks        = "Update",
                            CreateDateTime = DateTime.Now,
                        });
                    }
                }
                else
                {
                    var pkid = _dbScopeManagerConfig.Execute(conn => _dal.AddVendorProductPriorityConfig(conn, model));
                    result = pkid > 0;
                    if (result)
                    {
                        model.PKID               = pkid;
                        model.CreateDateTime     = DateTime.Now;
                        model.LastUpdateDateTime = DateTime.Now;
                        _baoYangManager.InsertLog("OprVendorProduct", new OprVendorProductModel()
                        {
                            LogType        = "VendorProductPriorityConfig",
                            IdentityId     = $"{model.ProductType}_{model.ConfigType}_{model.VehicleId ?? model.RegionId.ToString()}",
                            OldValue       = string.Empty,
                            NewValue       = JsonConvert.SerializeObject(model),
                            OperateUser    = user,
                            Remarks        = "Add",
                            CreateDateTime = DateTime.Now,
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error("EditVendorProductPriorityConfigPriority", ex);
            }
            return(result);
        }