示例#1
0
        static void Main(string[] args)
        {
            try
            {
                Application oApp = null;
                if (args.Length < 1)
                {
                    oApp = new Application();
                }
                else
                {
                    oApp = new Application(args[0]);
                }
                DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany());
                //CONFIGURACION
                AccountingAccountsSetupLoginService lObjSetupLoginService = new AccountingAccountsSetupLoginService();
                lObjSetupLoginService.CreateTable();
                AccountingAccountsSetupDBService lObjSetupDBService = new AccountingAccountsSetupDBService();
                lObjSetupDBService.CreateTable();
                //IMPORTACION
                //Logg
                AccountingAccountsLoggService lObjLoggService = new AccountingAccountsLoggService();
                lObjLoggService.CreateTable();
                AccountingAccountsLoggDetailService lObjLoggDetailService = new AccountingAccountsLoggDetailService();
                lObjLoggDetailService.CreateTable();

                Menu MyMenu = new Menu();
                MyMenu.AddMenuItems();
                oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent);
                Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
                oApp.Run();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        /// <summary>
        /// Crea o modifica los datos de conexión de asalariados
        /// </summary>
        private void SaveConfigAsalariados()
        {
            AccountingAccountsSetupLogin        setupLogin        = null;
            AccountingAccountsSetupLoginService setupLoginService = new AccountingAccountsSetupLoginService();

            try {
                if (!CheckEmptyFieldsAsal())
                {
                    Application.SBO_Application.StatusBar.SetText("Complete campos vacíos para continuar", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);

                    return;
                }

                if (!ValidateIPString(txtServAsal.Value))
                {
                    Application.SBO_Application.StatusBar.SetText("Verifique el formato de la dirección ip de su servidor", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);

                    return;
                }

                if (lBolUpdateAsal)
                {
                    setupLogin = new AccountingAccountsSetupLogin()
                    {
                        Code              = gCodeAsal,
                        NameServer        = txtServAsal.Value,
                        Login             = txtLoginAsal.Value,
                        Password          = txtPwdAsal.Value,
                        NameDB            = txtBDNameAsal.Value,
                        AccountingAccount = txtCuentaCAsal.Value,
                        //Activo = chkActivoAsal.Checked ? chkActivoAsal.ValOn : chkActivoAsal.ValOff,
                        RowCode = gCodeAsal.ToString()
                    };

                    setupLoginService.Update(setupLogin);
                }
                else
                {
                    setupLogin = new AccountingAccountsSetupLogin()
                    {
                        NameServer        = txtServAsal.Value,
                        Login             = txtLoginAsal.Value,
                        Password          = txtPwdAsal.Value,
                        NameDB            = txtBDNameAsal.Value,
                        Descripcion       = "Asalariados",
                        AccountingAccount = txtCuentaCAsal.Value,
                        //Activo = chkActivoAsal.Checked ? chkActivoAsal.ValOn : chkActivoAsal.ValOff,
                        RowCode = gCodeAsal.ToString()
                    };

                    setupLoginService.Add(setupLogin);

                    FillFieldsBD();

                    lBolUpdateAsal = true;
                }

                Application.SBO_Application.StatusBar.SetText("Configuración guardada con éxito", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
            }
            catch (Exception ex) {
                Application.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }