I have added a field to an EpiDataView on the QuoteQty Worksheet tab of Quote Entry and I am using EpiViewNotification with Initialize to set default values. Everything works as expected and I can see the default value but after testing the functionality of the entire form I am getting strange behavior on the Materials sheet.
When I go to Line > Manufacturing > Details > Materials and select a material from the tree the form does not update. It stays on material 10 no matter which material I select. This only happens when the customization is in place and i cannot understand why.
public void InitializeCustomCode () {
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
((EpiDataView) oTrans.EpiDataViews["QuoteQty"]).dataView.Table.Columns.Add ("TotalCost_NSI", typeof (decimal));
this.edvQuoteQty = ((EpiDataView) (this.oTrans.EpiDataViews["QuoteQty"]));
this.edvQuoteQty.EpiViewNotification += new EpiViewNotification (this.edvQuoteQty_EpiViewNotification);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
SetExtendedProperties ();
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode () {
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.edvQuoteQty = null;
this.edvQuoteQty.EpiViewNotification -= new EpiViewNotification (this.edvQuoteQty_EpiViewNotification);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void edvQuoteQty_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
view.dataView[view.Row]["TotalCost_NSI"] =
Convert.ToDecimal (view.dataView[view.Row]["TotalBurCost"]) +
Convert.ToDecimal (view.dataView[view.Row]["TotalLbrCost"]) +
Convert.ToDecimal (view.dataView[view.Row]["TotalMtlCost"]) +
Convert.ToDecimal (view.dataView[view.Row]["TotalSubCost"]) +
Convert.ToDecimal (view.dataView[view.Row]["TotalMtlBurCost"]) +
Convert.ToDecimal (view.dataView[view.Row]["MiscCost"]);
}
}
}