コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            if (id == 0)
            {
                if (!EX_Admin.Power("promotion_add", "添加促销活动"))
                {
                    PageNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("promotion_edit", "编辑促销活动"))
                {
                    PageNoPower();
                }
            }
            model = B_Lebi_Promotion_Type.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Promotion_Type();
                model.Type_id_PromotionStatus = 240;
                model.Type_id_PromotionType   = 421;
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade desc");
        }
コード例 #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 + "\"}");
        }
コード例 #3
0
ファイル: promotion.aspx.cs プロジェクト: yzbjack/LebiShop
        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);
        }
コード例 #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Promotion_Type model)
 {
     D_Lebi_Promotion_Type.Instance.Update(model);
 }
コード例 #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Promotion_Type model)
 {
     return(D_Lebi_Promotion_Type.Instance.Add(model));
 }
コード例 #6
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Promotion_Type SafeBindForm(Lebi_Promotion_Type model)
 {
     return(D_Lebi_Promotion_Type.Instance.SafeBindForm(model));
 }
コード例 #7
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;
            }
        }