Esempio n. 1
1
 public EventDispatcher(SAPbouiCOM.Application sapApp, MenuEventHandler menuHandler,
     AddinAppEventHandler addinAppEventHandler)
 {
     this.sapApp = sapApp;
     this.menuHandler = menuHandler;
     this.addinAppEventHandler = addinAppEventHandler;
 }
Esempio n. 2
0
 public FormEventHandler(SAPbouiCOM.Application sapApp, PermissionManager permissionManager,
                         B1SResourceManager resourceManager)
 {
     this.sapApp            = sapApp;
     this.permissionManager = permissionManager;
     this.resourceManager   = resourceManager;
 }
Esempio n. 3
0
        public override void CreateForm(SAPbouiCOM.Application SboApp, string strXml, SAPbobsCOM.Company cmp, string frmId)
        {
            base.CreateForm(SboApp, strXml, cmp, frmId);

            oForm.EnableMenu("1282", false);  // Add New Record
            oForm.EnableMenu("1288", false);  // Next Record
            oForm.EnableMenu("1289", false);  // Pevious Record
            oForm.EnableMenu("1290", false);  // First Record
            oForm.EnableMenu("1291", false);  // Last record
            oForm.EnableMenu("1281", false);  // Find record

            InitiallizeForm();

            SAPbouiCOM.Menus mnus = oApplication.Menus.Item("43557").SubMenus;
            foreach (SAPbouiCOM.MenuItem mnu in mnus)
            {
                string menuTitel = mnu.String;
                if (menuTitel == "Inspection Report")
                {
                    printMenuId = mnu.UID.ToString();
                }
            }

            // oForm.Items.Item("btUpd").Visible = false;
        }
        private void SetApplication()
        {
            SAPbouiCOM.SboGuiApi oSboGuiApi = null;
            string sConnectionString        = null;

            oSboGuiApi = new SAPbouiCOM.SboGuiApi();

            sConnectionString = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));

            try
            {
                oSboGuiApi.Connect(sConnectionString);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                System.Environment.Exit(0);
            }
            oApplication = oSboGuiApi.GetApplication(-1);

            oApplication.SetStatusBarMessage(string.Format("Addon {0} Conectado com sucesso!!!);",
                                                           System.Windows.Forms.Application.ProductName),
                                             BoMessageTime.bmt_Medium
                                             , false);;
        }
Esempio n. 5
0
 public EventDispatcher(SAPbouiCOM.Application sapApp, MenuEventHandler menuHandler,
                        AddinAppEventHandler addinAppEventHandler)
 {
     this.sapApp               = sapApp;
     this.menuHandler          = menuHandler;
     this.addinAppEventHandler = addinAppEventHandler;
 }
Esempio n. 6
0
        private static void SetApplication()
        {
            SboGuiApi sboGuiApi = (SboGuiApi) new SboGuiApiClass();

            sboGuiApi.Connect(GetConnectionString());
            application = sboGuiApi.GetApplication(-1);
        }
Esempio n. 7
0
        private static void B1Connect(String version)
        {
            company     = (SAPbobsCOM.Company)AppDomain.CurrentDomain.GetData("SAPCompany");
            application = (SAPbouiCOM.Application)AppDomain.CurrentDomain.GetData("SAPApplication");

            try
            {
                // inception!
                if (application != null && company != null)
                {
                    applicationSponsor = new Sponsor <SAPbouiCOM.Application>(application);
                    companySponsor     = new Sponsor <SAPbobsCOM.Company>(company);
                    return;
                }
                SetApplication();
                company = (SAPbobsCOM.Company)application.Company.GetDICompany();
            }
            catch (Exception er)
            {
                Logger.Fatal(String.Format(Messages.ConnectionError, er.Message), er);
            }
            finally
            {
                if (company != null)
                {
                    b1Connected = company.Connected;
                }
            }
        }
Esempio n. 8
0
 public FormEventHandler(SAPbouiCOM.Application sapApp, PermissionManager permissionManager,
     B1SResourceManager resourceManager)
 {
     this.sapApp = sapApp;
     this.permissionManager = permissionManager;
     this.resourceManager = resourceManager;
 }
Esempio n. 9
0
 public override void CreateForm(SAPbouiCOM.Application SboApp, string strXml, SAPbobsCOM.Company cmp, string frmId)
 {
     try
     {
         base.CreateForm(SboApp, strXml, cmp, frmId);
         InitiallizeForm();
     }
     catch { }
 }
        private void SetApplication()
        {
            SAPbouiCOM.SboGuiApi oSboGuiApi = null;
            string sConnectionString        = null;

            oSboGuiApi        = new SAPbouiCOM.SboGuiApi();
            sConnectionString = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));
            oSboGuiApi.Connect(sConnectionString);
            oApplication = oSboGuiApi.GetApplication(-1);
        }
