/// <summary> /// Handle menu event /// </summary> public void HandleMenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; AlternativeItem altItem = new AlternativeItem(oSBOApplication, oSBOCompany); ChangeCompItem chgCompItem = new ChangeCompItem(oSBOApplication, oSBOCompany); UpdateBomVer updtBomVer = new UpdateBomVer(oSBOApplication, oSBOCompany); try { switch (pVal.MenuUID) { case "89111": altItem.MenuEvent_AltItem(ref pVal, out BubbleEvent); break; case "89222": chgCompItem.MenuEvent_ChangeCompItm(ref pVal, out BubbleEvent); break; case "89333": updtBomVer.MenuEvent_UpdateBomVer(ref pVal, out BubbleEvent); break; case "AltItemAdd": altItem.MenuEvent_AltItemAdd(ref pVal, ref BubbleEvent); break; case "AltItemDel": altItem.MenuEvent_AltItemDel(ref pVal, ref BubbleEvent); break; } } catch (Exception ex) { BubbleEvent = false; oSBOApplication.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }
public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; ContextMenu contextMenu = ContextMenu.GetObj; if (pVal.BeforeAction) { if (pVal.MenuUID == "3591") { contextMenu.Clear(); contextMenu.CreateMenu(string.Format("Учет запчастей/расходников и краски")); } if (pVal.MenuUID == "subMenu0") { // Заполнение формы, которая сейчас откроется string id = ((SAPbouiCOM.EditText)UIApp.Forms.ActiveForm.Items.Item("lab2").Specific).Value; initData = AdoNetQueries.GetEqCard(id); //contextMenu.Clear(); SAPbouiCOM.Framework.Application.SBO_Application.ActivateMenuItem("47620"); //var f = new Form1(a); //f.Show(); //var f = new UDOForm2(a.internalSN, a.custmrName, a.itemName); } } }
public void MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try{ //System.Windows.Forms.MessageBox.Show(pVal.MenuUID); foreach (Controller.FormMode fm in oController.getModeMonitors()) { try { Form oForm = (Form)oApp.Forms.GetForm(fm.formID, 0); if (oForm != null) { oController.setMode(fm.formID, Convert.ToInt32(oForm.Mode)); break; } } catch (Exception e) { SB1ControlException.SB1ControlException.Save(e); } } BubbleEvent = oController.EventReceiver("Menu", pVal.MenuUID, pVal.BeforeAction, null); }catch (Exception e) { BubbleEvent = false; SB1ControlException.SB1ControlException.Save(e); } }
public void OnMenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool Bubble) { Bubble = true; try { if (pVal.BeforeAction == true) { SAPbouiCOM.Form oForm = null; oForm = eCommon.SBO_Application.Forms.ActiveForm; String sXML = oForm.GetAsXML(); switch (pVal.MenuUID) { case "1293": break; case "1285": break; } } else { switch (pVal.MenuUID) { default: FormAttribute oAttrib = Forms[pVal.MenuUID] as FormAttribute; if (oAttrib != null) { try { //Execute the constructor System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); Type oType = asm.GetType(oAttrib.TypeName); System.Reflection.ConstructorInfo ctor = oType.GetConstructor(new Type[0]); if (ctor != null) { object oForm = ctor.Invoke(new Object[0]); } else { throw new Exception("No default constructor found for form type - " + oAttrib.FormType); } } catch (Exception Ex) { eCommon.SBO_Application.MessageBox(Ex.Message); } } break; } } } catch (Exception Ex) { eCommon.SBO_Application.StatusBar.SetText(Ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }
protected virtual void OnMenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.BeforeAction && _menuContextArgs != null) { _menuContextArgs.MenuID = pVal.MenuUID; OnContextMenuClick(this, ref _menuContextArgs); BubbleEvent = !_menuContextArgs.Cancel; } }
private void OApplication_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.BeforeAction) { oApplication.SetStatusBarMessage("Menu Item: " + pVal.MenuUID + "Before", SAPbouiCOM.BoMessageTime.bmt_Long, true); } else { oApplication.SetStatusBarMessage("Menu Item:" + pVal.MenuUID + ", Depois", SAPbouiCOM.BoMessageTime.bmt_Long, true); } }
/// <summary> /// Handle Menu Event /// </summary> public void HandleMenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; OneTimeDiscount oneTimeDisc = new OneTimeDiscount(oSBOApplication, oSBOCompany); PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); FixDiscount fixDisc = new FixDiscount(oSBOApplication, oSBOCompany); try { switch (pVal.MenuUID) { case "96969": oneTimeDisc.MenuEvent_CashDisc(ref pVal, out BubbleEvent); break; case "51115": prdDisc.MenuEvent_PrdDisc(ref pVal, out BubbleEvent); break; case "32323": fixDisc.MenuEvent_FixDisc(ref pVal, out BubbleEvent); break; // Add case "1282": MenuEventHandlerAdd(ref pVal, out BubbleEvent); break; // next record case "1288": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // previous record case "1289": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // first data record case "1290": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // last data record case "1291": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // Refresh //case "1304" case "PrdDiscAdd": prdDisc.MenuEvent_PrdDiscAdd(ref pVal, ref BubbleEvent); break; case "PrdDiscDel": prdDisc.MenuEvent_PrdDiscDel(ref pVal, ref BubbleEvent); break; case "FixDiscAdd": fixDisc.MenuEvent_FixDiscAdd(ref pVal, ref BubbleEvent); break; case "FixDiscDel": fixDisc.MenuEvent_FixDiscDel(ref pVal, ref BubbleEvent); break; } } catch (Exception ex) { BubbleEvent = false; oSBOApplication.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }
private void MenuEventHandlerNextPrev(ref SAPbouiCOM.MenuEvent pVal, out bool bubbleEvent) { bubbleEvent = true; if (pVal.BeforeAction == false) { Form oForm = oSBOApplication.Forms.ActiveForm; PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); switch (oForm.TypeEx) { case "PRDDISC": prdDisc.NextPrev_PrdDisc(ref oForm); break; } } }
/// <summary> /// Obtener la forma que se ejecuto. /// </summary> /// <param name="pVal">Propiedades de la forma</param> /// <param name="bubbleEvent">Evento</param> public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool bubbleEvent) { bubbleEvent = true;//Default Valué if (pVal.BeforeAction) { try { SBO_Application.Forms.Item(pVal.MenuUID); return; } catch { } Ejecutaclase(pVal.MenuUID); } }
public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { if (pVal.BeforeAction) { switch (pVal.MenuUID) { case "1282": //System SAP B1 Create Button Menu ClearMatrix(); break; } } } catch (Exception ex) { UIApplication.ShowMessageBox(ex.Message); } }
/// <summary> /// Event when click Add Menu (CTRL+A) /// </summary> private void MenuEventHandlerAdd(ref SAPbouiCOM.MenuEvent pVal, out bool bubbleEvent) { bubbleEvent = true; if (pVal.BeforeAction == false) { Form oForm = oSBOApplication.Forms.ActiveForm; PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); FixDiscount fixDisc = new FixDiscount(oSBOApplication, oSBOCompany); switch (oForm.TypeEx) { case "PRDDISC": prdDisc.Template_Add_PrdDisc(ref oForm); break; case "FIXDISC": fixDisc.Template_Add_FixDisc(ref oForm); break; } Utils.releaseObject(oForm); } }
private static void oApplication_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { // ******************************************************************************** // in order to activate your own forms instead of SAP Business One system forms // process the menu event by your self // change BubbleEvent to False so that SAP Business One won't process it // ******************************************************************************** BubbleEvent = true; if (pVal.BeforeAction == true) { //oApplication.SetStatusBarMessage("Menu item: " + pVal.MenuUID + " sent an event BEFORE SAP Business One processes it.", SAPbouiCOM.BoMessageTime.bmt_Long, true); // to stop SAP Business One from processing this event // unmark the following statement // BubbleEvent = False } else { //oApplication.SetStatusBarMessage("Menu item: " + pVal.MenuUID + " sent an event AFTER SAP Business One processes it.", SAPbouiCOM.BoMessageTime.bmt_Long, true); } }
public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { if (pVal.BeforeAction) { switch (pVal.MenuUID) { case "1282": btnAdd.Item.Enabled = true; txtCode.Value = String.Empty; txtItem.Value = String.Empty; break; } } } catch (Exception ex) { HandleException(ex, "SBO_Application_MenuEvent"); } }
public static void clsSalesOrder_MenuEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oForm, ref SAPbouiCOM.MenuEvent pVal, ref bool BubbleEvent) { try { oHDBDataSource = oForm.DataSources.DBDataSources.Item("ORDR"); oChildDataSource = oForm.DataSources.DBDataSources.Item("RDR1"); oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific; if (pVal.BeforeAction) { if (pVal.MenuUID == "1299") { } if (pVal.MenuUID == "DeleteRow" && oForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE) { } } } catch (Exception ex) { oApplication.MessageBox(ex.Message.ToString() + "/" + oCompany.GetLastErrorDescription().ToString(), 1, "OK", "", ""); } }
/// <summary> /// Event when click add menu (CTRL+A) /// </summary> private void MenuEventHandlerAdd(ref SAPbobsCOM.Company oSBOCompany, ref Application oSBOApplicaton , ref SAPbouiCOM.MenuEvent pVal, out bool bubbleEvent) { bubbleEvent = true; }
private void SBOApplication_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { SBOEventHandler oSBOEventHandler = new SBOEventHandler(oSBOApplication, oSBOCompany); oSBOEventHandler.HandleMenuEvent(ref pVal, out BubbleEvent); }
public void GetApplicationMenuEvent(ref SAPbouiCOM.MenuEvent pObjMenuEvent, out bool pObjBubbleEvent) { pObjBubbleEvent = true; try { if (pObjMenuEvent.BeforeAction) { //Get menu unique id //string lStrMenuUID = pObjMenuEvent.MenuUID; //If is a section //if(Menu.SelectMany(m=> m.Sections).Where(s=> s.UniqueID == lStrMenuUID).Count() > 0) //{ // //Get section // Section lObjSection = Menu.SelectMany(m=> m.Sections).FirstOrDefault(s=> s.UniqueID == lStrMenuUID); // //Is valid form // if(lObjSection.Form != null) // { // lObjSection.Form. // } //} switch (pObjMenuEvent.MenuUID) { case "TicketForm": TicketForm lObjTicketForm = new TicketForm(); lObjTicketForm.UIAPIRawForm.Left = GetLeftMargin(lObjTicketForm.UIAPIRawForm); lObjTicketForm.UIAPIRawForm.Top = GetTopMargin(lObjTicketForm.UIAPIRawForm); lObjTicketForm.Show(); break; case "TicketsListForm": TicketsListForm lObjTicketsListFrm = new TicketsListForm(); lObjTicketsListFrm.UIAPIRawForm.Left = GetLeftMargin(lObjTicketsListFrm.UIAPIRawForm); lObjTicketsListFrm.UIAPIRawForm.Top = GetTopMargin(lObjTicketsListFrm.UIAPIRawForm); lObjTicketsListFrm.Show(); break; case "ReceptionForm": ReceptionForm lObjReceptionFrm = new ReceptionForm(); lObjReceptionFrm.UIAPIRawForm.Left = GetLeftMargin(lObjReceptionFrm.UIAPIRawForm); lObjReceptionFrm.UIAPIRawForm.Top = GetTopMargin(lObjReceptionFrm.UIAPIRawForm); lObjReceptionFrm.Show(); //DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany()); //Application.SBO_Application.Company //ReceptionForm lObjReceptionFrm = new ReceptionForm(UI.UIApplication.Company); break; } } } catch (Exception ex) { LogService.WriteError(ex.Message); LogService.WriteError(ex); UIApplication.ShowError(string.Format("MenuException: {0}", ex.Message)); UIApplication.ShowMessageBox(ex.Message); } }
public void GetApplicationMenuEvent(ref SAPbouiCOM.MenuEvent pObjMenuEvent, out bool pObjBubbleEvent) { pObjBubbleEvent = true; try { if (pObjMenuEvent.BeforeAction) { //Get menu unique id //string lStrMenuUID = pObjMenuEvent.MenuUID; //If is a section //if(Menu.SelectMany(m=> m.Sections).Where(s=> s.UniqueID == lStrMenuUID).Count() > 0) //{ // //Get section // Section lObjSection = Menu.SelectMany(m=> m.Sections).FirstOrDefault(s=> s.UniqueID == lStrMenuUID); // //Is valid form // if(lObjSection.Form != null) // { // lObjSection.Form. // } //} switch (pObjMenuEvent.MenuUID) { case "TicketForm": bool lBolIsOpen = false; SAPbouiCOM.Forms lObjForms = UIApplication.GetApplication().Forms; foreach (Form lObjForm in lObjForms) { if (lObjForm.TypeEx == "UGRS.PlantaAlimentos.Forms.TicketForm" && lObjForm.Visible) { lBolIsOpen = true; } } if (!lBolIsOpen) { TicketForm lObjTicketForm = new TicketForm(); lObjTicketForm.UIAPIRawForm.Left = GetLeftMargin(lObjTicketForm.UIAPIRawForm); lObjTicketForm.UIAPIRawForm.Top = GetTopMargin(lObjTicketForm.UIAPIRawForm); lObjTicketForm.Show(); } else { UIApplication.ShowMessageBox("Ya se tiene abierta una ventana de tickets"); } break; case "TicketsListForm": TicketsListForm lObjTicketsListFrm = new TicketsListForm(); lObjTicketsListFrm.UIAPIRawForm.Left = GetLeftMargin(lObjTicketsListFrm.UIAPIRawForm); lObjTicketsListFrm.UIAPIRawForm.Top = GetTopMargin(lObjTicketsListFrm.UIAPIRawForm); lObjTicketsListFrm.Show(); break; //case "ReceptionForm": // ReceptionForm lObjReceptionFrm = new ReceptionForm(); // lObjReceptionFrm.UIAPIRawForm.Left = GetLeftMargin(lObjReceptionFrm.UIAPIRawForm); // lObjReceptionFrm.UIAPIRawForm.Top = GetTopMargin(lObjReceptionFrm.UIAPIRawForm); // lObjReceptionFrm.Show(); //DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany()); //Application.SBO_Application.Company //ReceptionForm lObjReceptionFrm = new ReceptionForm(UI.UIApplication.Company); break; } } } catch (Exception ex) { LogService.WriteError(ex.Message); LogService.WriteError(ex); UIApplication.ShowError(string.Format("MenuException: {0}", ex.Message)); UIApplication.ShowMessageBox(ex.Message); } }