Пример #1
0
        /// <summary>
        /// 创建推广
        /// </summary>
        /// <param name="Promotion"></param>
        /// <param name="UserId"></param>
        /// <param name="HallId"></param>
        /// <returns></returns>
        public int CreatePromotion(Business_Promotion Promotion, int UserId, int HallId)
        {
            Promotion.User_Id      = UserId;
            Promotion.Hall_Id      = HallId;
            Promotion.Status       = 0;
            Promotion.Audit_State  = 1;//审核通过
            Promotion.Create_Time  = DateTime.Now;
            Promotion.Update_Time  = DateTime.Now;
            Promotion.Create_User  = UserId.ToString();
            Promotion.Update_User  = UserId.ToString();
            Promotion.Click_Count  = 0;
            Promotion.Promotion_No = "ACD" + MathHelper.RandomCodeNum(9);
            int res = excute.Insert <Business_Promotion>(Promotion);

            return(res);
        }
Пример #2
0
        /// <summary>
        /// 创建推广
        /// </summary>
        /// <param name="Promotion"></param>
        public void CreatePromotion(Business_Promotion Promotion, double?StartStamp, double?EndStamp)
        {
            if (string.IsNullOrEmpty(Promotion.Title) || StartStamp == null || EndStamp == null || Promotion.Promotion_Type == 0)
            {
                result.info = ErrorType.MISS_PARAMETER;
                return;
            }
            if (Promotion.Promotion_Type == 1 && Promotion.Template_Id == 0)
            {
                result.info = ErrorType.MISS_PARAMETER;
                return;
            }
            if (Promotion.Promotion_Type == 3 && string.IsNullOrEmpty(Promotion.Img_Url))
            {
                result.info = ErrorType.MISS_PARAMETER;
                return;
            }
            if (!string.IsNullOrEmpty(Promotion.Content) && Promotion.Content.Length > 2000)
            {
                result.info = "内容超出2000限制";
                return;
            }
            var status = Nbh_UsersServices.Instance.GetSellerStatus(LoginStatus.Waiter_Id);

            if (status == 1)
            {//判断用户状态
                result.info = "营业员已被禁用";
                result.data = new { status = status };
                return;
            }
            DateTime Time = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区

            Promotion.Start_Time = Time.AddMilliseconds(StartStamp.Value);
            Promotion.End_Time   = Time.AddMilliseconds(EndStamp.Value);
            if (PromotionServices.Instance.CreatePromotion(Promotion, LoginStatus.Waiter_Id, LoginStatus.HallId) > 0)
            {
                result.success = true;
                result.info    = "创建成功";
            }
            else
            {
                result.info = "创建失败";
            }
        }
Пример #3
0
        /// <summary>
        /// 编辑推广
        /// </summary>
        /// <returns></returns>
        public int UpdatePromotion(Business_Promotion Promotion)
        {
            string sSql = string.Empty;

            if (Promotion.Promotion_Type == 1)
            {
                sSql = @"update business_promotion set title=:title,
                                                       content=:content,
                                                       start_time=:start_time,
                                                       end_time=:end_time,
                                                       update_time=:update_time
                                                       where promotion_id=:id";

                return(excute.ExcuteSql(sSql, new
                {
                    title = Promotion.Title,
                    content = Promotion.Content,
                    start_time = Promotion.Start_Time,
                    end_time = Promotion.End_Time,
                    update_time = DateTime.Now,
                    id = Promotion.Promotion_Id
                }));
            }
            else
            {
                sSql = @"update business_promotion set title=:title,
                                                       img_url=:img_url,
                                                       start_time=:start_time,
                                                       end_time=:end_time,
                                                       update_time=:update_time
                                                       where promotion_id=:id";

                return(excute.ExcuteSql(sSql, new
                {
                    title = Promotion.Title,
                    img_url = Promotion.Img_Url,
                    start_time = Promotion.Start_Time,
                    end_time = Promotion.End_Time,
                    update_time = DateTime.Now,
                    id = Promotion.Promotion_Id
                }));
            }
        }