Esempio n. 11
0
 /// <summary>
 /// Constructor de datos maestros empleado
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsDatosMaestrosEmpleado(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     if (_oDatosMestrosEmpleado == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oDatosMestrosEmpleado = true;
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Constructor de la transferencia de stock
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsTransferenciaDeStock(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     if (_oTransferenciaDeStock == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oTransferenciaDeStock = true;
     }
 }
Esempio n. 13
0
        private void removeUDOs(string[] udos)
        {
            SAPbouiCOM.Application b1App         = app.Resolve <SAPbouiCOM.Application>();
            UserObjectsMD          userObjectsMD = (UserObjectsMD)b1Company.GetBusinessObject(BoObjectTypes.oUserObjectsMD);

            foreach (var udo in udos)
            {
                DoverSetup.removeUDO(userObjectsMD, udo, b1App, b1Company);
            }
            System.Runtime.InteropServices.Marshal.ReleaseComObject(userObjectsMD);
        }
Esempio n. 14
0
        private void removeFields(dynamic[] userFields)
        {
            SAPbouiCOM.Application b1App       = app.Resolve <SAPbouiCOM.Application>();
            UserFieldsMD           userFieldMD = (UserFieldsMD)b1Company.GetBusinessObject(BoObjectTypes.oUserFields);

            foreach (var field in userFields)
            {
                DoverSetup.removeField(userFieldMD, field.Tablename, field.Field, b1App, b1Company);
            }
            System.Runtime.InteropServices.Marshal.ReleaseComObject(userFieldMD);
        }
Esempio n. 15
0
        private void removeTables(string[] tables)
        {
            SAPbouiCOM.Application b1App       = app.Resolve <SAPbouiCOM.Application>();
            UserTablesMD           userTableMD = (UserTablesMD)b1Company.GetBusinessObject(BoObjectTypes.oUserTables);

            foreach (var table in tables)
            {
                DoverSetup.removeTable(userTableMD, table, b1App, b1Company);
            }
            System.Runtime.InteropServices.Marshal.ReleaseComObject(userTableMD);
        }
Esempio n. 16
0
 /// <summary>
 /// Constructor de la orden de compra
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsOrdenDeCompra(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     if (_oOrdenDeCompra == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oOrdenDeCompra = true;
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Constructor de la entrada de mercancía
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsEntradaDeMercancia(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     if (_oEntradaDeMercancia == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oEntradaDeMercancia = true;
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Constructor de la factura de proveedor
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsFacturaDeProveedores(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     if (_oFacturaProveedores == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oFacturaProveedores = true;
     }
 }
Esempio n. 19
0
 /// <summary>
 /// Constructor de numero de serie definir
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsNumerosDeSerieDefinir(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     lDatosEntradaMercancia = new List <Datos>(lDatos);
     if (_oNumerosDeSerie == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oNumerosDeSerie = true;
     }
 }
Esempio n. 20
0
 /// <summary>
 /// Constructor de seleccionar números de serie
 /// </summary>
 /// <param name="_Application">Objeto de la conexión de SAP</param>
 /// <param name="_Company">Objeto de la empresa</param>
 /// <param name="form">Nombre de la forma</param>
 public clsSeleccionarNumerosDeSerie(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     lDatosTransferenciaStock = new List <Datos>(lDatos);
     lDatos.Clear();
     if (_oSeleccionarNumerosDeSerie == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         setEventos();
         _oSeleccionarNumerosDeSerie = true;
     }
 }
        //private SAPbouiCOM.EditText _oTxtUsuario = null;

        #endregion

        #region CONSTRUCTOR

        /// <summary>
        /// Constructor de autorización de ofertas de compra
        /// </summary>
        /// <param name="_Application">Este es el objeto raíz de la API de interfaz de usuario
        ///                             lo que refleja la cual aplicación SAP Business One en el que se realiza
        ///                             la conexión</param>
        /// <param name="_Company">Company es el objeto de la API DI principal que representa
        ///                         una única base de datos de SAP Business One empresa
        ///                         Este objeto le permite conectarse a la base de datos de la empresa y
        ///                         crear objetos de negocio para su uso con la base de datos de la empresa</param>
        public frmReporteOficinasContratos(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
        {
            if (_oRptCorteSolicitudes == false)
            {
                company     = _Company;
                application = _Application;
                formID      = form;
                showForm(formID);
                inicializarComponentes();
                setEventos();
                _oRptCorteSolicitudes = true;
            }
        }
Esempio n. 22
0
 private Addon()
 {
     conectarAddon();
     SBO_Application = ConexionAddon.ConexionAddon.SBO_Application;
     oCompany        = ConexionAddon.ConexionAddon._oCompany;
     SetFilters();
     SetEvents();
     AddMenus();
     AgregaClase();
     ObtenerConfiguracionInicial();
     Extensor.CargarConfiguraciones();
     ObtenerCuentasSAP();
 }
Esempio n. 23
0
        public override void CreateForm(SAPbouiCOM.Application SboApp, string strXml, SAPbobsCOM.Company cmp, string frmId)
        {
            base.CreateForm(SboApp, strXml, cmp, frmId);

            oForm.EnableMenu("1282", false);  // Add New Record
            oForm.EnableMenu("1288", false);  // Next Record
            oForm.EnableMenu("1289", false);  // Pevious Record
            oForm.EnableMenu("1290", false);  // First Record
            oForm.EnableMenu("1291", false);  // Last record
            oForm.EnableMenu("1281", false);  // Find record
            oForm.Settings.Enabled = false;
            InitiallizeForm();
        }
Esempio n. 24
0
 /// <summary>
 /// Constructor de Comisiones cobradores
 /// </summary>
 /// <param name="_Application">Este es el objeto raíz de la API de interfaz de usuario
 ///                             lo que refleja la cual aplicación SAP Business One en el que se realiza
 ///                             la conexión</param>
 /// <param name="_Company">Company es el objeto de la API DI principal que representa
 ///                         una única base de datos de SAP Business One empresa
 ///                         Este objeto le permite conectarse a la base de datos de la empresa y
 ///                         crear objetos de negocio para su uso con la base de datos de la empresa</param>
 public frmComisionesCobradores(SAPbouiCOM.Application _Application, SAPbobsCOM.Company _Company, string form, List <Datos> lDatos = null)
 {
     if (_oComisionesCobradores == false)
     {
         company     = _Company;
         application = _Application;
         formID      = form;
         showForm(formID);
         inicializarComponentes();
         setEventos();
         _oComisionesCobradores = true;
     }
 }
Esempio n. 25
0
 public EventHandler(SAPbobsCOM.Company company, SAPbouiCOM.Application app, Controller controller)
 {
     if (company == null)
     {
         throw new Exception("Null Parameters during EventHandler creation: SAPbobsCOM.Company");
     }
     if (app == null)
     {
         throw new Exception("Null Parameters during EventHandler creation: SAPbouiCOM.Application");
     }
     this.oApp     = app;
     this.oCompany = company;
     oController   = controller;
 }
Esempio n. 26
0
 public void ExitAddon()
 {
     try
     {
         //Process p = Process.GetProcessesByName(AppDomain);
         Log.Logger.getInstance().Prepared = false;
         oCompany.Disconnect();
         oApp     = null;
         oCompany = null;
     }
     catch (Exception e)
     {
         SB1ControlException.SB1ControlException.Save(e);
     }
 }
Esempio n. 27
0
 internal static void LogOff()
 {
     if (b1Connected)
     {
         company.Disconnect();
         if (company != null)
         {
             System.Runtime.InteropServices.Marshal.ReleaseComObject(company);
             company = null;
         }
         if (application != null)
         {
             System.Runtime.InteropServices.Marshal.ReleaseComObject(application);
             application = null;
         }
         b1Connected = false;
     }
 }
        public static void LoadFromXML(
            SAPbouiCOM.Application oApplication
            , ref string pFileName
            )
        {
            System.Xml.XmlDocument oXmlDoc = null;
            oXmlDoc = new System.Xml.XmlDocument();

            string sPath = null;

            sPath = System.Windows.Forms.Application.StartupPath;


            oXmlDoc.Load(sPath + "\\" + pFileName);

            string sXml = oXmlDoc.InnerXml.ToString();

            oApplication.LoadBatchActions(ref sXml);
        }
Esempio n. 29
0
        public virtual void CreateForm(SAPbouiCOM.Application SboApp, string strXml, SAPbobsCOM.Company cmp, string frmId)
        {
            formId       = frmId;
            frmXml       = strXml;
            oCompany     = cmp;
            oApplication = SboApp;

            oApplication.ItemEvent       += new _IApplicationEvents_ItemEventEventHandler(oApplication_ItemEvent);
            oApplication.RightClickEvent += new _IApplicationEvents_RightClickEventEventHandler(oApplication_RightClickEvent);
            oApplication.AppEvent        += new _IApplicationEvents_AppEventEventHandler(oApplication_AppEvent);
            oApplication.MenuEvent       += new _IApplicationEvents_MenuEventEventHandler(oApplication_MenuEvent);

            UDClass clsudo = Program.objHrmsUI;

            setFilter();
            try
            {
                clsudo.AddXML(strXml);
                oForm = oApplication.Forms.Item(frmId);
            }
            catch (Exception ex)
            {
                try
                {
                    oForm = oApplication.Forms.Item(frmId);
                    oForm.Select();
                }
                catch (Exception ex1)
                {
                    oApplication.StatusBar.SetText(ex1.Message);
                }
            }
            oForm.EnableMenu("1282", true);  // Add New Record
            oForm.EnableMenu("1288", true);  // Next Record
            oForm.EnableMenu("1289", true);  // Pevious Record
            oForm.EnableMenu("1290", true);  // First Record
            oForm.EnableMenu("1291", true);  // Last record
            oForm.EnableMenu("1281", true);  // Find record

            string mnuId = frmId.Replace("frm", "mnu");

            //isFormReadOnly(mnuId);
        }
Esempio n. 30
0
        public SAPbobsCOM.Company connect(string connString)
        {
            try{
                sboGui  = new SboGuiApi();
                CONNSTR = connString;
                sboGui.Connect(CONNSTR);
                oApp     = sboGui.GetApplication();
                oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();

                oApp.StatusBar.SetText("Conectado", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                //logger.log("Conectado", Log.Logger.LogType.INFO);
            }
            catch (Exception e)
            {
                SB1ControlException.SB1ControlException.Save(e);
            }

            return(oCompany);
        }
Esempio n. 31
0
        public virtual void CreateForm(Application SboApp, SAPbobsCOM.Company cmp, string frmId)
        {
            formId       = frmId;
            oCompany     = cmp;
            oApplication = SboApp;

            oApplication.ItemEvent       += new _IApplicationEvents_ItemEventEventHandler(oApplication_ItemEvent);
            oApplication.RightClickEvent += new _IApplicationEvents_RightClickEventEventHandler(oApplication_RightClickEvent);
            oApplication.AppEvent        += new _IApplicationEvents_AppEventEventHandler(oApplication_AppEvent);
            oApplication.MenuEvent       += new _IApplicationEvents_MenuEventEventHandler(oApplication_MenuEvent);

            UDClass clsudo = Program.objHrmsUI;

            setFilter();
            oForm = oApplication.Forms.Item(frmId);

            string mnuId = frmId.Replace("frm_", "");

            //isFormReadOnly(mnuId);
        }
Esempio n. 32
0
 public static void ConnectViaUI()
 {
     try
     {
         SboGuiApi uiApi = new SboGuiApi();
         // 1. Get the Connection String
         String connectionString = Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));
         // 2. Connect to UI API Object
         uiApi.Connect(connectionString);
         // License for your Add On (your IP)
         // Add-On Identifier
         // 3. Get the B1 Application Object
         oApplication = uiApi.GetApplication();
         // 4. (To-Do) Delegate other sub component (e.g. AppEvent, etc.)
         GenericEventHandler.RegisterEventHandler();
         // 5. (To-Do) Setup Event filters
     }
     catch (Exception ex)
     {
         MsgBoxWrapper(ex.Message + " " + ex.StackTrace);
     }
 }
Esempio n. 33
0
 private static void SetApplication()
 {
     SboGuiApi sboGuiApi = (SboGuiApi)new SboGuiApiClass();
     sboGuiApi.Connect(GetConnectionString());
     application = sboGuiApi.GetApplication(-1);
 }
Esempio n. 34
0
        private static void B1Connect(String version)
        {
            company = (SAPbobsCOM.Company)AppDomain.CurrentDomain.GetData("SAPCompany");
            application = (SAPbouiCOM.Application)AppDomain.CurrentDomain.GetData("SAPApplication");

            try
            {
                // inception!
                if (application != null && company != null)
                {
                    applicationSponsor = new Sponsor<SAPbouiCOM.Application>(application);
                    companySponsor = new Sponsor<SAPbobsCOM.Company>(company);
                    return;
                }
                SetApplication();
                company = (SAPbobsCOM.Company)application.Company.GetDICompany();
            }
            catch (Exception er)
            {
                Logger.Fatal(String.Format(Messages.ConnectionError, er.Message), er);
            }
            finally
            {
                if (company != null)
                    b1Connected = company.Connected;
            }
        }
Esempio n. 35
0
 public I18NService(SAPbouiCOM.Application app)
 {
     this.app = app;
 }
Esempio n. 36
0
 internal static void LogOff()
 {
     if (b1Connected)
     {
         company.Disconnect();
         if (company != null)
         {
             System.Runtime.InteropServices.Marshal.ReleaseComObject(company);
             company = null;
         }
         if (application != null)
         {
             System.Runtime.InteropServices.Marshal.ReleaseComObject(application);
             application = null;
         }
         b1Connected = false;
     }
 }
Esempio n. 37
0
 public BusinessOneUIDAOImpl(SAPbouiCOM.Application application, I18NService addIni18n)
 {
     this.application = application;
     this.i18NService = addIni18n;
 }