Replacing Ultragrid, C code not compiling

Hi - New to Epicor and am learning as I go. I followed the instructions from josecgomez on how to replace a grid with a baq custom grid. I’m getting the following compile error and am not sure what to do:

 *Error: CS1061 - line 78 (2829) - 'Ice.Lib.Framework.BAQDataView' does not contain a definition for 'SuscribeToPublisher' and no extension method 'SuscribeToPublisher' accepting a first argument of type 'Ice.Lib.Framework.BAQDataView' could be found (are you missing a using directive or an assembly reference?)*

The original post is here: https://www.epiusers.help/t/efficiently-adding-column-to-datagrid/36283/25

Here’s my code, looks like I’m added to an already customized grid by the way:

// **************************************************
// Custom code for ProjectEntryForm
// Created: 7/29/2021 4:45:45 PM
// **************************************************

extern alias Erp_Contracts_BO_Project;
extern alias Erp_Contracts_BO_ProjPhaseSearch;
extern alias Erp_Contracts_BO_Company;
extern alias Erp_Contracts_BO_Warehse;
extern alias Erp_Contracts_BO_JobEntry;
extern alias Erp_Contracts_BO_JobAsmSearch;
extern alias Erp_Contracts_BO_JobMtlSearch;

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 System.Reflection;
using Ice.Lib.Broadcast;

public class Script
{
// ** Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **

private EpiDataView edvProject;
// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tools;
private Infragistics.Win.UltraWinToolbars.ButtonTool custButton;
BAQDataView baqviewpo;  //addded 3/22


public void InitializeCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
	// Begin Wizard Added Variable Initialization

	this.edvProject = ((EpiDataView)(this.oTrans.EpiDataViews["Project"]));
	this.edvProject.EpiViewNotification += new EpiViewNotification(this.edvProject_EpiViewNotification);
	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	// End Wizard Added Custom Method Calls
	
	object obj = typeof(Erp.UI.App.ProjectEntry.ProjectEntryForm).InvokeMember("baseToolbarsManager", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, ProjectEntryForm, null);	
	tools = (Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)obj;
	custButton = addImportButton();
	custButton.ToolClick += importClick;

	
}
public void CreateviewpoBAQView()  //added 3/22
{
	baqviewpo = new BAQDataView("ProjectPoCustom");
	oTrans.Add ("ProjectPOBAQ", baqviewpo);

	string pubBinding = "Project.ProjectID";
	IPublisher pub = oTrans.GetPublisher(pubBinding);
	if(pub==null)
	{
		oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
		pub = oTrans.GetPublisher(pubBinding);
	}
	if(pub!=null)
		baqviewpo.SuscribeToPublisher(pub.PublishName, "PORel.ProjectId");
}


public void DestroyCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
	// Begin Wizard Added Object Disposal

	this.edvProject.EpiViewNotification -= new EpiViewNotification(this.edvProject_EpiViewNotification);
	this.edvProject = null;
	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

public Infragistics.Win.UltraWinToolbars.ButtonTool addImportButton()
{
	Infragistics.Win.UltraWinToolbars.ButtonTool custButton = new Infragistics.Win.UltraWinToolbars.ButtonTool("MassAddPOtoProject");
	Infragistics.Win.UltraWinToolbars.PopupMenuTool pop = default(Infragistics.Win.UltraWinToolbars.PopupMenuTool);
	custButton.SharedProps.Caption = "Mass Add PO To Project";

          

                          if (tools.Tools.Exists("MassAddPOtoProject") == false) {

                                         tools.Tools.Add(custButton);

          

                                         pop = (Infragistics.Win.UltraWinToolbars.PopupMenuTool)tools.Tools["ActionsMenu"];

                                         pop.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { custButton });

          

                                         System.Drawing.Image intFuncImage = EpiUIImages.GetImage("InternalFunction");

                                         Infragistics.Win.Appearance app = new Infragistics.Win.Appearance();

                                         app.Image = intFuncImage;

          

                                         tools.Tools["MassAddPOtoProject"].SharedProps.AppearancesLarge.Appearance = app;

                                         tools.Tools["MassAddPOtoProject"].SharedProps.AppearancesSmall.Appearance = app;

                          }

          

                          return custButton;

           }

private void importClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
	try
	{
		if(edvProject.Row > -1)
		{
			LaunchFormOptions opts = new LaunchFormOptions();
			opts.IsModal = true;
			opts.ValueIn = edvProject.dataView[edvProject.Row]["ProjectID"].ToString() + "|" + edvProject.dataView[edvProject.Row]["Description"].ToString();
			ProcessCaller.LaunchForm(oTrans, "UD40", opts);

			oTrans.Refresh();
		}
		else
		{
			Exception ex = new Exception("Project is mandatory.");
			ExceptionBox.Show(ex);
		}
	}
	catch(Exception ex)
	{
		ExceptionBox.Show(ex);
	}
	
}

private void edvProject_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.AddRow))
	{
		if ((args.Row > -1))
		{
		}
	}
}

}

Looks like a spelling error on Suscribe

Insert this just before your InitializeCustomCode()

You may also need these using statements at the beginning. I can never tell which one I actually need to use.

using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;

I hope this helps!

Bah!! Nice catch I missed that!

Well, it sure was. The smallest things will do it sometimes. Epicor is so much more “involved” than the previous ERP I worked in, I feel like my brain is ready to explode some days. Thanks!

1 Like