Пример #1
0
        /// <summary>
        /// Método que faz o login do sistema
        /// </summary>
        public void Logar()
        {
            string mensagem = "";

            if (!ValidaCampos(ref mensagem))
            {
                return;
            }

            string login = edt_ac_login_login.Text;
            string pass  = edt_ac_login_pass.Text;

            // Just to create the table if is the first login and don't exists a user in the system.
            MD_Usuario user = new MD_Usuario(string.Empty);

            if (Util.Global.Logar(login, pass))
            {
                AC_Menu ac     = new AC_Menu();
                Intent  intent = new Intent(this, ac.GetType());
                StartActivityForResult(intent, INCLUIR_CLIENTE);
                Util.Global.Alerta_Class.ApresentaToast("Bem vindo!", this);
            }
            else
            {
                if (user.ExisteLogin(login))
                {
                    edt_ac_login_pass.Text = "";
                    Util.Global.Alerta_Class.ApresentaToast("Usuário ou senha incorretos!", ToastLength.Long, this);
                }
                else
                {
                    edt_ac_login_pass.Text = "";
                    Util.Global.Alerta_Class.ApresentaToast("Usuário não cadastrado no sistema!", ToastLength.Long, this);
                }
            }
        }