/// <summary> /// Get the needed data for writing the excel file /// </summary> /// <param name="collection">The collection sent by the form</param> /// <param name="businessApplicationId">Id of business application</param> /// <param name="serviceOrderReportId">Id of service order</param> /// <returns>DynamicDataGrid</returns> private DynamicDataGrid GetModelExportExcel(FormCollection collection, Guid businessApplicationId, Guid serviceOrderReportId) { if (collection.ToFilledDictionary().Keys.Contains("InspectionReportId")) collection.Remove("InspectionReportId"); if (collection.ToFilledDictionary().Keys.Contains("selectedInspectionReports")) collection.Remove("selectedInspectionReports"); List<string> fielsdWithLike = new List<string>(); foreach (string name in collection.AllKeys.Where(name => name.Contains("IsLike"))) { fielsdWithLike.Add(name.Replace("IsLike", "")); collection.Remove(name); } //set the parameters for search ParameterSearchInspectionReport parameters = new ParameterSearchInspectionReport { BusinessApplicationId = businessApplicationId, Collection = collection, InspectionReportName = _inspectionReportId, ServiceOrderId = serviceOrderReportId, UserName = UserName, RolesForUser = Roles.GetRolesForUser(UserName).ToList(), PageSize = 0, SelectedPage = 0, IsClient = User.IsInRole("Client"), IsExport = true, Captions = _captions, FieldsWithLike = fielsdWithLike }; //get the data return InspectionReportBusiness.SearchInspectionReportList(parameters); }