Пример #1
0
 internal EditedValues(EditedValues cloneFrom = null)
 {
     if (cloneFrom == null)
     {
         return; //leave everyting to default
     }
     this.TransactionReason = cloneFrom.TransactionReason;
     this.TransactionDate   = cloneFrom.TransactionDate;
     this.Amount            = cloneFrom.Amount;
     this.EntityName        = cloneFrom.EntityName;
     this.IsFlagged         = cloneFrom.IsFlagged;
     this.Note         = cloneFrom.Note;
     this.CategoryPath = cloneFrom.CategoryPath;
 }
Пример #2
0
            internal void Merge(EditedValues other)
            {
                // There are 3 possibilities for user intent:
                // 1. Apply my new value to existing edit.
                // 2. Leave current edited value alone.
                // 3. Remove any existing edited value and restore to original.
                //
                // #1 is covered when EditValue is not null and IsVoided is false.
                // #2 is covered when EditValue object is null.
                // #3 is covered when EditValue is not null and IsVoided is true.

                if (other.TransactionReason != null)
                {
                    this.TransactionReason = other.TransactionReason.IsVoided ? null : other.TransactionReason;
                }

                if (other.TransactionDate != null)
                {
                    this.TransactionDate = other.TransactionDate.IsVoided ? null : other.TransactionDate;
                }

                if (other.Amount != null)
                {
                    this.Amount = other.Amount.IsVoided ? null : other.Amount;
                }

                if (other.EntityName != null)
                {
                    this.EntityName = other.EntityName.IsVoided ? null : other.EntityName;
                }

                if (other.IsFlagged != null)
                {
                    this.IsFlagged = other.IsFlagged.IsVoided ? null : other.IsFlagged;
                }

                if (other.Note != null)
                {
                    this.Note = other.Note.IsVoided ? null : other.Note;
                }

                if (other.CategoryPath != null)
                {
                    this.CategoryPath = other.CategoryPath.IsVoided ? null : other.CategoryPath;
                }
            }