//for search police staion public object GetPoliceStationForSearch(string policeStationName, string districtId, string countryId) { try { string policeStation = string.Empty; Int64? districtIID; int? countryIID; if (policeStationName != string.Empty || policeStationName != "") { policeStation = policeStationName; } else { policeStation = null; } if (districtId != string.Empty || districtId != "") { districtIID = Convert.ToInt64(districtId); } else { districtIID = null; } if (countryId != string.Empty || countryId != "") { countryIID = Convert.ToInt32(countryId); } else { countryIID = null; } OiiOHaatDCDataContext db = DatabaseHelper.GetDataModelDataContext(); var retPoliceStation = (from lc in db.SP_GetPoliceStaionForSearch(policeStation, districtIID, countryIID) select new { lc.DistrictID, lc.DistrictName, lc.PoliceStationID, lc.PoliceStationName, fullSearchPoliceStation = (lc.DistrictName + ", " + lc.PoliceStationName) }).Take(10); //db.Dispose(); return(retPoliceStation); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }