using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using JuSNS.Factory;
using JuSNS.Model;

namespace JuSNS.Home
{
    public class Dict
    {
        JuSNS.Factory.IDict dal;
        public Dict()
        {
            dal = DataAccess.CreateDict();
        }
        /// <summary>
        /// 获取省市列表
        /// </summary>
        /// <returns></returns>
        public List<DictAreaInfo> GetArea()
        {
            return dal.GetArea();
        }

        /// <summary>
        /// 取得城市列表
        /// </summary>
        /// <param name="ParertID"></param>
        /// <returns></returns>
        public List<DictAreaInfo> CityList(int ParertID)
        {
            return dal.CityList(ParertID);
        }

        public int GetParentCity(int Cid)
        {
            return dal.GetParentCity(Cid);
        }

        /// <summary>
        /// 取得某个省市详细信息
        /// </summary>
        /// <param name="ID">省市编号</param>
        /// <returns></returns>
        public DictAreaInfo Info(int ID)
        {
            return dal.Info(ID);
        }
        /// <summary>
        /// 根据名称取得地区ID
        /// </summary>
        /// <param name="areaname">地域名称</param>
        /// <returns></returns>
        public string GetAreaName(int areaId)
        {
            return dal.GetAreaName(areaId);
        }
        /// <summary>
        /// 根据名称取得地区ID
        /// </summary>
        /// <param name="areaname">地域名称</param>
        /// <returns></returns>
        public int GetAreaID(string areaname)
        {
           return dal.GetAreaID(areaname);
        }
    }
}
