public ActionResult Agreement(int rowCount = 25, int page           = 1, string keyword = null,
                                      string name  = null, string BFCompany = null, string counterpart = null, string objectOfAgreement = null, string type = null)
        {
            var searchResultObject = new VMSearchResultObject <AgreementT> {
                Caption = "Agreement"
            };
            var startIndex = (page - 1) * rowCount;

            var query      = AgreementUtils.BuildQuery(startIndex, rowCount, keyword ?? name, BFCompany, counterpart, objectOfAgreement, type);
            var agreements = this._managementAgreementService.GetByQuery(query.Item1, query.Item2, out int total);

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

            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));
        }
        public FileContentResult AgreementExport(string keyword = null, string name = null, string BFCompany = null, string counterpart = null, string objectOfAgreement = null, string type = null)
        {
            var query = AgreementUtils.BuildExportQuery(keyword ?? name, BFCompany, counterpart, objectOfAgreement, type);
            var file  = this._managementAgreementService.ExportByQuery(query);

            return(File(new UTF8Encoding().GetBytes(file.ToString()), "text/csv", $"Export-Agreement-{StringUtils.GetCurrentDateTimeAsString()}.csv"));
        }