Exemplo n.º 1
0
        private string CreatSelect(int id)
        {
            string    str  = "<select id=\"Area_" + id + "\"  onchange=\"SelectAreaList(" + topid + ",'Area_" + id + "');\">";
            Lebi_Area area = B_Lebi_Area.GetModel(id);

            if (area == null)
            {
                return("");
            }
            if (topid == area.id)
            {
                return("");
            }
            List <Lebi_Area> models = B_Lebi_Area.GetList("Parentid=" + area.Parentid + "", "Sort asc");

            if (models.Count == 0)
            {
                return("");
            }
            foreach (Lebi_Area model in models)
            {
                if (id == model.id)
                {
                    str += "<option value=\"" + model.id + "\" selected>" + model.Name + "</option>";
                }
                else
                {
                    str += "<option value=\"" + model.id + "\">" + model.Name + "</option>";
                }
            }
            str += "</select> ";
            str  = CreatSelect(area.Parentid) + str;
            return(str);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            pid = RequestTool.RequestInt("pid", 0);
            if (id == 0)
            {
                if (!EX_Admin.Power("area_add", "添加地名"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("area_edit", "编辑地名"))
                {
                    WindowNoPower();
                }
            }
            model = B_Lebi_Area.GetModel(id);
            if (model == null)
            {
                model          = new Lebi_Area();
                model.Parentid = pid;
            }
        }
Exemplo n.º 3
0
        protected Lebi_Area Getarea(int id)
        {
            Lebi_Area area = B_Lebi_Area.GetModel(id);

            if (area == null)
            {
                area = new Lebi_Area();
            }
            return(area);
        }
Exemplo n.º 4
0
        public string AreaName(int id)
        {
            string    str  = "";
            Lebi_Area area = B_Lebi_Area.GetModel(id);

            if (area != null)
            {
                str = area.Name + "> ";
                if (area.Parentid > 0)
                {
                    str = AreaName(area.Parentid) + str;
                }
            }
            return(str);
        }
Exemplo n.º 5
0
        protected string Getpath(int id)
        {
            string    str  = "";
            Lebi_Area area = B_Lebi_Area.GetModel(id);

            if (area != null)
            {
                str = " > <a href=\"?pid=" + id + "\">" + area.Name + "</a>";
                if (area.Parentid > 0)
                {
                    str = Getpath(area.Parentid) + str;
                }
            }
            return(str);
        }
Exemplo n.º 6
0
        //protected List<Lebi_Area> models;
        public void LoadPage()
        {
            topid   = RequestTool.RequestInt("topid", 0);
            area_id = RequestTool.RequestInt("area_id", 0);

            int Parentid = 0;

            area_id = area_id == 0 ? topid : area_id;
            List <Lebi_Area> models = B_Lebi_Area.GetList("Parentid=" + area_id + "", "Sort asc");
            Lebi_Area        area   = B_Lebi_Area.GetModel(area_id);

            if (models.Count == 0)
            {
                Parentid = area.Parentid;
                models   = B_Lebi_Area.GetList("Parentid=" + Parentid + "", "Sort asc");
            }
            else
            {
                Parentid = area_id;
            }
            string str = "<select id=\"Area_id\" onchange=\"SelectAreaList(" + topid + ",'Area_id');\">";

            str += "<option value=\"0\" selected>" + Tag(" 请选择 ") + "</option>";
            foreach (Lebi_Area model in models)
            {
                if (area_id == model.id)
                {
                    str += "<option value=\"" + model.id + "\" selected>" + model.Name + "</option>";
                }
                else
                {
                    str += "<option value=\"" + model.id + "\">" + model.Name + "</option>";
                }
            }
            str += "</select> ";
            //if (models.Count > 0)
            //    str += CreatSelect(models.FirstOrDefault().id);
            str = CreatSelect(Parentid) + str;
            Response.Write(str);
        }
Exemplo n.º 7
0
        public string ThreadGetAreaList(int topid, int area_id, int Parentid)
        {
            List <Lebi_Area> models = B_Lebi_Area.GetList("Parentid=" + area_id + "", "Sort desc");
            Lebi_Area        area   = B_Lebi_Area.GetModel(area_id);

            if (area == null)
            {
                area = new Lebi_Area();
            }
            if (models.Count == 0)
            {
                Parentid = area.Parentid;
                models   = B_Lebi_Area.GetList("Parentid=" + Parentid + "", "Sort desc");
            }
            else
            {
                Parentid = area_id;
            }
            string str = "<select id=\"Area_id\" onchange=\"SelectAreaList(" + topid + ",'Area_id');\" class=\"form-control\">";

            str += "<option value=\"0\" selected>" + Tag(" 请选择 ") + "</option>";
            foreach (Lebi_Area model in models)
            {
                if (area_id == model.id)
                {
                    str += "<option value=\"" + model.id + "\" selected>" + model.Name + "</option>";
                }
                else
                {
                    str += "<option value=\"" + model.id + "\">" + model.Name + "</option>";
                }
            }
            str += "</select>";
            if (topid != area_id)
            {
                str = CreatSelect(Parentid, topid) + str;
            }
            return(str);
        }