示例#1
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);
        }
示例#2
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);
        }