コード例 #1
0
        /// <summary>
        /// 根据区域加载楼宇
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        protected string Refresh(string pid)
        {
            AreaBLL     abll      = new AreaBLL();
            string      strResult = "";
            List <Area> list      = new List <Area>();

            if (pid == "0")
            {
                list = abll.GetListByidlist("1,2,3,4");
            }
            else
            {
                list = abll.GetListByidlist(pid);
            }
            string prestr = "";

            foreach (Area item in list)
            {
                prestr += item.Id + ",";
            }
            prestr.Remove(prestr.Length - 1, 1);
            list = abll.GetListByidlist(prestr);
            foreach (Area item in list)
            {
                strResult += "<li><a href=\"javascript:;\" onclick=\"seldistrict(" + item.Id + "," + item.Pid + ",'" + item.AreaName + "')\">" + item.AreaName + "</a></li>";
            }
            return(strResult);
        }
コード例 #2
0
        protected string SearchDistrictByKey(string keyword)
        {
            string      strResult = "";
            AreaBLL     abll      = new AreaBLL();
            List <Area> alllist   = new List <Area>();

            if (HttpContext.Current.Cache["allarea"] != null)
            {
                alllist = HttpContext.Current.Cache["allarea"] as List <Area>;
            }
            else
            {
                List <Area> list   = abll.GetListByidlist("1,2,3,4");
                string      prestr = "";
                foreach (Area item in list)
                {
                    prestr += item.Id + ",";
                }
                prestr.Remove(prestr.Length - 1, 1);
                alllist = abll.GetListByidlist(prestr);
                HttpContext.Current.Cache.Insert("allarea", alllist);
            }
            //查找符合条件的数据集
            List <Area> filterlist = alllist.FindAll(delegate(Area ca) { return(ca.AreaKey.IndexOf(keyword.ToUpper()) > -1 || ca.AreaName.IndexOf(keyword) > -1); });

            foreach (Area temp in filterlist)
            {
                strResult += "<p onclick=\"selsearchval('" + temp.AreaName.Trim() + "')\">" + temp.AreaName.Trim() + "</p>";
            }
            return(strResult);
        }
コード例 #3
0
 /// <summary>
 /// 街道
 /// </summary>
 /// <param name="idlist"></param>
 /// <param name="selectedvalue"></param>
 private void StreetInit(string idlist, string selectedvalue)
 {
     ddl_streets.DataSource     = abll.GetListByidlist(idlist);
     ddl_streets.DataValueField = "Id";
     ddl_streets.DataTextField  = "AreaName";
     ddl_streets.DataBind();
     ddl_streets.Items.Insert(0, new ListItem("-请选择-", ""));
     ddl_streets.SelectedValue = selectedvalue;
 }
コード例 #4
0
 protected void ddl_counties_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddl_counties.SelectedIndex != 0)
     {
         ddl_streets.DataSource     = bll.GetListByidlist(ddl_counties.SelectedValue);
         ddl_streets.DataValueField = "Id";
         ddl_streets.DataTextField  = "AreaName";
         ddl_streets.DataBind();
         ddl_streets.Items.Insert(0, new ListItem("-选择路段-", ""));
         ddl_district.Items.Clear();
     }
 }
コード例 #5
0
        private void PageInit()
        {
            //加载街道
            List <Area> list = abll.GetListByidlist("1,2,3,4");

            rpt_streets.DataSource = list;
            rpt_streets.DataBind();
            //加载小区
            string prestr = "";

            foreach (Area item in list)
            {
                prestr += item.Id + ",";
            }
            prestr.Remove(prestr.Length - 1, 1);
            rpt_district.DataSource = abll.GetListByidlist(prestr);
            rpt_district.DataBind();
        }
