/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (PriEngine.InitializeCompany(txtempresa.Text, txtuser.Text, txtpass.Text))
                {
                    StringBuilder status = new StringBuilder();

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

                    lblStatus.Text = status.ToString();

                    groupBox1.Enabled = true;
                }
                else
                {
                    lblStatus.Text = "Cannot acess to primavera. Check your configuration.";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                PriEngine.Termina();
            }
        }
Esempio n. 2
0
        public static int activate(User u)
        {
            StdBELista objList;
            string     usr, pw;

            if (u.Token.Equals(UserController.token))
            {
                if (PriEngine.InitializeCompany("BELAFLOR", "", "") == true)
                {
                    objList = PriEngine.Engine.Consulta("SELECT CDU_CampoVar1 as Username, CDU_CampoVar2 as Password FROM Clientes WHERE CDU_CampoVar1 = '" + u.Username + "'");
                    usr     = objList.Valor("Username");
                    pw      = objList.Valor("Password");

                    if (u.Password.Equals(pw))
                    {
                        return(1);
                    }
                }
            }

            return(0);

            //if (u.Token.Equals(UserController.token))
            //{
            //    for (int i = 0; i < UserController.count(); i++)
            //    {
            //        if (UserController.users.ElementAt(i).Username.Equals(u.Username))
            //        {
            //            if (UserController.users.ElementAt(i).Password.Equals(u.Password))
            //            {
            //                if (UserController.users.ElementAt(i).Activate == false)
            //                {
            //                    UserController.users.ElementAt(i).Activate = true;
            //                    return 1;
            //                }
            //                else if(UserController.users.ElementAt(i).Activate == true)
            //                {
            //                    return 2;
            //                }
            //            }
            //            else return 3;
            //        }
            //    }

            //    User u2 = new User();
            //    u2.Username = u.Username;
            //    u2.Password = u.Password;
            //    u2.Activate = true;

            //    UserController.add(u);
            //    return 0;
            //}

            //return 3;
        }
Esempio n. 3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            GlobalConfiguration.Configuration.EnsureInitialized();
            PriEngine.InitializeCompany(FirstREST.Properties.Settings.Default.Company.Trim(), FirstREST.Properties.Settings.Default.User.Trim(), FirstREST.Properties.Settings.Default.Password.Trim());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdLogin_Click(object sender, EventArgs e)
        {
            if (PriEngine.InitializeCompany(txtempresa.Text, txtuser.Text, txtpass.Text))
            {
                object u = PriEngine.Platform.Contexto.Utilizador.get_objUtilizador();

                StringBuilder status = new StringBuilder();

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

                lblStatus.Text = status.ToString();

                groupBox1.Enabled = true;
            }
            else
            {
                lblStatus.Text = "Cannot acess to primavera. Check your configuration.";
            }
        }