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; > } >}>
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; > } > } > } >}>
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; > } > } >}>