public JsonResult GetContractTypes(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null) { eTracLoginModel ObjLoginModel = null; ViewBag.AccountSection = true; if (Session != null && Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); if (locationId == null) { locationId = ObjLoginModel.LocationID; } UserId = ObjLoginModel.UserId; } JQGridResults result = new JQGridResults(); List <JQGridRow> rowss = new List <JQGridRow>(); sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx; txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator); try { var contractTypeList = _IContractType.GetContractTypeList(UserId, rows, TotalRecords, sidx, sord); foreach (var contracttype in contractTypeList.rows) { JQGridRow row = new JQGridRow(); row.id = Cryptography.GetEncryptedData(Convert.ToString(contracttype.CTT_Id), true); row.cell = new string[3]; row.cell[0] = Convert.ToString(contracttype.CTT_ContractType); row.cell[1] = Convert.ToString(contracttype.CTT_Discription); row.cell[2] = Convert.ToString(contracttype.CTT_IsActive); rowss.Add(row); } result.rows = rowss.ToArray(); result.page = Convert.ToInt32(page); result.total = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value); result.records = Convert.ToInt32(TotalRecords.Value); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); }