public AnnouncementSupplierTemplate ReturnAnnouncementSupplierTemplateDefaultsForUpdateApprovedList() { AnnouncementSupplierTemplate generalAnnouncementSupplierTemplate = new AnnouncementSupplierTemplate(); generalAnnouncementSupplierTemplate.UpdateAnnouncementSupplierTemplateListData(GetAllAnnouncementSupplierTemplateModelDataForUpdateList(), new List <AnnouncementSuppliersTemplateAttachment>(), 1); return(generalAnnouncementSupplierTemplate); }
private async Task UpdateAnnouncemnetTemplateData(CreateAnnouncementSupplierTemplateModel announcementModel, int createdById, List <AnnouncementSuppliersTemplateAttachment> attachments, int insertionType) { if (!announcementModel.IsRequiredAttachmentToJoinList) { announcementModel.RequiredAttachment = ""; } if (!announcementModel.IsEffectiveList) { announcementModel.EffectiveListDate = null; } AnnouncementSupplierTemplate announcementSupplierTemplate = await _announcementQueries.GetAnnouncementByIdForCreationStep(Util.Decrypt(announcementModel.AnnouncementIdString)); announcementSupplierTemplate.UpdateAnnouncementSupplierTemplateData(announcementModel, attachments, createdById); if (insertionType == (int)Enums.AnnouncementSupplierTemplateInsertionType.FromCreation) { announcementSupplierTemplate.SetApprovalStatus(Enums.AnnouncementSupplierTemplateStatus.ReadyForApproval); } else { announcementSupplierTemplate.SetApprovalStatus(Enums.AnnouncementSupplierTemplateStatus.UnderCreation); } await _announcementCommands.UpdateAnnouncementSupplierTemplate(announcementSupplierTemplate); await _announcementCommands.SaveChangesAsync(); }
public AnnouncementSupplierTemplate ReturnAnnouncementSupplierTemplateDefaults() { AnnouncementSupplierTemplate generalAnnouncementSupplierTemplate = new AnnouncementSupplierTemplate(); generalAnnouncementSupplierTemplate.CreateAnnouncementSupplierTemplate(GetAllAnnouncementSupplierTemplateModelData(), new List <AnnouncementSuppliersTemplateAttachment>(), 1); generalAnnouncementSupplierTemplate.UpdateAnnouncementStatus_ForTest(); return(generalAnnouncementSupplierTemplate); }
public AnnouncementSupplierTemplate ReturnAnnouncementSupplierTemplateWithLinkedAgencyDefaults() { AnnouncementSupplierTemplate generalAnnouncementSupplierTemplate = new AnnouncementSupplierTemplate(); LinkedAgenciesAnnouncementTemplate linkedAgencies = new LinkedAgenciesAnnouncementTemplate(AgencyCode); generalAnnouncementSupplierTemplate.CreateAnnouncementSupplierTemplate(GetAllAnnouncementSupplierTemplateModelData(), new List <AnnouncementSuppliersTemplateAttachment>(), 1); generalAnnouncementSupplierTemplate.SetLinkedAgencies(linkedAgencies); return(generalAnnouncementSupplierTemplate); }
public AnnouncementSupplierTemplate ReturnAnnouncementSupplierTemplateDefaultsForRequestJoin() { AnnouncementSupplierTemplate generalAnnouncementSupplierTemplate = new AnnouncementSupplierTemplate(); generalAnnouncementSupplierTemplate.UpdateAnnouncementSupplierTemplateListData(GetAllAnnouncementSupplierTemplateModelDataForUpdateList(), new List <AnnouncementSuppliersTemplateAttachment>(), 1); generalAnnouncementSupplierTemplate.Test_UpdateStatus(3); generalAnnouncementSupplierTemplate.Test_AddedCreatedByID(); return(generalAnnouncementSupplierTemplate); }
private async Task IsValidToAddJoinRequestToAnnouncementTemplate(AnnouncementSupplierTemplate announcement, string cr) { if (announcement.StatusId != (int)Enums.AnnouncementStatus.Approved) { throw new BusinessRuleException(Resources.AnnouncementResources.ErrorMessages.AnnoucementNotApproved); } if (announcement.IsEffectiveList.HasValue && announcement.EffectiveListDate < DateTime.Now) { throw new BusinessRuleException("الاعلان غير سارى"); } var hasSentOrAcceptedJoinRequest = announcement.AnnouncementJoinRequests.Any(q => q.Cr == cr && (q.StatusId == (int)Enums.AnnouncementTemplateJoinRequestStatus.Accepted || q.StatusId == (int)Enums.AnnouncementTemplateJoinRequestStatus.Sent)); if (hasSentOrAcceptedJoinRequest) { throw new BusinessRuleException(Resources.AnnouncementResources.ErrorMessages.ThierIsRequestUnderProcessing); } }
public AnnouncementJoinRequestSupplierTemplate GetJoinRequestWithAnnouncementDefaultData() { AnnouncementJoinRequestSupplierTemplate joinRequest = new AnnouncementJoinRequestSupplierTemplate(ATTACHMENTS, ANNOUNCEMENT_ID, CR, JOIN_REQUEST_STATUS_ID); AnnouncementSupplierTemplate announcementTemplate = new AnnouncementSupplierTemplate(); announcementTemplate.CreateAnnouncementSupplierTemplate(new AnnouncementTemplateDefaults().GetAllAnnouncementSupplierTemplateModelData(), new List <AnnouncementSuppliersTemplateAttachment>(), 1); joinRequest.SetAnnouncementTemplate(announcementTemplate); var lst = new List <AnnouncementTemplateJoinRequestHistory>(); lst.Add(new AnnouncementTemplateJoinRequestHistory(1, 1, 6, "", "")); joinRequest.setJoinRequestStatusForTest(lst); return(joinRequest); }
public async Task <CreateAnnouncementSupplierTemplateModel> SaveDraft(CreateAnnouncementSupplierTemplateModel announcementModel) { int createdById = _httpContextAccessor.HttpContext.User.UserId(); announcementModel.AgencyCode = _httpContextAccessor.HttpContext.User.UserAgency(); Check.ArgumentNotNull(nameof(announcementModel), announcementModel); List <AnnouncementSuppliersTemplateAttachment> attachments = new List <AnnouncementSuppliersTemplateAttachment>(); if (announcementModel.Attachments != null) { foreach (var item in announcementModel.Attachments) { attachments.Add(new AnnouncementSuppliersTemplateAttachment(item.Name, item.FileNetReferenceId, item.AttachmentTypeId)); } } if (!string.IsNullOrEmpty(announcementModel.AnnouncementIdString)) { await UpdateAnnouncemnetTemplateData(announcementModel, createdById, attachments, (int)Enums.AnnouncementSupplierTemplateInsertionType.FromSaveDraft); return(announcementModel); } else { AnnouncementSupplierTemplate announcementSupplierTemplate = new AnnouncementSupplierTemplate(); announcementSupplierTemplate.CreateAnnouncementSupplierTemplate(announcementModel, attachments, createdById); announcementSupplierTemplate.SetReferenceNumber(await _announcementCommands.UpdateReferenceNumber()); announcementSupplierTemplate.SetApprovalStatus(Enums.AnnouncementSupplierTemplateStatus.UnderCreation); await _announcementCommands.CreateAnnouncementSupplierTemplate(announcementSupplierTemplate); await _announcementCommands.SaveChangesAsync(); announcementModel.AnnouncementId = announcementSupplierTemplate.AnnouncementId; announcementModel.AnnouncementIdString = Util.Encrypt(announcementSupplierTemplate.AnnouncementId); return(announcementModel); } }
private async Task SendNotificationAfterDeleteSupplierFromAnnoincementList(DeleteSupplierFromAnnouncementModel deleteModel, AnnouncementSupplierTemplate announcementList) { var announcementTemplateIdString = Util.Encrypt(announcementList.AnnouncementId); List <string> crs = new List <string> { deleteModel.CR }; MainNotificationTemplateModel templateModel; NotificationArguments NotificationArguments = new NotificationArguments(); NotificationArguments.BodyEmailArgs = new object[] { announcementList.ReferenceNumber }; NotificationArguments.SubjectEmailArgs = new object[] { }; NotificationArguments.PanelArgs = new object[] { announcementList.ReferenceNumber }; NotificationArguments.SMSArgs = new object[] { announcementList.ReferenceNumber }; templateModel = new MainNotificationTemplateModel(NotificationArguments, $"AnnouncementSuppliersTemplate/AnnouncementSuppliersTemplateDetailsForSuppliers?announcmentIdString={announcementTemplateIdString}", NotificationEntityType.Tender, announcementList.AnnouncementId.ToString(), 0); await _notificationAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.OperationsOnTheTender.DeleteSupplierFromAnnouncementList, crs, templateModel); }
public async Task <AnnouncementSupplierTemplate> UpdateAnnouncementSupplierTemplateAsync(AnnouncementSupplierTemplate announcement) { _context.AnnouncementSupplierTemplate.Update(announcement); await _context.SaveChangesAsync(); return(announcement); }
public async Task UpdateAnnouncementSupplierTemplate(AnnouncementSupplierTemplate announcement) { Check.ArgumentNotNull(nameof(announcement), announcement); _context.AnnouncementSupplierTemplate.Update(announcement); }
public async Task <AnnouncementSupplierTemplate> CreateAnnouncementSupplierTemplate(AnnouncementSupplierTemplate announcement) { Check.ArgumentNotNull(nameof(announcement), announcement); await _context.AnnouncementSupplierTemplate.AddAsync(announcement); return(announcement); }