public async Task CheckIfSupplierBlocked(string CR)
 {
     if (await _blockAppService.CheckifSupplierBlockedByCrNo(CR))
     {
         throw new BusinessRuleException("لا يمكن تقديم لان السجل التجارى " + CR + " ممنوع من التقديم");
     }
 }
        public async Task <AnnouncementTemplateMainDetailsModel> GetAnnouncementTemplateDetailsForSuppliers(int announcementId, string cr)
        {
            bool isSupplierBlocked = await _blockAppService.CheckifSupplierBlockedByCrNo(cr);

            if (isSupplierBlocked)
            {
                var announcementTemplate = await _announcementQueries.GetAnnouncementTemplateDetailsForSuppliers(announcementId, cr);

                announcementTemplate.isSupplierBlocked = true;
                return(announcementTemplate);
            }
            return(await _announcementQueries.GetAnnouncementTemplateDetailsForSuppliers(announcementId, cr));
        }
Exemple #3
0
        public async Task <QueryResult <InvitationCrModel> > GetAllSuppliersBySearchCretriaForInvitation(SupplierSearchCretriaModel cretria)
        {
            Tender tender = await _supplierQueries.GetTenderByTenderId(cretria.InvitationTenderId);

            QueryResult <SupplierIntegrationModel> suppliers = await _iidmService.GetSupplierDetailsBySearchCriteria(_mapper.Map <SupplierIntegrationSearchCriteria>(cretria));


            bool isBlocked = await _blockAppService.CheckifSupplierBlockedByCrNo(cretria.CommericalRegisterNo, cretria.AgencyCode);

            List <InvitationCrModel> suppliersInvitation = suppliers.Items.Select(supplier => new InvitationCrModel()
            {
                CrName    = supplier.supplierName,
                CrNumber  = supplier.supplierNumber,
                TenderId  = tender.TenderId,
                IsBlocked = isBlocked,
                IsOwner   = supplier.supplierNumber == tender.AgencyCode ? true : false
            }).ToList();

            QueryResult <InvitationCrModel> suppliersList = suppliersInvitation != null ? new QueryResult <InvitationCrModel>(suppliersInvitation, suppliers.TotalCount, suppliers.PageNumber, suppliers.PageSize) : new QueryResult <InvitationCrModel>(new List <InvitationCrModel>(), 0, 1, 1);
            await _supplierQueries.GetInvitatedSupplier(cretria, suppliersList.Items.ToList());

            return(suppliersList);
        }