Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error during Cancel of newly added record
Message
From
03/11/2005 22:36:39
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01065305
Message ID:
01065322
Views:
19
Hi Kevin

Drew Speedie used to do this with us VMPers all the time. I can only remember one time where something came up as a result of someone not putting in the temporary changes correctly. I wish you similar success!

>Rick,
>
>>Im using version 1.4.2
>
>Looks like you found something...I was able to reproduce it and I have fixed the problem in mmBusinessForm and it will appear in the next update. Unfortunately, it affects three methods in mmBusinessForm. If you want to see it working in your form, you can TEMPORARILY add these overrides until the next release:
>
>
public override System.Data.DataRowView GetCurrentRow(System.Data.DataSet ds, string tableName)
>{
>	if (ds.Tables[tableName].Rows.Count != 0)
>	{
>		return (System.Data.DataRowView)this.BindingContext[ds, tableName].Current;
>	}
>	else
>	{
>		return null;
>	}
>}
>
>If your form uses DataTables, override this method:
>
>
public override void Cancel(mmBusinessObject bizObj, string tableName)
>{
>	if (bizObj != null)
>	{
>		// If an empty table was specified, use the default table
>		if (tableName == null || tableName == "")
>		{
>			tableName = bizObj.TableName;
>		}
>
>		// Call the PreCancel Hook and abort the cancel if
>		// it returns false
>		if (this.HookPreCancel(bizObj, tableName))
>		{
>			// Send a Cancel message to the business object
>			bizObj.Cancel(bizObj.GetCurrentDataSet(), tableName);
>
>			// Call the PostCancel hook
>			this.HookPostCancel(bizObj, tableName);
>
>			// If this is the form's primary business object,
>			// set focus to any specified FocusOnCancel control
>			if (bizObj == this.PrimaryBizObj)
>				this.SetFocus(this.FocusOnCancelControl);
>			// Set the current DataRow on the business object
>			DataRowView drv = this.GetCurrentRow(bizObj.GetCurrentDataSet(), tableName);
>			if (drv != null)
>			{
>				bizObj.DataRow = drv.Row;
>			}
>			else
>			{
>				bizObj.DataRow = null;
>			}
>		}
>	}
>}
>
>If your form uses DataViews, override this method:
>
>
public override void Cancel(OakLeaf.MM.Main.Business.mmBusinessObject bizObj, string tableName)
>{
>	// If an empty table was specified, use the default table
>	if (tableName == null || tableName == "")
>	{
>		tableName = bizObj.TableName;
>	}
>
>	// Call the PreCancel Hook and abort the cancel if
>	// it returns false
>	if (this.HookPreCancel(bizObj, tableName))
>	{
>		// Send a Cancel message to the business object
>		bizObj.Cancel(bizObj.GetCurrentDataSet(), tableName);
>
>		// Call the PostCancel hook
>		this.HookPostCancel(bizObj, tableName);
>
>		// If this is the form's primary business object,
>		// set focus to any specified FocusOnCancel control
>		if (bizObj == this.PrimaryBizObj)
>			this.SetFocus(this.FocusOnCancelControl);
>		// Set the current DataRow on the business object
>		DataRowView drv = this.GetCurrentRow(bizObj.GetCurrentDataSet(), tableName);
>		if (drv != null)
>		{
>			bizObj.DataRow = drv.Row;
>		}
>		else
>		{
>			bizObj.DataRow = null;
>		}	
>	}
>}
>
>This is the first time I have suggested this publicly (take note you lurkers), but it's perfectly acceptable to make this change to the Framework-level code, and recompile the project as described in the MM .NET Dev Guide. Then, when you receive the new version, you will get the same changes I've made here. Note that if you make these changes at the Framework level (in mmBusinessForm) then you must:
>
>1. Change all the code in GetCurrentRow(ds, tableName) as shown above
>
>2. Change the code at the bottom of the Cancel() methods to correspond to the code I have posted here.
>
>Regards,
Previous
Reply
Map
View

Click here to load this message in the networking platform