コード例 #1
0
ファイル: AjaxService.cs プロジェクト: jahmed25/fnf
        public static Dictionary <string, string> getCityState(string pin)
        {
            DataTable     dt      = new DataTable();
            List <string> pinList = new List <string>();

            if (HttpContext.Current.Application[Constant.Application.PIN_DT] != null)
            {
                dt = HttpContext.Current.Application[Constant.Application.PIN_DT] as DataTable;
            }
            else
            {
                dt = PinDAO.getPinDT();
            }
            IEnumerable <DataRow> query = from DataRow dr in dt.Rows
                                          where dr.Field <String>("PinCodeLocation_PinCode").Equals(pin)
                                          select dr;

            dt = query.CopyToDataTable <DataRow>();
            Dictionary <string, string> dic = new Dictionary <string, string>();

            if (!CommonUtil.DT.isEmptyOrNull(dt))
            {
                dic.Add("city", dt.Rows[0]["PinCodeLocation_City"] + "");
                dic.Add("state", dt.Rows[0]["PinCodeLocation_State"] + "");
            }
            return(dic);
        }
コード例 #2
0
ファイル: AjaxService.cs プロジェクト: jahmed25/fnf
        public static List <string> getCityDT(string startWith)
        {
            DataTable     dt      = new DataTable();
            List <string> pinList = new List <string>();

            if (HttpContext.Current.Application[Constant.Application.PIN_DT] != null)
            {
                dt = HttpContext.Current.Application[Constant.Application.PIN_DT] as DataTable;
            }
            else
            {
                dt = PinDAO.getPinDT();
            }
            var v = (from DataRow dr in dt.Rows
                     where dr.Field <String>("PinCodeLocation_City").ToLower().StartsWith(startWith.ToLower())
                     select(string) dr["PinCodeLocation_City"]);

            try
            {
                pinList = v.ToList <string>().Distinct().ToList();
            }
            catch { }
            return(pinList);
        }