コード例 #1
0
        public ActionResult GetTreeJson(string value)
        {
            string        parentId   = value == null ? "0" : value;
            var           filterdata = areaBLL.GetList(parentId).ToList();
            StringBuilder sb         = new StringBuilder();

            sb.Append("[");
            if (filterdata.Count > 0)
            {
                foreach (AreaEntity item in filterdata)
                {
                    bool hasChildren = areaBLL.GetList(item.AreaId).ToList().Count == 0 ? false : true;
                    sb.Append("{");
                    sb.Append("\"id\":\"" + item.AreaId + "\",");
                    sb.Append("\"text\":\"" + item.AreaName + "\",");
                    sb.Append("\"value\":\"" + item.AreaId + "\",");
                    sb.Append("\"isexpand\":false,");
                    sb.Append("\"complete\":false,");
                    sb.Append("\"hasChildren\":" + hasChildren.ToString().ToLower() + "");
                    sb.Append("},");
                }
                sb = sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]");
            return(Content(sb.ToString()));
        }
コード例 #2
0
        public ActionResult GetAreaListJson(string value, string keyword)
        {
            string parentId = value == null ? "0" : value;
            var    data     = areaBLL.GetList(parentId, keyword).ToList();

            return(Content(data.ToJson()));
        }
コード例 #3
0
        private void PageInit()
        {
            ddl_counties.DataSource     = bll.GetList(0);
            ddl_counties.DataValueField = "Id";
            ddl_counties.DataTextField  = "AreaName";
            ddl_counties.DataBind();
            ddl_counties.Items.Insert(0, new ListItem("-请选择-", ""));

            if (action.Equals("edit"))
            {
                btnAdd.Visible    = false;
                btnMoidfy.Visible = true;

                Area item = bll.GetItem(pid);
                ddl_counties.SelectedValue = item.Pid.ToString();
                StreetInit(item.Pid.ToString(), item.Id.ToString());

                Area item2 = bll.GetItem(Id);
                txtDistrict.Value = item2.AreaName;
                txtKey.Value      = item2.AreaKey;
            }
            else
            {
                ddl_counties.SelectedValue = pid.ToString();
                StreetInit(pid.ToString(), Id.ToString());
            }
        }
コード例 #4
0
 private void AreaInit()
 {
     ddl_counties.DataSource     = bll.GetList(0);
     ddl_counties.DataValueField = "Id";
     ddl_counties.DataTextField  = "AreaName";
     ddl_counties.DataBind();
     ddl_counties.Items.Insert(0, new ListItem("-选择区县-", ""));
 }
コード例 #5
0
ファイル: AreaList.aspx.cs プロジェクト: szwork2013/OrderShop
        public string loadCategory()
        {
            List <Area> list = bll.GetList();

            if (list.Count > 0)
            {
                List <Area> list2 = list.FindAll(delegate(Area ca) { return(ca.Pid == 0); });
                foreach (Area item in list2)
                {
                    HtmlListCategory += "<div style=\"width:98%;padding-left:20px;border-bottom:solid 1px #114983;\" onmouseover=\"a=this.style.backgroundColor;this.style.backgroundColor='#E2E6E5'\" onmouseout=\"this.style.backgroundColor=a\"><div style=\"width:45%;float:right\"><a href=\"Street_AE.aspx?action=add&pid=" + item.Id + "\">添加街道</a>&nbsp;&nbsp;&nbsp;</div><div style=\"width:50%; cursor:pointer;\" onclick=\"ShowDiv('child_" + item.Id + "')\">" + item.AreaName + "</div></div>";
                    HtmlListCategory += "<div id='child_" + item.Id + "' style='display:none;'>";
                    bindChild(list, 1, item.Id);
                    HtmlListCategory += "</div>";
                }
            }
            return(HtmlListCategory);
        }
コード例 #6
0
 /// <summary>
 /// 区县
 /// </summary>
 /// <param name="selectedvalue"></param>
 private void AreaInit(string selectedvalue)
 {
     ddl_counties.DataSource     = abll.GetList(0);
     ddl_counties.DataValueField = "Id";
     ddl_counties.DataTextField  = "AreaName";
     ddl_counties.DataBind();
     ddl_counties.Items.Insert(0, new ListItem("-请选择-", ""));
     ddl_counties.SelectedValue = selectedvalue;
 }
コード例 #7
0
ファイル: AreaCache.cs プロジェクト: nrcc/Berry
        /// <summary>
        /// 区域列表
        /// </summary>
        /// <returns></returns>
        private IEnumerable <AreaEntity> GetList()
        {
            var cacheList = CacheFactory.GetCacheInstance().GetListCache <AreaEntity>(areaBll.CacheKey, out long total);

            if (cacheList == null || cacheList.Count == 0)
            {
                cacheList = areaBll.GetList().ToList();
                //以集合的方式存在缓存下面
                //CacheFactory.GetCacheInstance().WriteListCache<AreaEntity>(cacheList, areaBll.CacheKey);

                //以单体的形式存在缓存下面
                foreach (AreaEntity model in cacheList)
                {
                    CacheFactory.GetCacheInstance().WriteCache <AreaEntity>(model, areaBll.CacheKey);
                }
            }
            return(cacheList);
        }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ddl_counties.DataSource     = abll.GetList(0);
         ddl_counties.DataValueField = "Id";
         ddl_counties.DataTextField  = "AreaName";
         ddl_counties.DataBind();
         ddl_counties.Items.Insert(0, new ListItem("-请选择-", ""));
     }
 }
コード例 #9
0
ファイル: AreaCache.cs プロジェクト: MrBigGreen/CRM
        /// <summary>
        /// 行政区域列表
        /// </summary>
        /// <returns></returns>
        public IEnumerable <AreaEntity> GetList()
        {
            var cacheList = CacheFactory.Cache().GetCache <IEnumerable <AreaEntity> >(busines.cacheKey);

            if (cacheList == null)
            {
                var data = busines.GetList();
                CacheFactory.Cache().WriteCache(data, busines.cacheKey);
                return(data);
            }
            else
            {
                return(cacheList);
            }
        }
コード例 #10
0
        public async Task <IActionResult> GetListJson(AreaListParam param)
        {
            TData <List <AreaEntity> > obj = await areaBLL.GetList(param);

            return(Json(obj));
        }
コード例 #11
0
        public List <Area> getArea()
        {
            AreaBLL abll = new AreaBLL();

            return(abll.GetList(0));
        }