Exemple #1
0
 public static OfferDetailModel _ToDto2(OfferDetailModel entity)
 {
     if (entity == null)
     {
         return(null);
     }
     return(new OfferDetailModel
     {
         OffID = entity.OffID,
         OfdNo = entity.OfdNo,
         SupID = entity.SupID,
         SupName = entity.SupName,
         SubAddress = entity.SubAddress,
         PrdID = entity.PrdID,
         ClrID = entity.ClrID,
         ClrName = entity.ClrName,
         TypeProductID = entity.TypeProductID,
         TypeName = entity.TypeName,
         TrdID = entity.TrdID,
         TrdName = entity.TrdName,
         BrandID = entity.BrandID,
         BrandName = entity.BrandName,
         Description = entity.Description,
         Waranty = entity.Waranty,
         PrdEnabled = entity.PrdEnabled,
         AmountPost = entity.AmountPost,
         AmountApprove = entity.AmountApprove,
         Cost = entity.Cost,
     });
 }
Exemple #2
0
 public static OfferDetailModel _ToDto(OfferDetailModel entity)
 {
     if (entity == null)
     {
         return(null);
     }
     return(new OfferDetailModel
     {
         OfdNo = entity.OfdNo,
         OffID = entity.OffID,
         PrdID = entity.PrdID,
         AmountPost = entity.AmountPost,
         AmountApprove = entity.AmountApprove,
         Cost = entity.Cost,
         OfdEnabled = entity.OfdEnabled,
         TrdID = entity.TrdID,
         TrdName = entity.TrdName,
         BrandID = entity.BrandID,
         BrandName = entity.BrandName,
         ClrID = entity.ClrID,
         ClrName = entity.ClrName,
         TypeProductID = entity.TypeProductID,
         TypeName = entity.TypeName,
     });
 }
Exemple #3
0
 public static WeakOfferDetailsEntity ToDto(OfferDetailModel model)
 {
     return(new WeakOfferDetailsEntity
     {
         OffID = model.OffID,
         OfdNo = model.OfdNo,
         SupID = model.SupID,
         SupName = model.SupName,
         SubAddress = model.SubAddress,
         PrdID = model.PrdID,
         ClrID = model.ClrID,
         ClrName = model.ClrName,
         TypeProductID = model.TypeProductID,
         TypeName = model.TypeName,
         TrdID = model.TrdID,
         TrdName = model.TrdName,
         BrandID = model.BrandID,
         BrandName = model.BrandName,
         Description = model.Description,
         Waranty = model.Waranty,
         PrdEnabled = model.PrdEnabled,
         AmountPost = model.AmountPost,
         AmountApprove = model.AmountApprove,
         Cost = model.Cost,
     });
 }
        public async Task SaveDirectPurchaseOneFileCheckingDataAndAttachemntsDetial(OfferCheckingContainer container)
        {
            var localContentSetting = await _offerQueries.GetLocalContentSettingsDate();

            OfferDetailModel       model          = container.model;
            CheckOfferResultModel  checkingResult = container.checkingResult;
            SupplierCombinedDetail details        = await _offerQueries.GetCombinedOfferDetail(Util.Decrypt(model.CombinedIdString));

            if (details == null)
            {
                details = new SupplierCombinedDetail
                {
                    Combined = await _offerQueries.GetCombinedbyId(Util.Decrypt(model.CombinedIdString))
                };
            }
            await SaveDirectPurchaseAttachment(model, details /*, offer*/);
            await CalculateFinalPriceDirectPurchase(details.Combined.Offer);

            if (details.Combined.Offer.Tender.TenderStatusId != (int)Enums.TenderStatus.OffersChecking)
            {
                details.Combined.Offer.Tender.UpdateTenderStatus(Enums.TenderStatus.OffersChecking);
            }
            details.Combined.Offer.UpdateOfferFinantialCheckingStatus(checkingResult.FinantialOfferStatusId, checkingResult.FinantialRejectionReason, checkingResult.FinantialNotes);
            details.Combined.Offer.UpdateOfferTecknicalCheckingStatus(checkingResult.TechnicalOfferStatusId, checkingResult.RejectionReason, checkingResult.Notes);
            if (details.Combined.Offer.Tender.IsValidToApplyOfferLocalContentChanges(localContentSetting.Date.Value) && details.Combined.Offer.OfferlocalContentDetails != null)
            {
                details.Combined.Offer.OfferlocalContentDetails.SetIsBindedToMandatoryList(checkingResult.IsBindedToMandatoryList);
            }
            if (checkingResult.TechniciansReportAttachments != null)
            {
                List <TechnicianReportAttachment> technicianReportAttachments = _mapper.Map <List <TechnicianReportAttachment> >(checkingResult.TechniciansReportAttachments);
                details.Combined.Offer.UpdateTechnicianReportAttachments(technicianReportAttachments);
            }
            await _offerCommands.UpdateCombinedDetailAsync(details);
        }
        public async Task SaveTwoFileTechnicalCheckingDataAndAttachemntsDetial(OfferCheckingContainer container)
        {
            OfferDetailModel       model          = container.model;
            CheckOfferResultModel  checkingResult = container.checkingResult;
            SupplierCombinedDetail details        = await _offerQueries.GetCombinedOfferDetail(Util.Decrypt(model.CombinedIdString));

            if (details == null)
            {
                details = new SupplierCombinedDetail
                {
                    Combined = await _offerQueries.GetCombinedbyId(Util.Decrypt(model.CombinedIdString))
                };
            }
            await SaveDirectPurchaseAttachment(model, details /*, offer*/);

            if (details.Combined.Offer.Tender.TenderStatusId != (int)Enums.TenderStatus.OffersChecking)
            {
                details.Combined.Offer.Tender.UpdateTenderStatus(Enums.TenderStatus.OffersChecking);
            }
            details.Combined.Offer.UpdateOfferTecknicalCheckingStatus(checkingResult.TechnicalOfferStatusId, checkingResult.RejectionReason, checkingResult.Notes);
            if (checkingResult.TechniciansReportAttachments != null)
            {
                List <TechnicianReportAttachment> technicianReportAttachments = _mapper.Map <List <TechnicianReportAttachment> >(checkingResult.TechniciansReportAttachments);
                details.Combined.Offer.UpdateTechnicianReportAttachments(technicianReportAttachments);
            }
            await _offerCommands.UpdateCombinedDetailAsync(details);
        }
