public AOneMonthValue CreateItem(TurnoverDbRow r) { AOneMonthValue t = this.itemCreator(); t.Add(r); return(t); } // CreateItem
public virtual void Add(TurnoverDbRow r) { r.WriteToLog(this.log); TurnoverTargetMetaData t = FindTarget(r); t.Add(r, 1, 3, 6, 12); if (OnNewDataAdded != null) { OnNewDataAdded(); } } // Add
} // Value public override void Add(TurnoverDbRow r) { if (r.MpTypeID == MpType.Ebay) { this.ebay += r.Turnover; } else if (r.MpTypeID == MpType.PayPal) { this.payPal += r.Turnover; } else { this.other += r.Turnover; } } // Add
} // Init protected override TurnoverTargetMetaData FindTarget(TurnoverDbRow r) { if (r.MpTypeID == MpType.Hmrc) { return(new TurnoverTargetMetaData(this.hmrc, () => new SimpleOneMonthValue())); } if (r.MpTypeID == MpType.Yodlee) { return(new TurnoverTargetMetaData(this.yodlee, () => new SimpleOneMonthValue())); } return((r.IsPaymentAccount && (r.MpTypeID != MpType.PayPal)) ? new TurnoverTargetMetaData(this.accounting, () => new SimpleOneMonthValue()) : new TurnoverTargetMetaData(this.online, () => new OnlineOneMonthValue())); } // FindTarget
} // IsValid public static void Add(this TurnoverTargetMetaData meta, TurnoverDbRow row, params int[] monthCountList) { if (!meta.IsValid()) { return; } foreach (int monthCount in monthCountList) { if (row.MonthCount > monthCount) { continue; } if (meta.Target.ContainsKey(monthCount)) { meta.Target[monthCount].Add(row); } else { meta.Target[monthCount] = meta.CreateItem(row); } } // for } // Add
protected abstract TurnoverTargetMetaData FindTarget(TurnoverDbRow r);
} // constructor public OnlineOneMonthValue(TurnoverDbRow row) : this() { Add(row); } // constructor