コード例 #1
0
 private void DoDelete(
     DeletedParticipant deletedParticipant,
     Project project,
     Participant participant,
     ParticipantPerson person,
     ParticipantExchangeVisitor exchangeVisitor,
     IEnumerable <ParticipantPersonSevisCommStatus> statii,
     IEnumerable <MoneyFlow> participantSourceMoneyFlows,
     IEnumerable <MoneyFlow> participantRecipientMoneyFlows)
 {
     Contract.Requires(participant != null, "The participant must not be null.");
     Contract.Requires(project != null, "The project must not be null.");
     Context.ParticipantPersonSevisCommStatuses.RemoveRange(statii);
     Context.MoneyFlows.RemoveRange(participantSourceMoneyFlows);
     Context.MoneyFlows.RemoveRange(participantRecipientMoneyFlows);
     if (exchangeVisitor != null)
     {
         Context.ParticipantExchangeVisitors.Remove(exchangeVisitor);
     }
     if (person != null)
     {
         Context.ParticipantPersons.Remove(person);
     }
     Context.Participants.Remove(participant);
     deletedParticipant.Audit.SetHistory(project);
 }
コード例 #2
0
        /// <summary>
        /// Deletes the participant from the datastore given the DeletedParticipant business entity.
        /// </summary>
        /// <param name="deletedParticipant">The business entity.</param>
        public async Task DeleteAsync(DeletedParticipant deletedParticipant)
        {
            var participant = await Context.Participants.FindAsync(deletedParticipant.ParticipantId);

            throwIfEntityNotFound(deletedParticipant.ParticipantId, participant, typeof(Participant));
            throwSecurityViolationIfParticipantDoesNotBelongToProject(deletedParticipant.Audit.User.Id, deletedParticipant.ProjectId, participant);

            var project = await Context.Projects.FindAsync(deletedParticipant.ProjectId);

            throwIfEntityNotFound(deletedParticipant.ProjectId, project, typeof(Project));

            var participantPerson = await Context.ParticipantPersons.FindAsync(deletedParticipant.ParticipantId);

            var exchangeVisitor = await Context.ParticipantExchangeVisitors.FindAsync(deletedParticipant.ParticipantId);

            var statti = await Context.ParticipantPersonSevisCommStatuses.Where(x => x.ParticipantId == deletedParticipant.ParticipantId).ToListAsync();

            var sourceMoneyFlows = await Context.MoneyFlows.Where(x => x.SourceParticipantId == deletedParticipant.ParticipantId).ToListAsync();

            var recipientMoneyFlows = await Context.MoneyFlows.Where(x => x.RecipientParticipantId == deletedParticipant.ParticipantId).ToListAsync();

            DoDelete(deletedParticipant: deletedParticipant,
                     project: project,
                     participant: participant,
                     person: participantPerson,
                     exchangeVisitor: exchangeVisitor,
                     statii: statti,
                     participantRecipientMoneyFlows: recipientMoneyFlows,
                     participantSourceMoneyFlows: sourceMoneyFlows);
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="deletedParticipant"></param>
 public void Delete(DeletedParticipant deletedParticipant)
 {
     Contract.Requires(deletedParticipant != null, "The deleted participant must not be null.");
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="deletedParticipant"></param>
 /// <returns></returns>
 public Task DeleteAsync(DeletedParticipant deletedParticipant)
 {
     Contract.Requires(deletedParticipant != null, "The deleted participant must not be null.");
     return(Task.FromResult <object>(null));
 }