コード例 #1
0
    protected string GetCity(string pid, string cid)
    {
        IList <ProvinceInfo> list = CacheCollection.GetAllProvinceInfo();

        foreach (ProvinceInfo info in list)
        {
            if (info.ID.ToString() != pid)
            {
                continue;
            }
            if (cid == Guid.Empty.ToString())
            {
                return(info.ProvinceName + "所有地区");
            }
            foreach (CityInfo cinfo in info.CityList)
            {
                if (cinfo.ID.ToString() == cid)
                {
                    return(info.ProvinceName + cinfo.CityName);
                }
            }
        }

        return("未知");
    }
コード例 #2
0
    protected void ddl_Pr_SelectedIndexChanged(object sender, EventArgs e)
    {
        //CityService csDal = new CityService();
        IList <CityInfo> list = new List <CityInfo>(CacheCollection.GetAllProvinceInfo().Where(o => o.ID == new Guid(ddl_Pr.SelectedValue)).ToList()[0].CityList);//csDal.GetAllCity(new Guid(ddl_Pr.SelectedValue));

        list.Insert(0, new CityInfo {
            ID = Guid.Empty, CityName = "所有城市"
        });

        ddl_City.DataSource     = list;
        ddl_City.DataTextField  = "CityName";
        ddl_City.DataValueField = "ID";
        ddl_City.DataBind();
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //ProvinceService pvDal = new ProvinceService();

            IList <ExpressInfo> list = CacheCollection.GetAllExpressInfo(); //esDal.GetAllExpressInfo("");
            ddl_Express.DataSource     = list;
            ddl_Express.DataTextField  = "ExpressName";
            ddl_Express.DataValueField = "ExpressId";
            ddl_Express.DataBind();

            IList <ProvinceInfo> plist = CacheCollection.GetAllProvinceInfo(); //pvDal.GetAllProvince();
            ddl_Pr.DataSource     = plist;
            ddl_Pr.DataTextField  = "ProvinceName";
            ddl_Pr.DataValueField = "ID";
            ddl_Pr.DataBind();

            Bind();
        }
    }