PC Review


Reply
Thread Tools Rate Thread

Data Class Design

 
 
Jeff Gaines
Guest
Posts: n/a
 
      9th May 2011

I have written an accounting program in C# which keeps tabs on the costs
of a small block of shared flats. The leases are all different in that
Flat x pays 12.5% of the shared electricity costs and 7.5% of the
gardening costs while Flat y pays 5% of the shared electricity costs and
12.5% of the gardening costs. As a consequence there appears to be
nothing on the market I can use. The complete matrix of costs has 17
categories of payment x 8 flats = 136 percentages.

What I do is when an invoice comes in it is entered on the ledger and
written to an Access table

If it is a split account the program calculates the payment for each flat
and writes it to a second Access table with each entry identified by the
FlatID.
It works well and allows me to keep leaseholders up to date with
expenditure and also allows me to ensure the bank statement agrees with
what the program thinks it should be.

The classes for both the whole invoice and the split amounts are identical
so I use one class called JAccountEntry. However, they have to be written
to 2 separate Access tables so I have ended up with 2 static updater
classes with identical functions, the only difference being the table
name. All the functions in the updater classes are static.

I could have just one updater and set the table name before I call it but
it's almost inevitable I will forget or get it wrong somewhere in the
program and that will really mess up the data.

I tried one main updater class with 2 minimal updaters based on that with
the intention of just having a different table name in each but you can't
inherit from static classes.

The objective is to call one updater in some situations and the other in
other situations and have it automatically set the correct table name and
then call the correct function in the base class e.g.

JSplitUpdater.UpdateRecord(accountEntry) sets the appropriate table name
and calls the base UpdateRecord function.

JInvoiceUpdater.UpdateRecord(accountEntry) sets the appropriate table name
and calls the base UpdateRecord function.

Any ideas on a way to deign this so that calling the correct updater sets
the table name then calls the correct function in the base class?

--
Jeff Gaines Wiltshire UK
Tell me what you need, and I'll tell you how to get along without it.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class within class, design stuff, need expert opinion Nick Valeontis Microsoft C# .NET 3 10th Dec 2006 11:41 PM
How to pass data from a class data member to that class' display method? sherifffruitfly Microsoft C# .NET 1 17th Oct 2006 01:08 AM
Loading & saving data from a class - design question Jeff Bunting Microsoft VB .NET 3 26th Mar 2004 09:53 PM
Loading & saving data from a class - design question Jeff Bunting Microsoft ADO .NET 0 22nd Mar 2004 05:46 PM
Data access class design question Wes Brown Microsoft ADO .NET 2 25th Feb 2004 07:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:17 AM.