コード例 #6
0
        /// <summary>
        /// 按照字母过滤楼宇小区
        /// </summary>
        /// <param name="pid">地区id</param>
        /// <param name="sid">街道id</param>
        /// <param name="filterStr">字母</param>
        /// <returns></returns>
        protected string FilterDistrict(string pid, int sid, string filterStr, string ot)
        {
            AreaBLL     abll      = new AreaBLL();
            string      strResult = "";
            string      prestr    = "";
            List <Area> list      = new List <Area>();
            string      strurl    = "index.aspx";

            if (ot == "2")
            {
                strurl = "shoplist.aspx";
            }
            if (pid == "0")
            {
                list = abll.GetListByidlist("1,2,3,4");
            }
            else
            {
                list = abll.GetListByidlist(pid);
            }

            foreach (Area item in list)
            {
                prestr += item.Id + ",";
            }
            prestr.Remove(prestr.Length - 1, 1);
            list = abll.GetListByidlist(prestr);
            if (sid > 0)
            {
                list = list.FindAll(delegate(Area ca) { return(ca.Pid == sid); });
            }
            //按照字母过滤
            if (filterStr != string.Empty)
            {
                list = list.FindAll(delegate(Area ca) { return(ca.AreaKey == filterStr); });
            }

            foreach (Area item in list)
            {
                strResult += "<li><a href=\"" + strurl + "?aid=" + GetPidById(item.Pid) + "&sid=" + item.Pid + "&did=" + item.Id + "\">" + item.AreaName + "</a></li>";
            }
            return(strResult);
        }
コード例 #7
0
        protected string FilterDistrict(string pid, int sid, string filterStr)
        {
            AreaBLL     abll      = new AreaBLL();
            string      strResult = "";
            string      prestr    = "";
            List <Area> list      = new List <Area>();

            if (pid == "0")
            {
                list = abll.GetListByidlist("1,2,3,4");
            }
            else
            {
                list = abll.GetListByidlist(pid);
            }

            foreach (Area item in list)
            {
                prestr += item.Id + ",";
            }
            prestr.Remove(prestr.Length - 1, 1);
            list = abll.GetListByidlist(prestr);
            if (sid > 0)
            {
                list = list.FindAll(delegate(Area ca) { return(ca.Pid == sid); });
            }
            //按照字母过滤
            if (filterStr != string.Empty)
            {
                list = list.FindAll(delegate(Area ca) { return(ca.AreaKey == filterStr); });
            }

            foreach (Area item in list)
            {
                strResult += "<li><a href=\"javascript:;\" onclick=\"seldistrict(" + item.Id + "," + item.Pid + ",'" + item.AreaName + "')\">" + item.AreaName + "</a></li>";
            }
            return(strResult);
        }
コード例 #8
0
ファイル: default.aspx.cs プロジェクト: szwork2013/OrderShop
        private void PageInit()
        {
            rpt_adverts.DataSource = new AdvertBLL().GetAdvertList(1);
            rpt_adverts.DataBind();
            rpt_advertnum.DataSource = rpt_adverts.DataSource;
            rpt_advertnum.DataBind();

            //加载店铺类别
            rpt_shoptypelist.DataSource = new ShopTypeBLL().GetList();
            rpt_shoptypelist.DataBind();

            //加载街道
            List <Area> list = new List <Area>();

            if (aid == 0)
            {
                list = new AreaBLL().GetListByidlist("1,2,3,4");
            }
            else
            {
                list = new AreaBLL().GetListByidlist(aid.ToString());
            }
            rpt_streets.DataSource = list;
            rpt_streets.DataBind();

            List <Area> list2 = new List <Area>();

            #region ===========加载小区============
            //加载小区
            if (sid > 0)
            {
                list2 = abll.GetListByidlist(sid.ToString());
            }
            else
            {
                List <Area> alllist = new List <Area>();
                if (Cache["allarea"] != null)
                {
                    alllist = HttpContext.Current.Cache["allarea"] as List <Area>;
                }
                else
                {
                    string prestr = "";
                    foreach (Area item in list)
                    {
                        prestr += item.Id + ",";
                    }
                    prestr.Remove(prestr.Length - 1, 1);
                    alllist = abll.GetListByidlist(prestr);
                    HttpContext.Current.Cache.Insert("allarea", alllist);
                }
                int i = 0;
                foreach (Area ar in alllist)
                {
                    if (i > 24)
                    {
                        break;
                    }
                    list2.Add(ar);
                    i++;
                }
            }
            //list2 = abll.GetListByidlist(prestr);

            rpt_district.DataSource = list2;
            rpt_district.DataBind();

            #endregion

            hiddenaid.Value = aid.ToString();
            hiddensid.Value = sid.ToString();

            //加载店铺
            shopinit();
        }
コード例 #9
0
        public List <Area> getDistrict(string sid)
        {
            AreaBLL abll = new AreaBLL();

            return(abll.GetListByidlist(sid));
        }
コード例 #10
0
        public List <Area> getStreet(string aid)
        {
            AreaBLL abll = new AreaBLL();

            return(abll.GetListByidlist(aid));
        }