/// <summary>
        /// 客户专享活动配置新增
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="customerExclusiveSettingModel">实体</param>
        /// <returns></returns>
        public static int InsertCustomerExclusiveSetting(SqlConnection conn, CustomerExclusiveSettingModel customerExclusiveSettingModel)
        {
            const string sqlInsertCustomerExclusiveSettin = @"INSERT INTO  Activity.[dbo].[CustomerExclusiveSetting]
                                                               ([ActivityExclusiveId]
                                                               ,[OrderChannel]
                                                               ,[LargeCustomersID]
                                                               ,[LargeCustomersName]
                                                               ,[EventLink]
                                                               ,[ActivityId]
                                                               ,[ImageUrl]
                                                               ,[BusinessHotline]
                                                               ,[IsEnable]
                                                               ,[IsDelete]
                                                               ,[CreateTime]
                                                               ,[CreateBy])
                                                         VALUES
                                                               (@ActivityExclusiveId
                                                               ,@OrderChannel
                                                               ,@LargeCustomersID
                                                               ,@LargeCustomersName
                                                               ,@EventLink
                                                               ,@ActivityId
                                                               ,@ImageUrl
                                                               ,@BusinessHotline
                                                               ,@IsEnable
                                                               ,0
                                                               ,GETDATE()
                                                               ,@CreateBy)";

            return(conn.Execute(sqlInsertCustomerExclusiveSettin, customerExclusiveSettingModel, commandType: CommandType.Text));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 客户专享活动配置修改
        /// </summary>
        /// <param name="customerExclusiveSettingModel"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int UpdateCustomerExclusiveSetting(CustomerExclusiveSettingModel customerExclusiveSettingModel, string user)
        {
            int result = 0;

            if (customerExclusiveSettingModel != null)
            {
                customerExclusiveSettingModel.UpdateBy = user;
                using (var conn = ProcessConnection.OpenGungnir)
                {
                    var current = DalCustomerExclusiveSetting.SelectCustomerExclusive(conn, customerExclusiveSettingModel.ActivityId, customerExclusiveSettingModel.PKID).ToList();

                    if (current != null && current.Count() == 1)
                    {
                        result = -9;
                    }
                    else
                    {
                        var customerModel = DalCustomerExclusiveSetting.SelectCustomerExclusive(conn, customerExclusiveSettingModel.PKID).ToList();

                        if (customerModel != null && customerModel.Count() == 1)
                        {
                            var rows = DalCustomerExclusiveSetting.UpdateCustomerExclusiveSetting(conn, customerExclusiveSettingModel);
                            result = rows == 1 ? 1 : 0;
                            if (result == 1)
                            {
                                var log = new
                                {
                                    ObjectId    = customerExclusiveSettingModel.PKID,
                                    Source      = "CustomerExclusiveSetting",
                                    ObjectType  = "UpdateCustomerExclusiveSetting",
                                    BeforeValue = JsonConvert.SerializeObject(customerModel),
                                    AfterValue  =
                                        JsonConvert.SerializeObject(customerExclusiveSettingModel),
                                    Remark         = "客户专享活动配置修改",
                                    IsDeleted      = 0,
                                    CreateDateTime = DateTime.Now,
                                    Creator        = user
                                };
                                LoggerManager.InsertLog("CustomerSetting", log);
                                ActivityService.RefreshRedisCacheCustomerSetting(customerExclusiveSettingModel.ActivityExclusiveId);
                            }
                        }
                    }
                }
            }

            return(result);
        }
Exemplo n.º 3
0
        public JsonResult InsertCustomerExclusiveSetting(CustomerExclusiveSettingModel customerExclusiveSettingModel)
        {
            int result = CustomersActivityManager.InsertCustomerExclusiveSetting(customerExclusiveSettingModel, User.Identity.Name);

            string message = "新增成功";

            if (result == -9)
            {
                message = "限时抢购活动ID已经存在,请从新输入!";
            }
            else if (result == 0)
            {
                message = "新增失败";
            }
            return(Json(new { success = result == 1, msg = message }));
        }
        /// <summary>
        /// 客户专享活动配置编辑
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="customerExclusiveSettingModel">实体</param>
        /// <returns></returns>
        public static int UpdateCustomerExclusiveSetting(SqlConnection conn, CustomerExclusiveSettingModel customerExclusiveSettingModel)
        {
            const string sqlUpdateCustomerExclusiveSettin = @"UPDATE  Activity.[dbo].[CustomerExclusiveSetting] WITH(ROWLOCK)
                                       SET [OrderChannel] = @OrderChannel
                                          ,[LargeCustomersID] = @LargeCustomersID
                                          ,[LargeCustomersName] = @LargeCustomersName
                                          ,[EventLink] = @EventLink
                                          ,[ActivityId] = @ActivityId
                                          ,[ImageUrl] = @ImageUrl
                                          ,[BusinessHotline] = @BusinessHotline
                                          ,[IsEnable] =@IsEnable
                                          ,[IsDelete] = 0
                                          ,[CreateTime] = GETDATE()
                                     WHERE PKID =@PKID";

            return(conn.Execute(sqlUpdateCustomerExclusiveSettin, customerExclusiveSettingModel, commandType: CommandType.Text));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 客户专享活动配置新增
        /// </summary>
        /// <param name="customerExclusiveSettingModel"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int InsertCustomerExclusiveSetting(CustomerExclusiveSettingModel customerExclusiveSettingModel, string user)
        {
            int result = 0;

            if (customerExclusiveSettingModel != null)
            {
                string guid = "" + System.Guid.NewGuid();
                customerExclusiveSettingModel.ActivityExclusiveId = SecurityHelper.Hash(guid);
                customerExclusiveSettingModel.CreateBy            = user;
                using (var conn = ProcessConnection.OpenGungnir)
                {
                    var current = DalCustomerExclusiveSetting.SelectCustomerExclusive(conn, customerExclusiveSettingModel.ActivityId).ToList();

                    if (current != null && current.Count() == 1)
                    {
                        result = -9;
                    }
                    else
                    {
                        var rows = DalCustomerExclusiveSetting.InsertCustomerExclusiveSetting(conn, customerExclusiveSettingModel);
                        result = rows == 1 ? 1 : 0;
                        if (result == 1)
                        {
                            var log = new
                            {
                                ObjectId =
                                    DalCustomerExclusiveSetting.GetCustomerExclusiveSettingMaxPkId(conn),
                                Source         = "CustomerExclusiveSetting",
                                ObjectType     = "InsertCustomerExclusiveSetting",
                                BeforeValue    = "",
                                AfterValue     = JsonConvert.SerializeObject(customerExclusiveSettingModel),
                                Remark         = "客户专享活动配置新增",
                                CreateDateTime = DateTime.Now,
                                IsDeleted      = 0,
                                Creator        = user
                            };
                            LoggerManager.InsertLog("CustomerSetting", log);

                            ActivityService.RefreshRedisCacheCustomerSetting(customerExclusiveSettingModel.ActivityExclusiveId);
                        }
                    }
                }
            }

            return(result);
        }