public async Task <OfferDetailsForCheckingModel> GetOfferDetailsForDirectPurchaseTenderChecking(int combinedId, int userId)
        {
            OfferSolidarity combined = await _offerQueries.FindOfferByCombinedSupplierId(combinedId);

            Tender tender = await _tenderQueries.FindTenderOfferDetailsByTenderIdForDirectPurchaseCheckStage(combined.Offer.TenderId, userId);

            var result = await _offerQueries.GetOfferDetailsForDirectPurchaseChecking(combinedId);

            if (result == null)
            {
                result = new OfferDetailsForCheckingModel
                {
                    TenderID               = tender.TenderId,
                    TenderStatusId         = tender.TenderStatusId,
                    CombinedId             = combinedId,
                    OfferPresentationWayId = tender.OfferPresentationWayId.Value,
                    TenderIdString         = Util.Encrypt(tender.TenderId),
                    OfferIdString          = Util.Encrypt(combined.OfferId)
                };
                result.TenderStatusId = tender.TenderStatusId;
            }
            result.SupplierName             = (combined.Supplier.SelectedCrName);
            result.IsSupplierCombinedLeader = combined.SolidarityTypeId == (int)Enums.UnRegisteredSuppliersInvitationType.SolidarityLeader;
            result.CheckingTwoFilesModel    = new OfferDetailsForCheckingTwoFilesModel
            {
                OfferIdString          = result.OfferIdString,
                TechnicalOfferStatusId = result.TechnicalOfferStatusId,
                RejectionReason        = result.RejectionReason,
                Notes                      = result.Notes,
                TenderStatusId             = result.TenderStatusId,
                TechnicalOfferStatusString = result.TechnicalOfferStatusString
            };
            return(result);
        }
示例#2
0
        public async Task <Offer> AddFinancialOfferAttachmentsInVRO(OfferDetailsForCheckingModel m)
        {
            SupplierCombinedDetail details = await _offerQueries.GetCombinedOfferDetailForVRO(Util.Decrypt(m.CombinedIdString));

            if (details == null)
            {
                details = new SupplierCombinedDetail
                {
                    Combined = await _offerQueries.GetCombinedbyId(Util.Decrypt(m.CombinedIdString))
                };
            }
            var offer = details.Combined.Offer;

            if (offer.Tender.TenderStatusId != (int)Enums.TenderStatus.VROOffersFinancialChecking)
            {
                offer.Tender.UpdateTenderStatus(Enums.TenderStatus.VROOffersFinancialChecking, "", _httpContextAccessor.HttpContext.User.UserId(), TenderActions.FinancialCheckingStarted);
            }
            List <SupplierBankGuaranteeDetail> GuaranteesLst     = new List <SupplierBankGuaranteeDetail>();
            List <SupplierSpecificationDetail> SpecificationsLst = new List <SupplierSpecificationDetail>();

            foreach (var item in m.SpecificationsFiles)
            {
                var Specification = new SupplierSpecificationDetail(item.SpecificationId, Util.Decrypt(m.CombinedIdString), item.IsForApplier, item.Degree, item.ConstructionWorkId, item.MaintenanceRunningWorkId);
                SpecificationsLst.Add(Specification);
            }

            foreach (var item in m.BankGuaranteeFiles)
            {
                var BankGuarantee = new SupplierBankGuaranteeDetail(item.BankGuaranteeId, offer.OfferId, item.IsBankGuaranteeValid, item.GuaranteeNumber, item.BankId.Value, item.Amount, item.GuaranteeStartDate, item.GuaranteeEndDate, item.GuaranteeDays);
                GuaranteesLst.Add(BankGuarantee);
            }
            offer.UpdateOfferAttachments(m.IsOfferCopyAttached, m.IsOfferLetterAttached, m.OfferLetterNumber, m.OfferLetterDate, m.IsVisitationAttached, m.IsPurchaseBillAttached, m.IsBankGuaranteeAttached);
            offer.updateBankGurnteeList(GuaranteesLst);
            offer.UpdateVROOfferFinancialWeight(m.FinancialWeight);
            offer.UpdateOpeningDiscountNotes(m.Discount, m.DiscountNotes);

            details.UpdateAttachmentDetails(details.CombinedDetailId, Util.Decrypt(m.CombinedIdString), m.IsChamberJoiningAttached, m.IsChamberJoiningValid,
                                            m.IsCommercialRegisterAttached, m.IsCommercialRegisterValid, m.IsSaudizationAttached, m.IsSaudizationValidDate, m.IsSocialInsuranceAttached,
                                            m.IsSocialInsuranceValidDate, m.IsZakatAttached, m.IsZakatValidDate, m.IsSpecificationAttached, m.IsSpecificationValidDate);
            details.updateAttachmentsList(SpecificationsLst);

            await CalcFinalPrice(offer);

            await _offerCommands.UpdateCombinedDetailAsync(details);

            return(offer);
        }
        public async Task <IViewComponentResult> InvokeAsync(string combinedId, bool hasManyCombinders = true)
        {
            try
            {
                if (Request.Headers["Referer"] != "")
                {
                    ViewData["Reffer"] = Request.Headers["Referer"].ToString();
                }
                List <BankModel> banks = await _ApiClient.GetListAsync <BankModel>("Lookup/GetBanks", null);

                //List<MaintenanceRunningWorkModel> maintenanceWorks = await _ApiClient.GetListAsync<MaintenanceRunningWorkModel>("Lookup/GetMaintenanceRunningWorks", null);
                List <MaintenanceRunningWorkModel> maintenanceWorks = await _cache.GetOrCreateAsync(CacheKeys.GetMaintenanceRunningWorks, async entry =>
                {
                    int minutes             = int.Parse(_rootConfiguration.CachingConfiguration.CachingMinutes /*_configuration.GetSection("Chaching:CachingMinutes").Value*/);
                    entry.SlidingExpiration = TimeSpan.FromMinutes(minutes);
                    return(await _ApiClient.GetListAsync <MaintenanceRunningWorkModel>("Lookup/GetMaintenanceRunningWorks", null));
                });

                //List<ConstructionWorkModel> constructionWorks = await _ApiClient.GetListAsync<ConstructionWorkModel>("Lookup/GetConstructionWorks", null);
                List <ConstructionWorkModel> constructionWorks = await _cache.GetOrCreateAsync(CacheKeys.GetConstructionWorks, async entry =>
                {
                    int minutes             = int.Parse(_rootConfiguration.CachingConfiguration.CachingMinutes /*_configuration.GetSection("Chaching:CachingMinutes").Value*/);
                    entry.SlidingExpiration = TimeSpan.FromMinutes(minutes);
                    return(await _ApiClient.GetListAsync <ConstructionWorkModel>("Lookup/GetConstructionWorks", null));
                });

                OfferDetailsForCheckingModel model = await _ApiClient.GetAsync <OfferDetailsForCheckingModel>("Offer/GetOfferDetailsForDirectPurchase/" + Util.Decrypt(combinedId), null);

                model.MaintenanceRunningWorks = maintenanceWorks;
                model.ConstructionWorks       = constructionWorks;
                model.Banks             = banks;
                model.CombinedIdString  = combinedId;
                model.HasManyCombinders = hasManyCombinders;
                return(View(model));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
        }