コード例 #1
0
        static void myApplication_OnStartCreateMenu(object sender, ApplicationEventArgs e)
        {
            var myMenuModulo = Nampula.UI.Application.GetInstance().GetMenu(MenuID.cBoUIModulesMenu);

            var menu = new Nampula.UI.MenuItem("Lista de Empresas");

            var mnuTeste =
                new Nampula.UI.MenuItem(myMenuModulo, BoMenuType.mt_POPUP, "Nampula Teste");

            var mnuFormBind = new Nampula.UI.MenuItem(mnuTeste, BoMenuType.mt_STRING, "Form Binding");

            mnuFormBind.OnAfterClick += mnuFormBind_OnAfterClick;
            var mnuTesteForm =
                new Nampula.UI.MenuItem(mnuTeste, BoMenuType.mt_STRING, "Teste");

            mnuTesteForm.OnBeforeClick += mnuTesteForm_OnBeforeClick;

            var gridViewEditMenu = new Nampula.UI.MenuItem(mnuTeste, BoMenuType.mt_STRING, "GridView Editable Sample");

            gridViewEditMenu.OnBeforeClick += gridViewEditMenu_OnBeforeClick;

            var menuPayment = new Nampula.UI.MenuItem(mnuTeste, BoMenuType.mt_STRING, "Incoming Payment");

            new MenuItem(mnuTeste, BoMenuType.mt_STRING, "Grid Demo")
            .OnAfterClick += Program_OnAfterClick;

            menuPayment.OnBeforeClick += menuPayment_OnBeforeClick;

            FormSystemManager.Instance().AddFormWath(new BusinessPartnerForm());

            ApplicationSAP.GetInstance().CreateLogginMenu(mnuTeste);
        }
コード例 #2
0
        private static void UpdateName(UserAutorizationTree autorizarion)
        {
            if (Application.GetInstance().AppType != eAppType.SAPForms)
            {
                throw new Exception("Aplicação não da suporte a atualização de autorizações!");
            }

            if (SboCompany == null)
            {
                SboCompany = ApplicationSAP.GetInstance().SAPApp.Company.GetDICompany() as SAPbobsCOM.Company;
            }

            var userTree = SboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserPermissionTree) as SAPbobsCOM.UserPermissionTree;

            if (!userTree.GetByKey(autorizarion.AbsID))
            {
                return;
            }

            userTree.Name = autorizarion.Name;

            if (userTree.Update() != 0)
            {
                throw new Exception(
                          "Erro ao tentar atualizar a autorização :\n{0} - {1}".Fmt(
                              SboCompany.GetLastErrorCode(),
                              SboCompany.GetLastErrorDescription()));
            }
        }
コード例 #3
0
 /// <summary>
 /// Construtor padrão
 /// </summary>
 private FormSystemManager()
 {
     AppSAP                = ApplicationSAP.GetInstance().SAPApp;
     Forms                 = new List <FormSystem>();
     FormOpens             = new List <FormSystem>();
     AppSAP.ItemEvent     += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SAPApp_ItemEvent);
     AppSAP.MenuEvent     += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(AppSAP_MenuEvent);
     AppSAP.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(AppSAP_FormDataEvent);
 }
コード例 #4
0
        public bool StartApplication(string pNameSpace, eAppType pAppType)
        {
            NameSpace = pNameSpace;
            AppType   = pAppType;

            System.Threading.Thread.CurrentThread.CurrentCulture =
                new System.Globalization.CultureInfo("pt-BR");

            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.Skins.SkinManager.EnableMdiFormSkins();

            ExtractLocation();

            switch (AppType)
            {
            case eAppType.WinForms:
                m_Concrete = ApplicationWinForm.GetInstance();
                break;

            case eAppType.SAPForms:
                m_Concrete = ApplicationSAP.GetInstance();
                break;

            default:
                throw new NotSupportedException(AppType.ToString());
            }

            m_Concrete.CheckHostedEnvironment = CheckHostedEnvironment;
            m_Concrete.AppEvent          += ConcreteAppEvent;
            m_Concrete.MenuEvent         += ConcreteMenuEvent;
            m_Concrete.OnStartConnection += m_Concrete_OnStartConnection;
            m_Concrete.OnStartCreateMenu += m_Concrete_OnStartCreateMenu;
            m_Concrete.OnShutDown        += m_Concrete_OnShutDown;
            m_Concrete.OnChangeCompany   += m_Concrete_OnChangeCompany;
            m_Concrete.AddonIdentifiers   = AddonIdentiers;

            return(m_Concrete.StartApplication(NameSpace));
        }
