Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IsChanged() and multiple tables
Message
 
À
06/09/2007 13:03:20
Jeff Corder
Ambit Technologies, LLC
Missouri, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01252820
Message ID:
01252916
Vues:
21
Jeff,

>I then tried
> Employee.IsChanged(Employee.DataSet.Tables[0])
>and it returned true. It seems that the IsChanged() is pointing at the wrong table.
>
>I then realized that the CurrentTableName had probably changed (it had) so I set it back to 'Employees'. Employees.IsChanged() still returned false;
>
>However, if I tried
> Employee.IsChanged(Employee.DataSet.Tables[Employee.CurrentTableName])
>it returns true.

Override the IsChanged() method in ABusinessObject and add this code--let me know if this addresses the problem:
public override bool IsChanged()
{
	bool HasChanges = false;

	DataSet ds = this.GetCurrentDataSet();

	if (ds != null)
	{
		foreach (DataTable dt in ds.Tables)
		{
			HasChanges = this.IsChanged(dt);
			if (HasChanges)
			{
				break;
			}
		}
	}

	// Check if any child business objects have changes
	if (!HasChanges)
	{
		foreach (mmBusinessObject BizObj in this.RefBizObj)
		{
			HasChanges = BizObj.IsChanged();
			if (HasChanges)
			{
				break;
			}
		}
	}

	return HasChanges;
}
Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform