Esempio n. 1
0
 /// <summary>
 /// 根据原优惠券,创建新优惠券,并且插入日志
 /// </summary>
 /// <param name="promotionId"></param>
 /// <param name="operation"></param>
 /// <returns></returns>
 private string CreateNewPromotionByOldPromotion(int promotionId, string operation = "部分取消")
 {
     if (promotionId > 0)
     {
         var oldPromotionCode = dbManager.Execute(connection => DalPromotionJob.FetchPromotionCodeByPromotionCode(connection, promotionId));
         oldPromotionCode.RuleName = oldPromotionCode.PromtionName;
         if (oldPromotionCode != null)
         {
             oldPromotionCode.Status      = 0;
             oldPromotionCode.CodeChannel = oldPromotionCode.CodeChannel + "(取消订单)";
             CreatePromotionModel createPromotionModel = new CreatePromotionModel()
             {
                 Author        = ThreadIdentity.Operator.Name,
                 Channel       = "取消订单",
                 Operation     = "原优惠券生成新优惠券",
                 PromotionPKID = oldPromotionCode.PkId
             };
             using (var client = new PromotionClient())
             {
                 var result = client.CopyPromotionCode(createPromotionModel);
                 if (result.Success)
                 {
                     new OprLogManager().AddOprLog <BizPromotionCode>("Order", oldPromotionCode.OrderId, operation + "原优惠券不释放,生成一张一样的优惠券,优惠券PKID:" + result.Result, null, null);
                 }
                 else
                 {
                     throw new Exception("根据原优惠券生成新优惠券失败,订单号:" + oldPromotionCode.OrderId);
                 }
             }
             //var newPromotionCode = dbManager.Execute(connection => DalPromotionJob.CreatePromotionCode(connection, oldPromotionCode));
             //new OprLogManager().AddOprLog<BizPromotionCode>("Order", oldPromotionCode.OrderId, operation + "原优惠券不释放,生成一张一样的优惠券,优惠券PKID:" + newPromotionCode, null, null);
         }
     }
     return(string.Empty);
 }
Esempio n. 2
0
        public static int UpdatePromotionTaskStatus(int id, PromotionConsts.PromotionTaskStatusEnum taskStatus,
                                                    string operateBy)
        {
            int result = DalPromotionJob.UpdatePromotionTaskStatus(id, taskStatus, operateBy);

            if (result > 0)
            {
                var promotionTask = DalPromotionJob.GetPromotionTaskById(id);
                if (promotionTask == null)
                {
                    return(0);
                }
                if (promotionTask.IsImmediately == 1) //需要立即执行
                {
                    if (taskStatus == PromotionConsts.PromotionTaskStatusEnum.Executed)
                    {
                        TuhuNotification.SendNotification("ExecutePromotionTask.setting", new
                        {
                            PromotionTaskId = id
                        }, 10000);
                    }
                }
            }
            return(result);
        }
Esempio n. 3
0
        static void SyncOrderData(SearchPromotionByCondition oneTask)
        {
            //判断是否已经同步过,同步过就不再执行
            var waitUsers    = DalPromotionJob.ExistsPromotionTaskUsers(oneTask.PromotionTaskId);
            var historyUsers = DalPromotionJob.ExistsPromotionTaskHistoryUsers(oneTask.PromotionTaskId);

            if (waitUsers || historyUsers)
            {
                return;
            }
            DalPromotionJob.MoveFilterOrderData(oneTask.PromotionTaskId);
        }
Esempio n. 4
0
        static void SyncBiActivityData(SearchPromotionByCondition oneTask)
        {
            //判断是否已经同步过,同步过就不再执行
            var waitUsers    = DalPromotionJob.ExistsPromotionTaskUsers(oneTask.PromotionTaskId);
            var historyUsers = DalPromotionJob.ExistsPromotionTaskHistoryUsers(oneTask.PromotionTaskId);

            if (waitUsers || historyUsers)
            {
                return;
            }

            //把BI表里的数据同步到待发送表里去
            DalPromotionJob.MovePromotionTaskActivityUsers(oneTask.PromotionTaskActivityId, oneTask.PromotionTaskId);
        }