Exemple #6
0
        public async Task <SupplierCombinedDetail> SaveCombinedTechnicalDetailsVRO(OfferDetailModel m)
        {
            bool  isBankGuaranteeAttached = false;
            Offer offer = await _offerQueries.GetOfferById(Util.Decrypt(m.OfferIdString));

            SupplierCombinedDetail details = await _offerQueries.GetCombinedOfferDetail(Util.Decrypt(m.CombinedIdString));

            if (details == null)
            {
                details = new SupplierCombinedDetail();
            }
            List <SupplierBankGuaranteeDetail> GuaranteesLst     = new List <SupplierBankGuaranteeDetail>();
            List <SupplierSpecificationDetail> SpecificationsLst = new List <SupplierSpecificationDetail>();

            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);
            }
            isBankGuaranteeAttached = true;

            offer.UpdateOfferFinantialCheckingDetails(m.IsFinaintialOfferLetterAttached, m.FinantialOfferLetterNumber, m.FinantialOfferLetterDate, m.IsFinantialOfferLetterCopyAttached, isBankGuaranteeAttached);

            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);
            }
            if (m.CombinedOwner == true)
            {
                offer.UpdateOfferAttachments(m.IsOfferCopyAttached, m.IsOfferLetterAttached, m.OfferLetterNumber, m.OfferLetterDate, m.IsVisitationAttached, m.IsPurchaseBillAttached, m.IsBankGuaranteeAttached);
                offer.UpdateOfferFinancialAttachments(m.IsFinaintialOfferLetterAttached, m.IsFinantialOfferLetterCopyAttached);
                offer.UpdateBankGurnteesDetails(GuaranteesLst);
            }
            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);

            offer = await _offerCommands.UpdateAsync(offer);

            details = await _offerCommands.UpdateCombinedDetailAsync(details);

            return(details);
        }
Exemple #7
0
        public async Task <IViewComponentResult> InvokeAsync(string combinedId)
        {
            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));
                });

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

                model.MaintenanceRunningWorks = maintenanceWorks;
                model.ConstructionWorks       = constructionWorks;
                model.Banks            = banks;
                model.CombinedIdString = combinedId;
                return(View(model));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
        }
