首页 > 代码库 > City省市区底层

City省市区底层

/// <summary>
/// 查询已开启的省
/// </summary>
/// <returns></returns>
public List<city_provcn> GetProvcnList()
{
using (eylivesEntities context = new eylivesEntities())
{
List<city_provcn> provcnList = (from c in context.city_provcn where (c.mode >= 1) select c).Distinct().ToList();
return provcnList;
}
}
/// <summary>
/// 根据省查询已开启的市
/// </summary>
/// <param name="provcn"></param>
/// <returns></returns>
public List<string> GetCityList(string provcn)
{
using (eylivesEntities context = new eylivesEntities())
{
List<string> sql1 = (from c in context.cities where c.provcn == provcn select c.districtcn).Distinct().ToList();
return sql1;
}
}
/// <summary>
/// 根据城市查询所有的县
/// </summary>
/// <param name="provcn"></param>
/// <returns></returns>
public List<city> GetXanList(string districtcn)
{
using (eylivesEntities context = new eylivesEntities())
{
List<city> sql1 = (from c in context.cities where c.districtcn.Equals(districtcn) select c).Distinct().ToList();
return sql1;
}
}

City省市区底层