Esempio n. 5
0
        /// <summary>
        /// 创建优惠券任务
        /// </summary>
        /// <param name="promotionTask">优惠券任务对象</param>
        /// <param name="cellPhones">需要发送优惠券的用户列表</param>
        /// <returns></returns>
        public int CreatePromotionTask(PromotionTask promotionTask, List <string> TaskPromotionListIds = null, List <string> cellPhones = null)
        {
            try
            {
                var oper = ThreadIdentity.Operator.Name;
                var task = DalPromotionJob.GetPromotionTaskById(promotionTask.PromotionTaskId ?? 0);
                if (task != null && task.TaskStatus > 0)             //已经审核或者关闭的任务不能修改
                {
                    return(0);
                }
                if (promotionTask.PromotionTaskId != null && promotionTask.PromotionTaskId > 0)
                {
                    //如果是修改了数据源,则要释放原来的数据源
                    if (promotionTask.SelectUserType == 3 && task.PromotionTaskActivityId !=
                        promotionTask.PromotionTaskActivityId)
                    {
                        DalPromotionJob.ResetPromotionTaskActivity(task.PromotionTaskActivityId,
                                                                   task.PromotionTaskId);
                    }
                }

                var resultId = handler.CreatePromotionTask(promotionTask, oper, TaskPromotionListIds, cellPhones);
                if (promotionTask.SelectUserType == 3)
                {
                    //如果是从BI库里获取数据,则要同步taskid
                    DalPromotionJob.SetPromotionTaskActivity(promotionTask.PromotionTaskActivityId.Value, resultId);
                }

                using (var log = new ConfigLogClient())
                {
                    log.InsertDefaultLogQueue("PromotionConfigLog", JsonConvert.SerializeObject(new
                    {
                        ObjectId    = resultId,
                        ObjectType  = "PromTask",
                        BeforeValue = "",
                        AfterValue  = JsonConvert.SerializeObject(promotionTask),
                        Operate     = promotionTask?.PromotionTaskId == null ? "新增优惠券任务" : "修改优惠券任务",
                        Author      = oper
                    }));
                }
                return(resultId);
            }
            catch (Exception ex)
            {
                throw new Exception(" 优惠券任务对象出错");
            }
        }
Esempio n. 6
0
 public object SelectCodeChannelByAddGift(int id)
 {
     return(DalPromotionJob.SelectCodeChannelByAddGift(id));
 }
Esempio n. 7
0
 /// <summary>
 /// 根据优惠券ID查询优惠券名称
 /// </summary>
 /// <param name="promotionRuleId"></param>
 /// <returns></returns>
 public string GetPromotionRuleNameById(int promotionRuleId)
 {
     return(DalPromotionJob.GetPromotionRuleNameById(promotionRuleId));
 }
Esempio n. 8
0
 public string GenerateCoupon(int Number, int DetailsID)
 {
     return(DalPromotionJob.GenerateCoupon(Number, DetailsID));
 }
Esempio n. 9
0
 public DataTable SelectGiftByDonwLoad(int pkid)
 {
     return(DalPromotionJob.SelectGiftByDonwLoad(pkid));
 }
Esempio n. 10
0
 public DataTable SelectGiftBag(int PageNumber, int PageSize, out int TotalCount)
 {
     return(DalPromotionJob.SelectGiftBag(PageNumber, PageSize, out TotalCount));
 }
Esempio n. 11
0
        /// <summary>
        /// 获得一个订单使用的优惠券数量
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public int GetOrderUsedPromtionCodeNumByOrderId(int orderId)
        {
            ParameterChecker.CheckNull(orderId, "OrderId");

            return(dbManager.Execute(connection => DalPromotionJob.GetOrderUsedPromtionCodeNumByOrderId(connection, orderId)));
        }
Esempio n. 12
0
 /// <summary>
 /// 查询优惠券下拉列表
 /// </summary>
 /// <returns></returns>
 public DataTable SelectDropDownList()
 {
     return(DalPromotionJob.SelectDropDownList());
 }
Esempio n. 13
0
 public DataSet SelectByPhoneNum(string PhoneNum)
 {
     return(DalPromotionJob.SelectByPhoneNum(PhoneNum));
 }
Esempio n. 14
0
 public int DeleteGift(int pkid)
 {
     return(DalPromotionJob.DeleteGift(pkid));
 }