コード例 #5
0
        private static void Add(UserAutorizationTree pAutorization)
        {
            if (Application.GetInstance().AppType != eAppType.SAPForms)
            {
                throw new Exception("Aplicação não da suporte a adição de autorizações!");
            }

            if (pAutorization.Name.Length > 64)
            {
                var message = string.Format("A   autorização [{0}-{1}] tem mais que 64 caracteres.",
                                            pAutorization.AbsID, pAutorization.Name);
                throw new Exception(message);
            }

            if (SboCompany == null)
            {
                SboCompany = ApplicationSAP.GetInstance().SAPApp.Company.GetDICompany() as SAPbobsCOM.Company;
            }

            var userTree = SboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserPermissionTree) as SAPbobsCOM.UserPermissionTree;


            userTree.PermissionID = pAutorization.AbsID;
            userTree.ParentID     = pAutorization.FathID;
            userTree.Name         = pAutorization.Name;
            userTree.IsItem       = pAutorization.IsItem == eYesNo.Yes ? SAPbobsCOM.BoYesNoEnum.tYES : SAPbobsCOM.BoYesNoEnum.tNO;
            userTree.Options      = (SAPbobsCOM.BoUPTOptions)pAutorization.Options.To <Int32>();

            if (userTree.Add() != 0)
            {
                throw new Exception(
                          "Erro ao tentar adicionar a autorização :\n{0} - {1}".Fmt(
                              SboCompany.GetLastErrorCode(),
                              SboCompany.GetLastErrorDescription()));
            }
        }
コード例 #6
0
 /// <summary>
 /// Construtor padrão
 /// </summary>
 private FormSystem()
 {
     MethodEvents = new List <MethodInfoEvent>();
     Assemlbly    = Assembly.GetAssembly(this.GetType());
     SboApp       = ApplicationSAP.GetInstance().SAPApp;
 }
コード例 #7
0
 /// <summary>
 /// Realiva um clique no item do menu
 /// </summary>
 public void Activate( )
 {
     ApplicationSAP.GetInstance( ).SAPApp.ActivateMenuItem(this.UID);
 }
コード例 #8
0
        /// <summary>
        /// Método que é excutado quando evento do SAP é disparado
        /// </summary>
        /// <param name="FormUID">ID do Formuário</param>
        /// <param name="pVal">Argumentos do Evento</param>
        /// <param name="BubbleEvent">Propagar a continuação desse evento</param>
        void SAPApp_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                var formType      = pVal.FormType;
                var formTypeEx    = pVal.FormTypeEx;
                var formTypeCount = pVal.FormTypeCount;

                if (FormSystemModal != null)
                {
                    if ((pVal.FormType != FormSystemModal.Type ||
                         pVal.FormTypeEx != FormSystemModal.TypeEx))
                    {
                        FormSystemModal.Select();
                        BubbleEvent = false;
                        return;
                    }
                }

                if (formType != 0 && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD && pVal.Before_Action)
                {
                    var form = Forms.FirstOrDefault(f => (f.Type == formType));
                    if (form != null)
                    {
                        var newForm = form.Assemlbly.CreateInstance(form.ToString()) as FormSystem;
                        newForm.SetFormBind(ApplicationSAP.GetInstance().SAPApp.Forms.GetFormByTypeAndCount(formType, formTypeCount) as SAPbouiCOM.Form);
                        newForm.GetEvents();
                        FormOpens.Add(newForm);
                    }
                }

                var formOpen = FormOpens.FirstOrDefault(
                    f => ((f.Type == formType || f.TypeEx == formTypeEx) && f.TypeCount == formTypeCount));

                if (formOpen == null)
                {
                    formOpen = FormOpens.FirstOrDefault(f => (f.Type == formType && f.NeverRemove));
                }

                if (formOpen != null)
                {
                    try
                    {
                        formOpen.DoEvent(ref pVal, out BubbleEvent);
                    }
                    catch (Exception ex)
                    {
                        BubbleEvent = false;
                        Application.GetInstance().SetTextOnStatusBar(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    }

                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD && !formOpen.NeverRemove)
                    {
                        FormOpens.Remove(formOpen);
                        FormSystemModal = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Application.GetInstance().SetTextOnStatusBar(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
        }