Exemple #8
0
 public ActionResult UpdateOffer(OfferDetailModel model)
 {
     if (Session["S_EmpID"].ToString() != null)
     {
         var resolveRequest = HttpContext.Request;
         resolveRequest.InputStream.Seek(0, SeekOrigin.Begin);
         string jsonString = new StreamReader(resolveRequest.InputStream).ReadToEnd();
         if (jsonString != null)
         {
             List <OfferDetailModel> myDeserializedObjList = (List <OfferDetailModel>)Newtonsoft.Json.JsonConvert.DeserializeObject(jsonString, typeof(List <OfferDetailModel>));
             var map_update = Mapper._ToDto2(myDeserializedObjList);
             _offerRepository.UpdateOffer(map_update, Session["OffID"].ToString(), Session["S_EmpFname"].ToString());
             return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
         }
         Session["OffID"]    = null;
         ViewBag.OffID       = null;
         ViewBag.SupName     = null;
         ViewData["Approve"] = null;
         return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
         // return RedirectToAction("OfferCreate", "Products");
     }
     return(RedirectToAction("Login2", "Account"));
 }
        public async Task <SupplierCombinedDetail> SaveDirectPurchaseAttachmentsChecking(OfferDetailModel m)
        {
            SupplierCombinedDetail details = await _offerQueries.GetCombinedOfferDetail(Util.Decrypt(m.CombinedIdString));

            if (details == null)
            {
                details = new SupplierCombinedDetail
                {
                    Combined = await _offerQueries.GetCombinedbyId(Util.Decrypt(m.CombinedIdString))
                };
            }
            /*SupplierCombinedDetail */
            CheckIfUserCanAccessLowBudgetTender(details.Combined.Offer.Tender.IsLowBudgetDirectPurchase, details.Combined.Offer.Tender.DirectPurchaseMemberId, _httpContextAccessor.HttpContext.User.UserId());
            details = await SaveDirectPurchaseAttachment(m, details /*, offer*/);

            details = await _offerCommands.UpdateCombinedDetailAsync(details);

            return(details);
        }
        private async Task <SupplierCombinedDetail> SaveDirectPurchaseAttachment(OfferDetailModel model, SupplierCombinedDetail details /*, Offer offer*/)
        {
            var  statuses = GetOfferDirectPurchaseStatuses(details.Combined.Offer);
            bool isOneFile = statuses.Item1, isTechnical = statuses.Item2, isFinancial = statuses.Item3;
            List <SupplierSpecificationDetail> SpecificationsLst = new List <SupplierSpecificationDetail>();

            if ((isOneFile || isTechnical) && model.CombinedOwner)
            {
                details.Combined.Offer.UpdateOfferAttachments(model.IsOfferCopyAttached,
                                                              model.IsOfferLetterAttached,
                                                              model.OfferLetterNumber,
                                                              model.OfferLetterDate,
                                                              model.IsVisitationAttached,
                                                              model.IsPurchaseBillAttached,
                                                              model.IsBankGuaranteeAttached);
            }
            if ((isOneFile || isFinancial) && model.CombinedOwner)
            {
                List <SupplierBankGuaranteeDetail> GuaranteesLst = new List <SupplierBankGuaranteeDetail>();
                foreach (var item in model.BankGuaranteeFiles)
                {
                    var BankGuarantee = new SupplierBankGuaranteeDetail(item.BankGuaranteeId, details.Combined.Offer.OfferId, item.IsBankGuaranteeValid, item.GuaranteeNumber, item.BankId.Value, item.Amount, item.GuaranteeStartDate, item.GuaranteeEndDate, item.GuaranteeDays);
                    GuaranteesLst.Add(BankGuarantee);
                }
                details.Combined.Offer.UpdateBankGurnteesDetails(GuaranteesLst);
                details.Combined.Offer.UpdateOfferFinantialCheckingDetails(model.IsFinaintialOfferLetterAttached,
                                                                           model.FinantialOfferLetterNumber,
                                                                           model.FinantialOfferLetterDate,
                                                                           model.IsFinantialOfferLetterCopyAttached,
                                                                           model.IsBankGuaranteeAttached);
            }
            if (isOneFile || isTechnical)
            {
                foreach (var item in model.SpecificationsFiles)
                {
                    var Specification = new SupplierSpecificationDetail(item.SpecificationId, Util.Decrypt(model.CombinedIdString), item.IsForApplier, item.Degree, item.ConstructionWorkId, item.MaintenanceRunningWorkId);
                    SpecificationsLst.Add(Specification);
                }
                details.updateAttachmentsList(SpecificationsLst);
                details.UpdateAttachmentDetails(details.CombinedDetailId,
                                                Util.Decrypt(model.CombinedIdString),
                                                model.IsChamberJoiningAttached,
                                                model.IsChamberJoiningValid,
                                                model.IsCommercialRegisterAttached,
                                                model.IsCommercialRegisterValid,
                                                model.IsSaudizationAttached,
                                                model.IsSaudizationValidDate,
                                                model.IsSocialInsuranceAttached,
                                                model.IsSocialInsuranceValidDate,
                                                model.IsZakatAttached,
                                                model.IsZakatValidDate,
                                                model.IsSpecificationAttached,
                                                model.IsSpecificationValidDate);

                if (details.Combined.Offer.Tender.TenderStatusId != (int)Enums.TenderStatus.OffersChecking)
                {
                    details.Combined.Offer.Tender.UpdateTenderStatus(Enums.TenderStatus.OffersChecking);
                }
            }
            if (isFinancial && details.Combined.Offer.Tender.TenderStatusId != (int)Enums.TenderStatus.OffersFinancialChecking)
            {
                details.Combined.Offer.Tender.UpdateTenderStatus(Enums.TenderStatus.OffersFinancialChecking);
            }
            return(details);
        }