public FileContentResult CompanyExport(string keyword           = null,
                                               string name              = null, string accountRecordType = null, string formerName     = null, string type     = null, string parentAccount = null, string phone = null,
                                               string fax               = null, string email  = null, string companySize               = null, string industry = null, string nameID = null, string employees    = null, string officeIDGB = null, string OHIMNumOppositions = null,
                                               string escrowAgent       = null, string broker = null, string companyRegistrationNumber = null, string countryOfIncorporation = null, string officers = null, string taxNumber = null,
                                               string bigFootAccredited = null, string shippingCountry = null)
        {
            var query = CompanyUtils.BuildExportQuery(keyword ?? name, accountRecordType, formerName, type, parentAccount, phone,
                                                      fax, email, companySize, industry, nameID, employees, officeIDGB, OHIMNumOppositions,
                                                      escrowAgent, broker, companyRegistrationNumber, countryOfIncorporation, officers, taxNumber,
                                                      bigFootAccredited, shippingCountry);
            var file = this._managementCompanyService.ExportByQuery(query);

            return(File(new UTF8Encoding().GetBytes(file.ToString()), "text/csv", $"Export-Company-{StringUtils.GetCurrentDateTimeAsString()}.csv"));
        }
        public ActionResult Company(int rowCount             = 25, int page = 1, string keyword = null,
                                    string name              = null, string accountRecordType = null, string formerName     = null, string type     = null, string parentAccount = null, string phone = null,
                                    string fax               = null, string email  = null, string companySize               = null, string industry = null, string nameID = null, string employees    = null, string officeIDGB = null, string OHIMNumOppositions = null,
                                    string escrowAgent       = null, string broker = null, string companyRegistrationNumber = null, string countryOfIncorporation = null, string officers = null, string taxNumber = null,
                                    string bigFootAccredited = null, string shippingCountry = null)
        {
            var searchResultObject = new VMSearchResultObject <Company> {
                Caption = "Company"
            };
            var startIndex = (page - 1) * rowCount;

            var query = CompanyUtils.BuildQuery(startIndex, rowCount,
                                                keyword ?? name, accountRecordType, formerName, type, parentAccount, phone,
                                                fax, email, companySize, industry, nameID, employees, officeIDGB, OHIMNumOppositions,
                                                escrowAgent, broker, companyRegistrationNumber, countryOfIncorporation, officers, taxNumber,
                                                bigFootAccredited, shippingCountry);

            var companies = this._managementCompanyService.GetByQuery(query.Item1, query.Item2, out int total);

            searchResultObject.ObjectResult = new VMPageResult <Company>
            {
                StartIndex = startIndex,
                RowCount   = rowCount,
                Page       = page,
                Total      = total,
                Records    = companies
            };

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                var searchResultWrapperList = this._searchService.Search(name ?? keyword);

                searchResultObject.SearchResult = new VMSearchResult
                {
                    Table = searchResultWrapperList
                };
            }

            ViewBag.Keyword         = keyword ?? name;
            ViewBag.IsAdvanceSearch = string.IsNullOrWhiteSpace(keyword);

            return(View(searchResultObject));
        }