Esempio n. 15
0
 public int SelectPromoCodeCount(int pkid)
 {
     return(DalPromotionJob.SelectPromoCodeCount(pkid));
 }
Esempio n. 16
0
 public int DeletePromoCode(int pkid)
 {
     return(DalPromotionJob.DeletePromoCode(pkid));
 }
Esempio n. 17
0
 public DataTable CreateExcel(int pkid)
 {
     return(DalPromotionJob.CreateExcel(pkid));
 }
Esempio n. 18
0
        public List <BizPromotionCode> SelectPromotionCodesByUserId(string userId)
        {
            ParameterChecker.CheckNull(userId, "UserId");

            return(dbManager.Execute(connection => DalPromotionJob.SelectPromotionCodesByUserId(userId)));
        }
Esempio n. 19
0
 /// <summary>
 /// 根据订单号查询优惠券
 /// </summary>
 /// <param name="OrderId"></param>
 /// <returns></returns>
 public List <BizPromotionCode> SelectPromotionByOrderId(int OrderId)
 {
     ParameterChecker.CheckNull(OrderId, "OrderId");
     return(dbManager.Execute(connection => DalPromotionJob.SelectPromotionByOrderId(OrderId)));
 }
Esempio n. 20
0
 /// <summary>
 /// 创建优惠券
 /// </summary>
 /// <param name="ecd"></param>
 /// <returns></returns>
 public int CreeatePromotion(ExchangeCodeDetail ecd)
 {
     return(DalPromotionJob.CreeatePromotion(ecd));
 }
Esempio n. 21
0
 public DataTable SelectExchangeCodeDetailByPage(int PageNumber, int PageSize, out int TotalCount)
 {
     return(DalPromotionJob.SelectExchangeCodeDetailByPage(PageNumber, PageSize, out TotalCount));
 }
Esempio n. 22
0
 /// <summary>
 /// 优惠券列表详情
 /// </summary>
 /// <param name="pkid"></param>
 /// <returns></returns>
 public DataTable SelectPromotionDetails(int pkid)
 {
     return(DalPromotionJob.SelectPromotionDetails(pkid));
 }
Esempio n. 23
0
 public DataTable SelectGiftBagByPKID(int pkid)
 {
     return(DalPromotionJob.SelectGiftBagByPKID(pkid));
 }
Esempio n. 24
0
 /// <summary>
 /// 查询优惠券详情-->修改
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public DataTable SelectPromotionDetailsByEdit(int id)
 {
     return(DalPromotionJob.SelectPromotionDetailsByEdit(id));
 }
Esempio n. 25
0
 public int SelectDownloadByPKID(int pkid)
 {
     return(DalPromotionJob.SelectDownloadByPKID(pkid));
 }
Esempio n. 26
0
 public int DoUpdateOEM(ExchangeCodeDetail ecd)
 {
     return(DalPromotionJob.DoUpdateOEM(ecd));
 }
Esempio n. 27
0
 /// <summary>
 /// 修改优惠券
 /// </summary>
 /// <param name="ecd"></param>
 /// <returns></returns>
 public int UpdatePromotionDetailsByOK(ExchangeCodeDetail ecd)
 {
     return(DalPromotionJob.UpdatePromotionDetailsByOK(ecd));
 }
Esempio n. 28
0
 public int AddOEM(ExchangeCodeDetail ecd)
 {
     return(DalPromotionJob.AddOEM(ecd));
 }
Esempio n. 29
0
 /// <summary>
 /// 创建优惠券执行任务
 /// </summary>
 /// <param name="promotionTask">优惠券任务对象</param>
 /// <param name="operateBy">操作者</param>
 /// <param name="cellPhones">需要发券的用户列表</param>
 /// <returns></returns>
 public int CreatePromotionTask(PromotionTask promotionTask, string operateBy, List <string> TaskPromotionListIds = null, List <string> cellPhones = null)
 {
     return(DalPromotionJob.CreateOrUpdatePromotionTask(promotionTask, operateBy, TaskPromotionListIds, cellPhones));
 }
Esempio n. 30
0
 public int UpdateGift(ExchangeCodeDetail ecd)
 {
     return(DalPromotionJob.UpdateGift(ecd));
 }