private void SearchEvacuees(HttpContext context, Dictionary <string, object> jsData) { JqGridDataObject <ShiltonMekomi> dataObject = BuildEvacueesColModel(); #region Fill Values in Vars int? AreaId = null, CityId = null, streetId = null, EqMahozId = null, equipId = null; DateTime?DateIncomeBegin = null, DateIncomeEnd = null; long? IdNumber = null; if (jsData["AreaId"] != null && !string.IsNullOrEmpty(jsData["AreaId"].ToString())) { AreaId = int.Parse(jsData["AreaId"].ToString()); } if (jsData["EqMahozId"] != null && !string.IsNullOrEmpty(jsData["EqMahozId"].ToString())) { EqMahozId = int.Parse(jsData["EqMahozId"].ToString()); } if (jsData["equipId"] != null && !string.IsNullOrEmpty(jsData["equipId"].ToString())) { equipId = int.Parse(jsData["equipId"].ToString()); } if (jsData["City"] != null && !string.IsNullOrEmpty(jsData["City"].ToString())) { CityId = GetCitiesCache(context) .Where(c => c.YeshuvName == jsData["City"].ToString()) .Select(c => c.YeshuvNum) .FirstOrDefault(); } if (jsData["street"] != null && !string.IsNullOrEmpty(jsData["street"].ToString())) { streetId = GetStreetsCache(context) .Where(s => s.StName == jsData["street"].ToString()) .Select(s => s.StNum) .FirstOrDefault(); } if (jsData["DateIncomeBegin"] != null && !string.IsNullOrEmpty(jsData["DateIncomeBegin"].ToString())) { string[] formats = { "MM/dd/yyyy" }; DateIncomeBegin = DateTime.ParseExact(jsData["DateIncomeBegin"].ToString(), formats, new CultureInfo("he-IL"), DateTimeStyles.None); } if (jsData["DateIncomeEnd"] != null && !string.IsNullOrEmpty(jsData["DateIncomeEnd"].ToString())) { string[] formats = { "MM/dd/yyyy" }; DateIncomeEnd = DateTime.ParseExact(jsData["DateIncomeEnd"].ToString(), formats, new CultureInfo("he-IL"), DateTimeStyles.None); } if (jsData["IdNumber"] != null && !string.IsNullOrEmpty(jsData["IdNumber"].ToString())) { IdNumber = long.Parse(jsData["IdNumber"].ToString()); } #endregion SearchResponse response = ManageSearch.SearchEvacuees(jsData["firstName"] != null? jsData["firstName"].ToString() : null, jsData["lastName"] != null ? jsData["lastName"].ToString() : null, jsData["fatherName"] != null ? jsData["fatherName"].ToString() : null, jsData["gender"] != null ? jsData["gender"].ToString() : null, IdNumber, DateIncomeBegin, DateIncomeEnd, AreaId, CityId, streetId, EqMahozId, equipId); if (!response.IsError) { dataObject.datastr = response.ShiltonMekomi.ToList(); } JqGridResult <ShiltonMekomi> result = new JqGridResult <ShiltonMekomi>() { jqGridDataObject = dataObject, groupHeaders = new GroupHeaders() { groupHeaders = new List <GroupHeader>() { //new GroupHeader(){startColumnName = "LastName", numberOfColumns = 10, titleText = "פרטי מפונה"}, new GroupHeader() { startColumnName = "LocalArea", numberOfColumns = 4, titleText = "כתובת מגורים" }, new GroupHeader() { startColumnName = "EqLocalArea", numberOfColumns = 4, titleText = "פרטי מרכז קליטה" } } } }; if (response.IsError) { result.errorMessage = response.ErrorDesc; } JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(result); context.Response.Write(json); }