public LookupList GetCityListbyStateID(string StateID) { int IntStateID; LookupList CitylookupList = new LookupList(); Lookup cityLookup; LookUpDAL lookUpDAL = new LookUpDAL(); try { IntStateID = Convert.ToInt32(StateID); } catch (Exception exception) { CitylookupList.Status = false; CitylookupList.Message = "Opps something went worng, with supplied Param !"; Logger Err = new Logger(); Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace); return CitylookupList; } try { DataTable dt = lookUpDAL.GetCityListbyStateID(IntStateID); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { cityLookup = new Lookup(); cityLookup.Id = Convert.ToInt32(dr["ID"] == null ? 0 : dr["ID"]); cityLookup.Name = dr["Name"].ToString(); CitylookupList.Data.Add(cityLookup); } CitylookupList.Status = true; CitylookupList.Message = "List of cities !"; } else { CitylookupList.Status = false; CitylookupList.Message = "No city exists !"; } } catch (Exception exception) { CitylookupList.Status = false; CitylookupList.Message = "Opps something went worng, please check with application admin !"; Logger Err = new Logger(); Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace); } return CitylookupList; }
public LookupList GetStateList() { LookupList stateList = new LookupList(); Lookup stateLookup; LookUpDAL lookUpDAL = new LookUpDAL(); try { DataTable dt = lookUpDAL.GetStateList(); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { stateLookup = new Lookup(); stateLookup.Id = Convert.ToInt32(dr["LID"] == null ? 0 : dr["LID"]); stateLookup.Name = dr["LDESC"].ToString(); stateList.Data.Add(stateLookup); } stateList.Status = true; stateList.Message = "List of States !"; } else { stateList.Status = false; stateList.Message = "No State exists !"; } } catch (Exception exception) { stateList.Status = false; stateList.Message = "Opps something went worng, please check with application admin !"; Logger Err = new Logger(); Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace); } return stateList; }