protected virtual IDamageTypeStateMergePatched Map(IMergePatchDamageType c) { var stateEventId = new DamageTypeEventId(c.DamageTypeId, c.Version); IDamageTypeStateMergePatched e = NewDamageTypeStateMergePatched(stateEventId); e.Description = c.Description; e.SequenceId = c.SequenceId; e.DefaultHandlingMethodId = c.DefaultHandlingMethodId; e.Active = c.Active; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertySequenceIdRemoved = c.IsPropertySequenceIdRemoved; e.IsPropertyDefaultHandlingMethodIdRemoved = c.IsPropertyDefaultHandlingMethodIdRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; return(e); }
public virtual void When(IDamageTypeStateMergePatched e) { ThrowOnWrongEvent(e); if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.SequenceId == null) { if (e.IsPropertySequenceIdRemoved) { this.SequenceId = default(string); } } else { this.SequenceId = e.SequenceId; } if (e.DefaultHandlingMethodId == null) { if (e.IsPropertyDefaultHandlingMethodIdRemoved) { this.DefaultHandlingMethodId = default(string); } } else { this.DefaultHandlingMethodId = e.DefaultHandlingMethodId; } if (e.Active == null) { if (e.IsPropertyActiveRemoved) { this.Active = default(bool); } } else { this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); } this.UpdatedBy = e.CreatedBy; this.UpdatedAt = e.CreatedAt; }
void IDamageTypeState.When(IDamageTypeStateMergePatched e) { throw new NotSupportedException(); }
public virtual DamageTypeStateMergePatchedDto ToDamageTypeStateMergePatchedDto(IDamageTypeStateMergePatched e) { var dto = new DamageTypeStateMergePatchedDto(); dto.DamageTypeEventId = e.DamageTypeEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Description = e.Description; dto.SequenceId = e.SequenceId; dto.DefaultHandlingMethodId = e.DefaultHandlingMethodId; dto.Active = e.Active; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertySequenceIdRemoved = e.IsPropertySequenceIdRemoved; dto.IsPropertyDefaultHandlingMethodIdRemoved = e.IsPropertyDefaultHandlingMethodIdRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; return(dto); }
public virtual void MergePatch(IMergePatchDamageType c) { IDamageTypeStateMergePatched e = Map(c); Apply(e); }