Exemplo n.º 1
0
        /// <summary>
        /// Creats the context.
        /// </summary>
        /// <param name="Company">The company.</param>
        /// <param name="User">The user.</param>
        /// <param name="Password">The password.</param>
        /// <param name="Instance">ERP instance.</param>
        /// <returns></returns>
        public static PriEngine CreatContext(string Company, string User, string Password, string Instance)
        {
            try
            {
                StdLoggingHandler.FileTraceEnterMethod();
                StdLoggingHandler.FileTrace("Creating objects");

                StdBSConfApl objAplConf = new StdBSConfApl();
                StdPlatBS    Plataforma = new StdPlatBS();
                ErpBS        MotorLE    = new ErpBS();

                StdLoggingHandler.FileTrace("Setting configuration");
                EnumTipoPlataforma objTipoPlataforma = EnumTipoPlataforma.tpEmpresarial;

                objAplConf.Instancia       = Instance;
                objAplConf.AbvtApl         = "ERP";
                objAplConf.PwdUtilizador   = Password;
                objAplConf.Utilizador      = User;
                objAplConf.LicVersaoMinima = "10.00";

                StdLoggingHandler.FileTrace("Setting transaccao");
                StdBETransaccao objStdTransac = new StdBETransaccao();

                try
                {
                    StdLoggingHandler.FileTrace("Calling AbrePlataformaEmpresa");
                    Plataforma.AbrePlataformaEmpresa(Company, objStdTransac, objAplConf, objTipoPlataforma);
                    StdLoggingHandler.FileTrace("Exit from AbrePlataformaEmpresa");
                }
                catch (Exception ex)
                {
                    StdLoggingHandler.FileTraceWithThrow(ex);
                    throw;
                }

                if (Plataforma.Inicializada)
                {
                    StdLoggingHandler.FileTrace("Calling AbreEmpresaTrabalho");
                    MotorLE.AbreEmpresaTrabalho(objTipoPlataforma, Company, User, Password, objStdTransac, Instance);
                    StdLoggingHandler.FileTrace("Exit from AbreEmpresaTrabalho");

                    Platform = Plataforma;
                    Engine   = MotorLE;

                    EngineStatus = true;
                }

                return(engineInstance);
            }
            catch (Exception ex)
            {
                StdLoggingHandler.FileTraceWithThrow(ex);
                throw;
            }
            finally
            {
                StdLoggingHandler.FileTraceExitMethod();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the CmdLogin control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void CmdLogin_Click(object sender, EventArgs e)
        {
            try
            {
                StdLoggingHandler.FileTraceEnterMethod();
                StdLoggingHandler.FileTrace("Building priengine context");

                PriEngine.CreatContext(txtempresa.Text, txtuser.Text, txtpass.Text, txtInstance.Text);
                StdLoggingHandler.FileTrace("Check priengine Status");

                if (PriEngine.EngineStatus)
                {
                    StringBuilder status = new StringBuilder();

                    status.Append("Company: ").Append(PriEngine.Platform.Contexto.Empresa.CodEmp).Append(" | ");
                    status.Append("Company Name: ").Append(PriEngine.Platform.Contexto.Empresa.IDNome).Append(" | ");
                    status.Append("Currency: ").Append(PriEngine.Platform.Contexto.Empresa.MoedaBase);

                    StdLoggingHandler.FileTrace(status);

                    pnlActions.Visible = true;
                    lblStatus.Text     = status.ToString();
                }
                else
                {
                    StdLoggingHandler.FileTrace("ERROR: Cannot access primavera!");
                    lblStatus.Text = "Cannot acess to primavera. Check your configuration.";
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.ShowErrorMessage(ex, "Login", this);
            }
            finally
            {
                StdLoggingHandler.FileTraceExitMethod();
            }
        }
Exemplo n.º 3
0
        private void btLog_Click(object sender, EventArgs e)
        {
            switch (cbbLogType.SelectedIndex)
            {
            case 0:
                StdLoggingHandler.FileTrace(GetMessage());
                break;

            case 1:
                StdLoggingHandler.Indent();
                StdLoggingHandler.FileTrace(GetMessage());
                StdLoggingHandler.Outdent();
                break;

            case 2:
                StdLoggingHandler.FileTrace("Enter method can be called with or withou message");
                StdLoggingHandler.FileTraceEnterMethod();
                StdLoggingHandler.FileTraceEnterMethod(GetMessage());
                break;

            case 3:
                StdLoggingHandler.FileTrace("Exit method can be called with or withou message");
                StdLoggingHandler.FileTraceExitMethod(GetMessage());
                StdLoggingHandler.FileTraceExitMethod();
                break;

            case 4:
                SimulateException();
                break;

            default:
                break;
            }

            btReload_Click(sender, EventArgs.Empty);
        }