Code to call validate method in AX from .net dataset in Enterprise portal X++
#region Employee
if (e.CurrentStepIndex == 2)//
{
try
{
if (AxGridViewNameName4.Rows.Count > 0 && AxGridViewNameName4.EditIndex != -1)
{
this.AxGridViewNameName4.UpdateRow(AxGridViewNameName4.EditIndex, true);
}
this.AxDataSource22.GetDataSourceView(this.AxGridViewNameName4.DataMember).DataSetView.AddNew();
this.AxDataSource22.GetDataSourceView(this.AxGridViewName4.DataMember).DataSetView.Delete();
if (AxGridViewName5.Rows.Count > 0 && AxGridViewName5.EditIndex != -1)
{
this.AxGridViewName5.UpdateRow(AxGridViewName5.EditIndex, true);
}
this.AxDataSource22.GetDataSourceView(this.AxGridViewName5.DataMember).DataSetView.AddNew();
this.AxDataSource22.GetDataSourceView(this.AxGridViewName5.DataMember).DataSetView.Delete();
}
catch (System.Exception ex)
{
AxExceptionCategory exceptionCategory;
if (!AxControlExceptionHandler.TryHandleException(this, ex, out exceptionCategory))
{
throw;
}
}
//if (e. == null) check employee
{
Boolean fetchEMP;
fetchEMP = (Boolean)this.AxDataSource22.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("validateEMP");
if (fetchEMP == false)
e.Cancel = true;
}
}
#endregion
#region Employee
if (e.CurrentStepIndex == 2)//
{
try
{
if (AxGridViewNameName4.Rows.Count > 0 && AxGridViewNameName4.EditIndex != -1)
{
this.AxGridViewNameName4.UpdateRow(AxGridViewNameName4.EditIndex, true);
}
this.AxDataSource22.GetDataSourceView(this.AxGridViewNameName4.DataMember).DataSetView.AddNew();
this.AxDataSource22.GetDataSourceView(this.AxGridViewName4.DataMember).DataSetView.Delete();
if (AxGridViewName5.Rows.Count > 0 && AxGridViewName5.EditIndex != -1)
{
this.AxGridViewName5.UpdateRow(AxGridViewName5.EditIndex, true);
}
this.AxDataSource22.GetDataSourceView(this.AxGridViewName5.DataMember).DataSetView.AddNew();
this.AxDataSource22.GetDataSourceView(this.AxGridViewName5.DataMember).DataSetView.Delete();
}
catch (System.Exception ex)
{
AxExceptionCategory exceptionCategory;
if (!AxControlExceptionHandler.TryHandleException(this, ex, out exceptionCategory))
{
throw;
}
}
//if (e. == null) check employee
{
Boolean fetchEMP;
fetchEMP = (Boolean)this.AxDataSource22.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("validateEMP");
if (fetchEMP == false)
e.Cancel = true;
}
}
#endregion
No comments:
Post a Comment