Пример #1
0
        /// <summary>
        /// 批量添加代理地区
        /// </summary>
        public void AreaAgent_MutiAdd()
        {
            int id                 = RequestTool.RequestInt("id", 0);
            int Area_id            = RequestTool.RequestInt("Area_id", 0);
            int PArea_id           = RequestTool.RequestInt("PArea_id", 0);
            List <Lebi_Area> areas = B_Lebi_Area.GetList("Parentid=" + PArea_id + "", "");
            Lebi_Agent_Area  model;

            foreach (Lebi_Area area in areas)
            {
                int count = B_Lebi_Agent_Area.Counts("Area_id=" + area.id + "");
                if (count > 0)
                {
                    continue;
                }
                model = new Lebi_Agent_Area();
                B_Lebi_Agent_Area.BindForm(model);
                model.Area_id = area.id;
                B_Lebi_Agent_Area.Add(model);
            }
            Log.Add("批量添加代理区域", "Agent_Area", id.ToString(), CurrentAdmin, "");
            string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}";

            Response.Write(result);
        }
Пример #2
0
        /// <summary>
        /// 编辑区域代理
        /// </summary>
        public void AreaAgent_Edit()
        {
            int id       = RequestTool.RequestInt("id", 0);
            int Area_id  = RequestTool.RequestInt("Area_id", 0);
            int PArea_id = RequestTool.RequestInt("PArea_id", 0);

            if (Area_id == 0)
            {
                Area_id = PArea_id;
            }
            Lebi_Agent_Area model = B_Lebi_Agent_Area.GetModel(id);
            int             count = B_Lebi_Agent_Area.Counts("Area_id=" + Area_id + " and id!=" + id + "");

            if (count > 0)
            {
                Response.Write("{\"msg\":\"" + Tag("不能选择此区域") + "\"}");
                return;
            }
            if (model == null)
            {
                model = new Lebi_Agent_Area();
            }
            B_Lebi_Agent_Area.BindForm(model);
            model.Area_id = Area_id;
            if (model.id == 0)
            {
                //if (!EX_Admin.Power("supplier_group_add", "添加商家分组"))
                //{
                //    AjaxNoPower();
                //    return;
                //}
                B_Lebi_Agent_Area.Add(model);
                id = B_Lebi_Agent_Area.GetMaxId();
                Log.Add("添加代理区域", "Agent_Area", id.ToString(), CurrentAdmin, model.User_UserName + "[" + model.Area_id + "]");
            }
            else
            {
                //if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
                //{
                //    AjaxNoPower();
                //    return;
                //}
                B_Lebi_Agent_Area.Update(model);
                Log.Add("编辑代理区域", "Agent_Area", id.ToString(), CurrentAdmin, model.User_UserName + "[" + model.Area_id + "]");
            }
            string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}";

            Response.Write(result);
        }