コード例 #1
0
ファイル: RegionDal.cs プロジェクト: blissvisitor/QRApp
        /// <summary>
        /// 根据区县id获取乡镇
        /// </summary>
        /// <param name="countyId">province_id</param>
        /// <returns></returns>
        public static List <TOWN> getTownByCountyId(string countyId)
        {
            List <TOWN> lst = new List <TOWN>();

            try
            {
                string    sql = "select id,county_id,town_id,town_name from town  where  county_id='" + countyId + "'order by town_id ";
                DataTable dt  = MySqlDHelper.ExecuteDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        TOWN town = new TOWN();
                        town.ID        = int.Parse(row["id"].ToString());
                        town.COUNTY_ID = row["county_id"].ToString();
                        town.TOWN_ID   = row["town_id"].ToString();
                        town.TOWN_NAME = row["town_name"].ToString();
                        lst.Add(town);
                    }
                }
                return(lst);
            }
            catch (Exception e)
            {
                string err = new DateTime().ToString() + " 根据区县id获取乡镇:region/getTownByCountyId ,错误:" + e.Message;
                LogHelper.WriteLog(err);
                return(lst);
            }
        }
コード例 #2
0
 public static Town Get(TOWN town)
 {
     return(new Town
     {
         Id = town.ID,
         Name = town.NAME
     });
 }