Bob in his book, as an example, implements the Payroll application. The architecture is built on transaction scripts — for every user action there is a transaction class that works with the database. But here's what I can not understand, for example, take a piece of the application, where for the employee "HorlyClassification" add "TimeCard".
public class HourlyClassification : PaymentClassification { private double hourlyRate; private Hashtable timeCards = new Hashtable(); public HourlyClassification(double rate) { this.hourlyRate = rate; } public double HourlyRate { get { return hourlyRate; } } public TimeCard GetTimeCard(DateTime date) { return timeCards[date] as TimeCard; } public void AddTimeCard(TimeCard card) { timeCards[card.Date] = card; } }
Here the AddTimeCard (Timecard) method is of interest, because it introduces the next card into the collection, which is stored in memory, and not in the database. A transaction promising to add a TimeCard to the database looks like this:
public override void Execute() { Employee e = database.GetEmployee(empId); if (e != null) { HourlyClassification hc = e.Classification as HourlyClassification; if (hc != null) hc.AddTimeCard(new TimeCard(date, hours)); } }
Question: When is the information on the TimeCard card entered into the database and how?