private static void DownloadCustomization(CommandLineParams o, Session epiSession) { EpiTransaction epiTransaction = new EpiTransaction(new ILauncher(epiSession)); Ice.UI.App.CustomizationMaintEntry.Transaction oTrans = new Ice.UI.App.CustomizationMaintEntry.Transaction(epiTransaction); Ice.UI.App.CustomizationMaintEntry.CustomizationMaintForm custData = new Ice.UI.App.CustomizationMaintEntry.CustomizationMaintForm(oTrans); oTrans = (Ice.UI.App.CustomizationMaintEntry.Transaction)custData.GetType().GetField("trans", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(custData); SearchOptions opts = new SearchOptions(SearchMode.ShowDialog) { DataSetMode = DataSetMode.RowsDataSet, SelectMode = SelectMode.SingleSelect, PreLoadSearchFilter = "TypeCode = 'Customization'" }; oTrans.InvokeSearch(opts); EpiDataView edvxxDef = (EpiDataView)oTrans.EpiDataViews["xxxDef"]; if (edvxxDef.Row >= 0) { GenXDataDataSet.XXXDefRow r = (GenXDataDataSet.XXXDefRow)edvxxDef.CurrentDataRow; o.Company = r.Company; o.CSGCode = r.CGCCode; o.Key1 = r.Key1; o.Key2 = r.Key2; o.Key3 = r.Key3; o.LayerType = r.TypeCode; o.ProductType = r.ProductID; } }
public void LaunchInEpicor(CommandLineParams o, Session epiSession, bool edit, bool modal = true) { epiSession["Customizing"] = edit; EpiTransaction epiTransaction = new EpiTransaction(new ILauncher(epiSession)); Ice.UI.App.CustomizationMaintEntry.Transaction oTrans = new Ice.UI.App.CustomizationMaintEntry.Transaction(epiTransaction); Ice.UI.App.CustomizationMaintEntry.CustomizationMaintForm custData = new Ice.UI.App.CustomizationMaintEntry.CustomizationMaintForm(oTrans); oTrans = (Ice.UI.App.CustomizationMaintEntry.Transaction)custData.GetType().GetField("trans", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(custData); SearchOptions opts = new SearchOptions(SearchMode.AutoSearch) { DataSetMode = DataSetMode.RowsDataSet, SelectMode = SelectMode.SingleSelect }; opts.NamedSearch.WhereClauses.Add("XXXDef", $"Key1='{o.Key1}' and Key2 ='{o.Key2}' and Key3='{o.Key3}' and TypeCode='{o.LayerType}' and ProductID='{o.ProductType}'"); oTrans.InvokeSearch(opts); MenuDataSet.MenuRow menuRow = (MenuDataSet.MenuRow)oTrans.GetType().GetMethod("getMenuRow", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(oTrans, new object[] { "Run" }); menuRow["Company"] = string.Empty; epiSession["AllowCustomizing"] = edit; if (edit) { epiSession["Customizing"] = epiSession.CanCustomize; } else { epiSession["Customizing"] = false; } if (edit) { #if EPICOR_10_2_300 oTrans.GetType().GetMethod("addFormnameToArguments", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(oTrans, new object[] { menuRow }); #endif } LaunchFormOptions lfo = new LaunchFormOptions(); lfo.IsModal = modal; lfo.Sender = oTrans; MenuDataSet mnuds = new MenuDataSet(); mnuds.Menu.Rows.Add(menuRow.ItemArray); lfo.MenuDataSet = mnuds; FormFunctions.Launch(oTrans.currentSession, menuRow, lfo); }