public async Task <IActionResult> GetInvitedSuppliersForInvitationInTenderCreationAsync(SupplierSearchCretriaModel supplierSearchCretria)
        {
            try
            {
                var suppliers = await _ApiClient.GetQueryResultAsync <InvitationCrModel>("Invitation/GetInvitedSuppliersForInvitationInTenderCreation", supplierSearchCretria.ToDictionary());

                return(Json(new PaginationModel(suppliers.Items, suppliers.TotalCount, _pageSize, suppliers.PageNumber, null)));
            }
            catch (BusinessRuleException ex)
            {
                AddError(ex.Message);
                return(NotFound());
            }
            catch (AuthorizationException ex)
            { throw ex; }
            catch
            {
                AddError(Resources.TenderResources.ErrorMessages.UnexpectedError); return(NotFound());
            }
        }
        public async Task <IActionResult> GetEmailsForUnregisteredSuppliersAsync(SupplierSearchCretriaModel supplierSearchCretria)
        {
            try
            {
                var suppliers = await _ApiClient.GetQueryResultAsync <string>("Invitation/GetEmailsForUnregisteredSuppliers", supplierSearchCretria.ToDictionary());

                return(Json(new PaginationModel(suppliers.Items, suppliers.TotalCount, 100, 1, null)));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
            catch (BusinessRuleException ex)
            {
                return(JsonErrorMessage(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString(), ex);
                return(JsonErrorMessage(Resources.TenderResources.ErrorMessages.UnexpectedError));
            }
        }
        public async Task <IActionResult> GetAllSuppliersBySearchCretriaForInvitationAsync(SupplierSearchCretriaModel supplierSearchCretria)
        {
            try
            {
                var suppliers = await _ApiClient.GetQueryResultAsync <InvitationCrModel>("Invitation/GetAllSuppliersBySearchCretriaForInvitation", supplierSearchCretria.ToDictionary());

                return(Json(new PaginationModel(suppliers.Items, suppliers.TotalCount, suppliers.PageSize, suppliers.PageNumber, null)));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
            catch (BusinessRuleException ex)
            {
                return(JsonErrorMessage(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString(), ex);
                return(JsonErrorMessage(Resources.TenderResources.ErrorMessages.UnexpectedError));
            }
        }
        public async Task <IActionResult> IndexPagingAsync(SupplierSearchCretriaModel suppliersSearchCriteria)
        {
            try
            {
                suppliersSearchCriteria.AgencyCode = User.UserAgency();
                var vendors = await _ApiClient.GetQueryResultAsync <SupplierInvitationModel>("ManageVendors/Find", suppliersSearchCriteria.ToDictionary());

                return(Json(new PaginationModel(vendors.Items, vendors.TotalCount, vendors.PageSize, vendors.PageNumber, null)));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
            catch (BusinessRuleException ex)
            {
                return(JsonErrorMessage(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString(), ex);
                return(JsonErrorMessage(Resources.TenderResources.ErrorMessages.UnexpectedError));
            }
        }