I am trying to add multiple columns to gridview of Method Tracker.
In doing so, I tried following this topic :
My purpose is to add some attributes from Part Table that do not exist in the Collection list.
Here is the code that I wrote and runs with no problem while loading the data but clearly I am doing something wrong:
// **************************************************
// Custom code for BOMTrackerForm
// Created: 2021-11-17 1:12:58 PM
// **************************************************
extern alias Erp_Contracts_BO_EngWorkBench;
extern alias Erp_Contracts_BO_ECORevSearch;
extern alias Erp_Contracts_BO_BomSearch;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_PartRevSearch;
extern alias Erp_Contracts_BO_Customer;
extern alias Ice_Contracts_Lib_BOReader;
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Ice.Proxy.Lib;
using Ice.Core;
using Erp.BO;
using Ice.BO;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
EpiUltraGrid myGrid;
BOReaderImpl _boReader;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
myGrid = (EpiUltraGrid)csm.GetNativeControlReference("74efd6bb-a282-4bc2-bcd4-135633814caa");
//myGrid.DisplayLayout.Bands[0].Columns.Add("PartType","Job Released");
myGrid.DisplayLayout.Bands[0].Columns.Add("Part Type","Company222");
myGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
_boReader = WCFServiceSupport.CreateImpl<BOReaderImpl>((Ice.Core.Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.BOReaderSvcContract>.UriPath);
}
private void grdMatLst_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if(!String.IsNullOrEmpty(e.Row.Cells["PartNum"].Value.ToString()))
{
//DataSet ds = _boReader.GetRows("Erp:BO:PartEntry","PartNum = '" + e.Row.Cells["PartNum"].Value.ToString() + "'","JobReleased");
DataSet ds = _boReader.GetRows("Erp:BO:PartEntry","PartNum = '" + e.Row.Cells["PartNum"].Value.ToString() + "'","RevisionNum");
if(ds.Tables[0].Rows.Count > 0 )
{
//e.Row.Cells["JobReleased"].Value = ds.Tables[0].Rows[0]["JobReleased"].ToString();
e.Row.Cells["TypeCode"].Value = ds.Tables[0].Rows[0]["TypeCode"].ToString();
}
}
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
}
Could you kindly guide me?
I see two problems:
1- As you can see in the code, the Company2222 is added to the columns which I used for my reference, however Part Type did not get added.