When certain fields are updated in one table, I want to automatically create a row in a related table if that row does not already exist. I am trying to do that from within the business object for the first table. Everything acts like it's working but the record does not get saved. I am using a HookPostSave override method.
I know when I add rows to a table using mmButtonNew, I have to set the table row to the newly added row by changing the binding context. This is not available from the business object, but I wonder if the problem is similar. I am having trouble figuring out how to fix this. Here's what I have so far. Thanks in advance for any help.
protected override void HookPostSave(DataTable dt)
{
base.HookPostSave(dt);
this.oLCCDate.GetLCCDateByPatientId(Entity.PatientId);
if (oLCCDate.DataSet.Tables[0].Rows.Count == 0)
{
oLCCDate.NewRow(oLCCDate.DefaultValues);
oLCCDate.Entity.PatientId = Entity.PatientId;
oLCCDate.Entity.BegDate = (DateTime)Entity.LCCBegin;
oLCCDate.Entity.EndDate = (DateTime)Entity.LCCEnd;
oLCCDate.Entity.EnterBy = mmAppBase.UserMgr.UserID;
oLCCDate.Entity.LCCMonths = 0;
oLCCDate.SaveRow();
}
}
Linda Harmes
HiBit Technologies, Inc.