public IActionResult CustomerData(CustomerDataSearch customerDataSearch) { var rootPath = _appSettings.Value.SearchExport; int rowRange = _appSettings.Value.RowRange; CustomerDataFilter customerDataFilter = new CustomerDataFilter() { BusinessVertical = customerDataSearch.BusinessVertical.Any() ? customerDataSearch.BusinessVertical.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Cities = customerDataSearch.Cities.Any() ? customerDataSearch.Cities.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, DataQuantities = customerDataSearch.DataQuantities.Any() ? customerDataSearch.DataQuantities.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Network = customerDataSearch.Network.Any() ? customerDataSearch.Network.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, CustomerNames = customerDataSearch.CustomerNames.Any() ? customerDataSearch.CustomerNames.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Tags = customerDataSearch.Tags.Any() ? customerDataSearch.Tags : new int[] { }, Countries = customerDataSearch.Contries.Any() ? customerDataSearch.Contries.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, States = customerDataSearch.States.Any() ? customerDataSearch.States.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, }; var customerData = _getCustomerData.Get(customerDataFilter); var response = _getCustomerDataDashBoard.CalculateDashBoard(customerData); var fileName = _exportCustomerDataByExcel.CreateExcel(customerData.CustomerDataModels, rootPath, rowRange); response.DownloadLink = fileName; return(Json(response)); }
public IActionResult BusinessToBusinessSearch(CustomerDataSearch business2Business) { var rootPath = _appSettings.Value.SearchExport; int rowRange = _appSettings.Value.RowRange; BusinessToBusinessFilter businessToBusinessFilter = new BusinessToBusinessFilter() { Areas = business2Business.Area.Any() ? business2Business.Area.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, BusinessCategoryId = business2Business.BusinessCategoryId.Any() ? business2Business.BusinessCategoryId.ToArray() : new int[] { }, Cities = business2Business.Cities.Any() ? business2Business.Cities.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Countries = business2Business.Contries.Any() ? business2Business.Contries.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Designation = business2Business.Designation.Any() ? business2Business.Designation.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, States = business2Business.States.Any() ? business2Business.States.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Tags = business2Business.Tags.Any() ? business2Business.Tags : new int[] { } }; var businessToBusiness = _filterBusinessToBusiness.Search(businessToBusinessFilter); var b2bDashboard = _prepareB2BDashBoard.Prepare(businessToBusiness); var fileName = _businessToBusinessExport.ExportExcel(businessToBusiness.BusinessToBusiness, rootPath, rowRange); b2bDashboard.DownloadLink = fileName; return(Json(b2bDashboard)); }
public IActionResult BusinessToCustomerSearch(CustomerDataSearch customerDataSearch) { var rootPath = _appSettings.Value.SearchExport; int rowRange = _appSettings.Value.RowRange; BusinessToCustomerFilter businessToCustomerFilter = new BusinessToCustomerFilter { Age = customerDataSearch.Ages.Any() ? customerDataSearch.Ages : new int[] { }, Areas = customerDataSearch.Area.Any() ? customerDataSearch.Area.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Cities = customerDataSearch.Cities.Any() ? customerDataSearch.Cities.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Countries = customerDataSearch.Contries.Any() ? customerDataSearch.Contries.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Experience = customerDataSearch.Experience.Any() ? customerDataSearch.Experience.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Roles = customerDataSearch.Roles.Any() ? customerDataSearch.Roles.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Salaries = customerDataSearch.Salaries.Any() ? customerDataSearch.Salaries.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, States = customerDataSearch.States.Any() ? customerDataSearch.States.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : null, Tags = customerDataSearch.Tags.Any() ? customerDataSearch.Tags : new int[] { } }; var businessToCustomer = _filterBusinessToCustomer.Search(businessToCustomerFilter); var b2cDashboard = _prepareB2CDashBoard.Prepare(businessToCustomer); var fileName = _exportBusinessToCustomerFilter.CreateExcel(businessToCustomer.BusinessToCustomers, rootPath, rowRange); b2cDashboard.DownloadLink = fileName; return(Json(b2cDashboard)); }