public static ISuiRecord Create(SuiRecordOrigin origin, SuiRecordReference reference)
        {
            var recordType = origin.GetRecordType(reference);

            switch (recordType)
            {
            case SuiRecordType.Out:
                return(new SuiRecordOut(origin, reference, recordType));

            case SuiRecordType.In:
                return(new SuiRecordIn(origin, reference, recordType));

            case SuiRecordType.Transfer:
                return(new SuiRecordTransfer(origin, reference, recordType));

            case SuiRecordType.Loan:
                return(new SuiRecordLoan(origin, reference, recordType));

            // This branch should never be falled onto
            default:
                throw new ArgumentOutOfRangeException($"Cannot detect record type by category {origin.Category}, or account {origin.Account} & {origin.Account2}");
            }
        }
 public SuiRecordOut(SuiRecordOrigin recordModel, SuiRecordReference reference, SuiRecordType recordType) : this(recordModel.Date, recordModel.Category, recordModel.Account, recordModel.Price, recordModel.Store, recordModel.Memo, reference, recordType)
 {
 }
Beispiel #3
0
 public SuiRecordLoan(SuiRecordOrigin recordModel, SuiRecordReference reference, SuiRecordType recordType) : this(recordModel.Date, recordModel.Account, recordModel.Account2, recordModel.Price, recordModel.Memo, reference, recordType)
 {
 }