using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataPumpWindowsService.Model
{
    public class StaticDictionary
    {
        public Dictionary<string, ProvinceCity> dicProvince { get; set; }
        public StaticDictionary()
        {
            dicProvince = new Dictionary<string, ProvinceCity>();
            dicProvince.Add("北京", new ProvinceCity { ProvinceCode = "110000 BJ", CityCode = "010", CityName = "北京" });
            dicProvince.Add("天津", new ProvinceCity { ProvinceCode = "120000 TJ", CityCode = "022", CityName = "天津" });
            dicProvince.Add("上海", new ProvinceCity { ProvinceCode = "310000 SH", CityCode = "021", CityName = "上海" });
            dicProvince.Add("重庆", new ProvinceCity { ProvinceCode = "500000 CQ", CityCode = "023", CityName = "重庆" });

            dicProvince.Add("河北", new ProvinceCity { ProvinceCode = "130000 HB", CityCode = "0311", CityName = "石家庄" });
            dicProvince.Add("山西", new ProvinceCity { ProvinceCode = "140000 SX", CityCode = "0351", CityName = "太原" });

            dicProvince.Add("内蒙古", new ProvinceCity { ProvinceCode = "150000 NM", CityCode = "0471", CityName = "呼和浩特" });
            dicProvince.Add("辽宁", new ProvinceCity { ProvinceCode = "210000 LN", CityCode = "024", CityName = "沈阳" });
            dicProvince.Add("吉林", new ProvinceCity { ProvinceCode = "220000 JL", CityCode = "0431", CityName = "长春" });
            dicProvince.Add("黑龙江", new ProvinceCity { ProvinceCode = "230000 HL", CityCode = "0451", CityName = "哈尔滨" });

            dicProvince.Add("江苏", new ProvinceCity { ProvinceCode = "320000 JS", CityCode = "025", CityName = "南京" });
            dicProvince.Add("浙江", new ProvinceCity { ProvinceCode = "330000 ZJ", CityCode = "0571", CityName = "杭州" });
            dicProvince.Add("安徽", new ProvinceCity { ProvinceCode = "340000 AH", CityCode = "0551", CityName = "合肥" });
            dicProvince.Add("福建", new ProvinceCity { ProvinceCode = "350000 FJ", CityCode = "0591", CityName = "福州" });
            dicProvince.Add("江西", new ProvinceCity { ProvinceCode = "360000 JX", CityCode = "0791", CityName = "南昌" });
            dicProvince.Add("山东", new ProvinceCity { ProvinceCode = "370000 SD", CityCode = "0531", CityName = "济南" });
            dicProvince.Add("河南", new ProvinceCity { ProvinceCode = "410000 HA", CityCode = "0371", CityName = "郑州" });
            dicProvince.Add("湖北", new ProvinceCity { ProvinceCode = "420000 HB", CityCode = "027", CityName = "武汉" });

            dicProvince.Add("湖南", new ProvinceCity { ProvinceCode = "430000 HN", CityCode = "0731", CityName = "长沙" });
            dicProvince.Add("广东", new ProvinceCity { ProvinceCode = "440000 GD", CityCode = "020", CityName = "广州" });
            dicProvince.Add("广西", new ProvinceCity { ProvinceCode = "450000 GX", CityCode = "0771", CityName = "南宁" });
            dicProvince.Add("海南", new ProvinceCity { ProvinceCode = "460000 HI", CityCode = "0898", CityName = "海口" });

            dicProvince.Add("四川", new ProvinceCity { ProvinceCode = "510000 SC", CityCode = "028", CityName = "成都" });
            dicProvince.Add("贵州", new ProvinceCity { ProvinceCode = "520000 GZ", CityCode = "0851", CityName = "贵阳" });
            dicProvince.Add("云南", new ProvinceCity { ProvinceCode = "530000 YN", CityCode = "0871", CityName = "昆明" });

            dicProvince.Add("西藏", new ProvinceCity { ProvinceCode = "540000 XZ", CityCode = "0891", CityName = "拉萨" });
            
            dicProvince.Add("陕西", new ProvinceCity { ProvinceCode = "610000 SN", CityCode = "029", CityName = "西安" });

            dicProvince.Add("甘肃", new ProvinceCity { ProvinceCode = "620000 GS", CityCode = "0931", CityName = "兰州" });
            dicProvince.Add("青海", new ProvinceCity { ProvinceCode = "630000 QH", CityCode = "0971", CityName = "西宁" });
            dicProvince.Add("宁夏", new ProvinceCity { ProvinceCode = "640000 NX", CityCode = "0951", CityName = "银川" });
            dicProvince.Add("新疆", new ProvinceCity { ProvinceCode = "650000 XJ", CityCode = "0991", CityName = "乌鲁木齐" });
            dicProvince.Add("香港", new ProvinceCity { ProvinceCode = "810000 HK", CityCode = "00852", CityName = "香港" });
            dicProvince.Add("澳门", new ProvinceCity { ProvinceCode = "820000 Mo", CityCode = "00853", CityName = "澳门" });
            dicProvince.Add("台湾", new ProvinceCity { ProvinceCode = "830000 Tw", CityCode = "02", CityName = "台北" });
        }

        public static StaticDictionary _StaticDictionary = null;
        private static object Singleton_Lock = new object(); //锁同步
        public static StaticDictionary CreateInstance()
        {
            lock (Singleton_Lock)
            {
                if (_StaticDictionary == null)
                {
                    _StaticDictionary = new StaticDictionary();
                }
            }
            return _StaticDictionary;
        }
    }

    public class ProvinceCity
    {
        public string ProvinceCode { get; set; }
        //public string ProvinceName { get; set; }
        public string CityCode { get; set; }
        public string CityName { get; set; }
    }

}
