static public bool SaveChangeLog(ref DdChangeLogExt item)
 {
   DaChangeLog da = new DaChangeLog(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.Comments = item.Comments;
   da.FsaRevisionLogREF = item.FsaRevisionLogREF;
   da.FsaStaffREF = item.FsaStaffREF;
   da.Function = item.Function;
   da.MachineName = item.MachineName;
   da.Reference = item.Reference;
   da.TargetTableName = item.TargetTableName;
   da.TargetTableREF = item.TargetTableREF;
   da.TargetTableTimestamp = item.TargetTableTimestamp;
   da.UserDomainName = item.UserDomainName;
   da.UserName = item.UserName;
   bool ok = true;
   if (da._IsModified)
   {
     ok = da.Save();
     if (ok) item = new DdChangeLogExt(da.GetBuffer());
   }
   return ok;
 }
 static public void UpdateChangeLog(BindingSource binding, int parentREF)
 {
   DaChangeLog daChangeLog = new DaChangeLog(DataStore.DbConnection);
   BindingList<DdChangeLogExt> list = (BindingList<DdChangeLogExt>)binding.DataSource;
   try
   {
     using (TransactionScope scope = new TransactionScope())
     {
     foreach (DdChangeLogExt item in list)
     {// do deletes first
       bool existing = daChangeLog.GetById(item.Id);
       if (existing && item.DeleteFlag)
       {// delete here - avoid validation
         daChangeLog.DeleteById(item.Id);
       }
     }
     
     foreach (DdChangeLogExt item in list)
     {
       if (item.DeleteFlag) continue; // already done above
       //if (item.Id == string.Empty) continue; // already done above
       bool existing = daChangeLog.GetById(item.Id);
       if (!existing)
       {
         daChangeLog.Clear();
       }
       daChangeLog.Comments = item.Comments;
       daChangeLog.FsaRevisionLogREF = item.FsaRevisionLogREF;
       daChangeLog.FsaStaffREF = item.FsaStaffREF;
       daChangeLog.Function = item.Function;
       daChangeLog.MachineName = item.MachineName;
       daChangeLog.Reference = item.Reference;
       daChangeLog.TargetTableName = item.TargetTableName;
       daChangeLog.TargetTableREF = item.TargetTableREF;
       daChangeLog.TargetTableTimestamp = item.TargetTableTimestamp;
       daChangeLog.UserDomainName = item.UserDomainName;
       daChangeLog.UserName = item.UserName;
       if (!existing)
       {
         daChangeLog.Insert();
       }
       else
       {
         if (!daChangeLog._IsModified) continue;
         daChangeLog.Save();
       }
     }
       scope.Complete();
     }
     binding.DataSource = GetChangeLogList();
   }
   catch (AppEx)
   {
     throw;
   }
   catch (Exception exc)
   {
     throw new AppEx(exc, "Error updating ChangeLog");
   }
 }
 static public DdChangeLogExt GetChangeLogInfo(int ChangeLogREF)
 {
   DaChangeLog da = new DaChangeLog(DataStore.DbConnection);
   if (da.GetById(ChangeLogREF))
     return new DdChangeLogExt(da.GetBuffer());
   else
     return null;
 }