示例#1
0
 public Dictionary <int, string> GetCityList(string ProvinceName)
 {
     try
     {
         Dictionary <int, string> OutputDictionary = new Dictionary <int, string>();
         if (new Security(UserProfileObj).AuthenticateUser())
         {
             DataSet  OutputDataset = ProvinceDataLayer.GetDatasetOfProvinces();
             DataView DVTable       = OutputDataset.Tables[0].DefaultView;
             DVTable.Sort = "province asc";
             DataTable dtSorted   = DVTable.ToTable();
             DataRow[] DrFiltered = dtSorted.Select("province = '" + ProvinceName + "'");
             foreach (DataRow dr in DrFiltered)
             {
                 OutputDictionary.Add(int.Parse(dr["cid"].ToString()), dr["city"].ToString());
             }
         }
         return(OutputDictionary);
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }
示例#2
0
        public static List <IProvince> GetProvinceList()
        {
            List <IProvince> ListOfProvince = new List <IProvince>();

            try
            {
                DataSet   OutputDataset   = ProvinceDataLayer.GetDatasetOfProvinces();
                DataView  dvOutputDataset = new DataView(OutputDataset.Tables[0]);
                DataTable dtOutputDataset = dvOutputDataset.ToTable(true, "province");
                foreach (DataRow dr in dtOutputDataset.Rows)
                {
                    ListOfProvince.Add(new Province(dr["Province"].ToString()));
                }
                return(ListOfProvince);
            }
            catch (Exception ex)
            {
                Logger.Instance().Log(Fatal.Instance(), ex);
                throw ex;
            }
        }