Beispiel #1
0
        /// <summary>
        /// 删除规则
        /// </summary>
        public void Promotion_Del()
        {
            if (!EX_Admin.Power("promotion_del", "删除促销活动"))
            {
                AjaxNoPower();
                return;
            }
            string id = RequestTool.RequestString("id");

            if (id != "")
            {
                B_Lebi_Promotion.Delete("id in (lbsql{" + id + "})");
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #2
0
        /// <summary>
        /// 编辑促销
        /// </summary>
        public void PromotionType_Edit()
        {
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Promotion_Type model = B_Lebi_Promotion_Type.GetModel(id);
            bool addfalg = false;

            if (model == null)
            {
                if (!EX_Admin.Power("promotion_add", "添加促销活动"))
                {
                    AjaxNoPower();
                    return;
                }
                model   = new Lebi_Promotion_Type();
                addfalg = true;
            }


            model         = B_Lebi_Promotion_Type.BindForm(model);
            model.Name    = Language.RequestString("Name");
            model.Content = Language.RequestString("Content");
            if (addfalg)
            {
                model.Admin_id       = CurrentAdmin.id;
                model.Admin_UserName = CurrentAdmin.UserName;
                B_Lebi_Promotion_Type.Add(model);
                model.id = B_Lebi_Promotion_Type.GetMaxId();
            }
            else
            {
                if (!EX_Admin.Power("promotion_edit", "编辑促销活动"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Promotion_Type.Update(model);
                //更新规则的状态
                List <Lebi_Promotion> ps = B_Lebi_Promotion.GetList("Promotion_Type_id=" + model.id + "", "");
                foreach (Lebi_Promotion p in ps)
                {
                    p.Type_id_PromotionStatus = model.Type_id_PromotionStatus;
                    p.Time_End   = model.Time_End;
                    p.Time_Start = model.Time_Start;
                    B_Lebi_Promotion.Update(p);
                }
            }
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}");
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("promotion_list", "促销活动列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            tid = RequestTool.RequestInt("tid", 0);

            pt = B_Lebi_Promotion_Type.GetModel(tid);
            if (pt == null)
            {
                PageError();
                return;
            }
            string where = "Promotion_Type_id=" + tid;
            PageSize     = RequestTool.getpageSize(25);
            models       = B_Lebi_Promotion.GetList(where, "Sort desc", PageSize, page);
            int recordCount = B_Lebi_Promotion.Counts(where);

            PageString = Pager.GetPaginationString("?page={0}&tid=" + tid, page, PageSize, recordCount);
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id  = RequestTool.RequestInt("id", 0);
            int tid = RequestTool.RequestInt("tid", 0);

            if (id == 0)
            {
                if (!EX_Admin.Power("promotion_add", "添加促销活动"))
                {
                    PageReturnMsg = PageNoPowerMsg();
                }
            }
            else
            {
                if (!EX_Admin.Power("promotion_edit", "编辑促销活动"))
                {
                    PageReturnMsg = PageNoPowerMsg();
                }
            }

            model = B_Lebi_Promotion.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Promotion();
                model.Type_id_PromotionStatus = 240;
            }
            else
            {
                tid = model.Promotion_Type_id;
                if (model.Case805 != "")
                {
                    string codes             = "";
                    List <Lebi_Product> pros = B_Lebi_Product.GetList("id in (" + model.Case805 + ")", "");
                    foreach (Lebi_Product pro in pros)
                    {
                        if (codes == "")
                        {
                            codes = pro.Number;
                        }
                        else
                        {
                            if (codes.Contains(pro.Number))
                            {
                                continue;
                            }
                            else
                            {
                                codes = codes + "," + pro.Number;
                            }
                        }
                    }
                    model.Case805 = codes;
                }
            }
            pt = B_Lebi_Promotion_Type.GetModel(tid);
            if (pt == null)
            {
                PageError();
                return;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 编辑保存促销
        /// </summary>
        public void Promotion_Edit()
        {
            int                 id    = RequestTool.RequestInt("id", 0);
            int                 tid   = RequestTool.RequestInt("tid", 0);
            Lebi_Promotion      model = B_Lebi_Promotion.GetModel(id);
            Lebi_Promotion_Type pt;
            bool                addflag = false;

            if (model == null)
            {
                if (!EX_Admin.Power("promotion_add", "添加促销活动"))
                {
                    AjaxNoPower();
                    return;
                }
                pt      = B_Lebi_Promotion_Type.GetModel(tid);
                model   = new Lebi_Promotion();
                addflag = true;
            }
            else
            {
                if (!EX_Admin.Power("promotion_edit", "编辑促销活动"))
                {
                    AjaxNoPower();
                    return;
                }
                pt = B_Lebi_Promotion_Type.GetModel(model.Promotion_Type_id);
            }
            if (pt == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            B_Lebi_Promotion.BindForm(model);
            model.IsCase801 = RequestTool.RequestInt("IsCase801", 0);
            model.IsCase802 = RequestTool.RequestInt("IsCase802", 0);
            model.IsCase803 = RequestTool.RequestInt("IsCase803", 0);
            model.IsCase804 = RequestTool.RequestInt("IsCase804", 0);
            model.IsCase805 = RequestTool.RequestInt("IsCase805", 0);
            model.IsCase806 = RequestTool.RequestInt("IsCase806", 0);
            model.IsRule901 = RequestTool.RequestInt("IsRule901", 0);
            model.IsRule902 = RequestTool.RequestInt("IsRule902", 0);
            model.IsRule903 = RequestTool.RequestInt("IsRule903", 0);
            model.IsRule904 = RequestTool.RequestInt("IsRule904", 0);
            model.IsRule905 = RequestTool.RequestInt("IsRule905", 0);
            model.IsRule906 = RequestTool.RequestInt("IsRule906", 0);
            model.IsRule907 = RequestTool.RequestInt("IsRule907", 0);
            model.IsRule908 = RequestTool.RequestInt("IsRule908", 0);
            model.IsRule909 = RequestTool.RequestInt("IsRule909", 0);
            model.IsRule910 = RequestTool.RequestInt("IsRule910", 0);
            model.IsRule911 = RequestTool.RequestInt("IsRule911", 0);
            model.IsRule912 = RequestTool.RequestInt("IsRule912", 0);
            model.Case804   = RequestTool.RequestString("Case804");;
            //处理包含商品
            string Case805 = RequestTool.RequestString("Case805");

            Case805 = Case805.Replace(",", "','");
            Case805 = "'" + Case805 + "'";
            List <Lebi_Product> pros = B_Lebi_Product.GetList("Number in (" + Case805 + ")", "");
            string ids = "";

            foreach (Lebi_Product pro in pros)
            {
                if (ids == "")
                {
                    ids = pro.id.ToString();
                }
                else
                {
                    ids = ids + "," + pro.id.ToString();
                }
            }
            model.Case805                 = ids;
            model.Admin_id                = CurrentAdmin.id;
            model.Admin_UserName          = CurrentAdmin.UserName;
            model.Time_Start              = pt.Time_Start;
            model.Time_End                = pt.Time_End;
            model.Type_id_PromotionStatus = pt.Type_id_PromotionStatus;
            model.Remark            = RequestTool.RequestString("Remark");
            model.Sort              = RequestTool.RequestInt("Sort", 0);
            model.Promotion_Type_id = pt.id;
            if (model.IsCase801 > 0 || model.IsCase802 > 0 || model.IsCase803 > 0 || model.IsCase804 > 0 || model.IsCase805 > 0)
            {
                model.IsSetCase = 1;
            }
            else
            {
                model.IsSetCase = 0;
            }
            if (addflag)
            {
                B_Lebi_Promotion.Add(model);
                model.id = B_Lebi_Promotion.GetMaxId();
            }
            else
            {
                B_Lebi_Promotion.Update(model);
            }
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}");
        }
Beispiel #6
0
 public int Count(int ptid)
 {
     return(B_Lebi_Promotion.Counts("Promotion_Type_id=" + ptid + ""));
 }