Help with assembly refernces for hiding custom panel

The custom panel has a name of SupplierPriceList, but that’s not a base type in Epicor. I can see how that might be confusing in the Part form because types were created for all the panels and the names pretty much match. Take a look at the properties for the panel and copy/paste the type on the line where you’re declaring the sp_Panel variable in the HideSupplierPriceListPanel() method.

If it’s an EpiBasePanel like ours (likely), then your code will become:

Ice.Lib.Framework.EpiBasePanel sp_Panel = (Ice.Lib.Framework.EpiBasePanel)csm.GetNativeControlReference("f7952705-e201-472f-8da3-f33228bc6075");

As for the UserFileDataSet, it’s just a typo. It should be Ice instead of Erp.

Ice.BO.UserFileDataSet.UserFileDataTable userDataTable = adapterUserFile.UserFileData.UserFile;

Also, a quick note on adapters - you can wrap them in a using() statement to self-dispose the object instead of explicitly disposing later. If an error occurred in your current code between the BOConnect() and Dispose() methods, the adapter would be left in memory. Will it hurt anything if it’s not disposed? Probably not in this case, but it’s a good habit to get into so it doesn’t when you start dealing with larger data sets and/or calling adapters multiple times in an automated process.

private bool GetUserByID(string dcdUserID)
{
    bool isUserAccess = false;
    try
    {
        using (UserFileAdapter adapterUserFile = new UserFileAdapter(this.oTrans))
		{
			adapterUserFile.BOConnect();
			bool result = adapterUserFile.GetByID(dcdUserID);
			if (result)
			{
				Ice.BO.UserFileDataSet.UserFileDataTable userDataTable = adapterUserFile.UserFileData.UserFile;
				if (Convert.ToBoolean(userDataTable.Rows[0]["SecurityMgr"]) || Convert.ToString(userDataTable.Rows[0]["GroupList"]).Contains("_Purchasing"))//Replace your User Group Code here
					isUserAccess = true;
			}
        }
    }
    catch (System.Exception ex)
    {
        ExceptionBox.Show(ex);
    }
    return isUserAccess;
}