Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        /// <summary>
        /// 编辑区域代理-代理人
        /// </summary>
        public void AreaAgentUser_Edit()
        {
            int             id    = RequestTool.RequestInt("id", 0);
            Lebi_Agent_Area model = B_Lebi_Agent_Area.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            string User_UserName = RequestTool.RequestString("User_UserName");

            if (User_UserName == "")
            {
                Response.Write("{\"msg\":\"" + Tag("用户名不能空") + "\"}");
                return;
            }
            Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + User_UserName + "'}");

            if (user == null)
            {
                Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                return;
            }

            if (model.Time_end > System.DateTime.Now.Date && model.User_id != user.id)
            {
                Response.Write("{\"msg\":\"" + Tag("其他代理还未到期") + "\"}");
                return;
            }
            if (model == null)
            {
                model = new Lebi_Agent_Area();
            }
            B_Lebi_Agent_Area.BindForm(model);
            model.User_id = user.id;
            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);
        }