Example #1
0
        public async Task <QueryResult <SupplierBlockModel> > GetManagerBlockList(BlockSearchCriteriaModel blockSearchCriteriaModel)
        {
            BlockSearchCriteria supplierIntegrationSearchCriteria = new BlockSearchCriteria
            {
                CommercialRegistrationNo = blockSearchCriteriaModel.CommercialRegistrationNo,
                CommercialSupplierName   = blockSearchCriteriaModel.CommercialSupplierName,
                PageNumber = blockSearchCriteriaModel.PageNumber,
                PageSize   = blockSearchCriteriaModel.PageSize
            };
            var result = await _blockService.GetManagerBlockList(supplierIntegrationSearchCriteria);

            return(result);
        }
        public async Task GetAgencyExceptedModel_Returns_Data()
        {
            var _blockSearchCriteriaModel = new BlockSearchCriteriaModel()
            {
                AgencyCode = "019001000000"
            };

            var result = await _blockController.GetAgencyExceptedModel(_blockSearchCriteriaModel);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <AgencyExceptedModel> >(result);
            Assert.NotEmpty(result.Items);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.PageSize > 0);
        }
Example #3
0
        public async Task <QueryResult <SupplierBlockModel> > GetBlocks(BlockSearchCriteriaModel blockSearchCriteriaModel)
        {
            var blockSearchCriteria = new BlockSearchCriteria(blockSearchCriteriaModel.CommercialRegistrationNo, blockSearchCriteriaModel.CommercialSupplierName);;

            if (User.UserRole() == RoleNames.MonafasatAdmin)
            {
                blockSearchCriteria.AgencyCode = User.UserAgency();
            }
            else if (User.UserRole() == RoleNames.MonafasatBlackListCommittee)
            {
                blockSearchCriteria.AgencyCode = null;
            }
            var blocks = await _blockService.FindAsyn(blockSearchCriteria);

            return(blocks);
        }
        public async Task GetManagerBlockList_Returns_Data()
        {
            var _blockSearchCriteriaModel = new BlockSearchCriteriaModel()
            {
                AgencyCode = "019001000000"
            };

            var result = await _blockController.GetManagerBlockList(_blockSearchCriteriaModel);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <SupplierBlockModel> >(result);
            Assert.NotEmpty(result.Items);
            Assert.True(result.TotalCount > 0);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.PageSize > 0);
        }
        public async Task GetBlocks_Returns_Data()
        {
            var _blockSearchCriteriaModel = new BlockSearchCriteriaModel()
            {
            };

            _claims = new Claim[1] {
                new Claim(IdentityConfigs.Claims.Role, "12"),
            };
            _blockController = _blockController.WithIdentity(_claims);

            var result = await _blockController.GetBlocks(_blockSearchCriteriaModel);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <SupplierBlockModel> >(result);
            Assert.Empty(result.Items);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.PageSize > 0);
        }
Example #6
0
 public async Task <QueryResult <AgencyExceptedModel> > GetAgencyExceptedModel(BlockSearchCriteriaModel blockSearchCriteriaModel)
 {
     return(await _iDMAppService.GetAgencyExceptedModel(blockSearchCriteriaModel));
 }
Example #7
0
        public static async Task <QueryResult <SupplierBlockModel> > GetAsync(BlockSearchCriteriaModel criteria)
        {
            var blockList = JsonConvert.DeserializeObject <QueryResult <SupplierBlockModel> >(await blockRequest.GetAsync("Block/GetBlocks?" + UrlHelper.ToQueryString(criteria)));

            return(blockList);
        }
Example #8
0
        public async Task <QueryResult <AgencyExceptedModel> > GetAgencyExceptedModel(BlockSearchCriteriaModel criteria)
        {
            var tenderType = _context.TenderTypes.ToList();
            var result     = await _context.GovAgencies
                             .Where(a => a.IsActive == true)
                             .WhereIf(!string.IsNullOrEmpty(criteria.AgencyCode), a => a.AgencyCode == criteria.AgencyCode)
                             .WhereIf(!string.IsNullOrEmpty(criteria.AgencyName), a => a.NameArabic.Contains(criteria.AgencyName))
                             .WhereIf(criteria.IsOldBlock != null, a => a.IsOldSystem == criteria.IsOldBlock)
                             .WhereIf(criteria.TenderTypeId != 0, a => a.PurchaseMethods.Contains(criteria.TenderTypeId.ToString()))
                             .Select(c => new AgencyExceptedModel
            {
                AgencyIdString       = c.AgencyCode,
                NameArabic           = c.NameArabic,
                AgencyCode           = c.AgencyCode,
                CategoryId           = c.CategoryId,
                TenderTypes          = GetAgencyPurchaseMethodsModels(c.PurchaseMethods, tenderType),
                IsVro                = c.IsVRO,
                IsRelated            = c.VROOfficeCode == null ? false : true,
                IsOldSystem          = c.IsOldSystem,
                PurchaseMethodString = c.PurchaseMethods,
                MobileNumber         = c.MobileNumber
            }).ToQueryResult(criteria.PageNumber, criteria.PageSize);

            return(result);
        }