コード例 #1
0
        private void mtxRise_LinkPressedBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            if (pVal.ColUID == "ColRiseF")
            {
                string lStrRiseId = string.Empty;

                try
                {
                    this.UIAPIRawForm.Freeze(true);
                    //Application.SBO_Application.Forms.Item(this.UIAPIRawForm.UniqueID).Freeze(true);

                    lStrRiseId = dtRise.GetValue("DocNmRise", pVal.Row - 1).ToString();

                    if (string.IsNullOrEmpty(lStrRiseId))
                    {
                        return;
                    }

                    //UIApplication.GetApplication().OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_Order, "", lStrDocEntry);
                    MachineryForm lObjMachinery = new MachineryForm(int.Parse(lStrRiseId));
                    lObjMachinery.Show();
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("Failed to create form. Please check the form attributes"))
                    {
                        if (Application.SBO_Application.MessageBox("La pantalla de subidas ya se encuentra abierta, ¿desea cerrar la actual?", 1, "Aceptar", "Cancelar", "") == 1)
                        {
                            UIApplication.GetApplication().Forms.Item("frmRise").Close();

                            if (string.IsNullOrEmpty(lStrRiseId))
                            {
                                return;
                            }

                            MachineryForm lObjMachinery = new MachineryForm(int.Parse(lStrRiseId));
                            lObjMachinery.Show();
                        }
                    }
                    else
                    {
                        UIApplication.ShowMessageBox(string.Format("Error al abrir la pantalla de la subida: {0}", ex.Message));
                    }
                }
                finally
                {
                    this.UIAPIRawForm.Freeze(false);
                    //Application.SBO_Application.Forms.Item(this.UIAPIRawForm.UniqueID).Freeze(true);
                }
            }
        }
コード例 #2
0
ファイル: Menu.cs プロジェクト: radtek/UGRS_Full
        public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            try
            {
                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.MachineryForm")
                {
                    MachineryForm lObjMachineryForm = new MachineryForm();
                    lObjMachineryForm.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRiseSearch")
                {
                    frmRiseSearch lObjFrmRiseSearch = new frmRiseSearch();
                    lObjFrmRiseSearch.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRisesCommissions")
                {
                    frmRisesCommissions lObjfrmRisesCommissions = new frmRisesCommissions();
                    lObjfrmRisesCommissions.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmStockTransfer")
                {
                    frmStockTransfer lObjfrmStockTransfer = new frmStockTransfer();
                    lObjfrmStockTransfer.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmContracts")
                {
                    frmContracts lObjFrmContracts = new frmContracts();
                    lObjFrmContracts.Show();
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError(string.Format("[Menu - SBO_Application_MenuEvent: {0}]", ex.Message));

                if (ex.Message.Contains("Failed to create form. Please check the form attributes"))
                {
                    if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.MachineryForm")
                    {
                        UIApplication.GetApplication().Forms.Item("frmRise").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRiseSearch")
                    {
                        UIApplication.GetApplication().Forms.Item("frmRSch").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRisesCommissions")
                    {
                        UIApplication.GetApplication().Forms.Item("frmRCom").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmStockTransfer")
                    {
                        UIApplication.GetApplication().Forms.Item("frmStkTrn").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmContracts")
                    {
                        UIApplication.GetApplication().Forms.Item("frmCont").Close();
                    }
                }
                else
                {
                    Application.SBO_Application.MessageBox(ex.ToString(), 1, "Ok", "", "");
                }
            }
        }