Ejemplo n.º 1
0
        private void metroLink1_Click(object sender, System.EventArgs e)
        {
            errors.Clear();
            errors.Tag = 0;
            if (mtxtSenhaClientes.Text == "")
            {
                errors.SetError(this.mtxtSenhaClientes, "Campo Obrigatório");
                errors.Tag = 1;
            }
            if (mtxtSenhaClientes.Text.Length < 8)
            {
                errors.SetError(this.mtxtSenhaClientes, "Insira pelo menos 8 caracteres");
                errors.Tag = 1;
            }
            if (mtxtSenhaClientes.Text.Length > 16)
            {
                errors.SetError(this.mtxtSenhaClientes, "Insira no máximo 16 caracteres");
                errors.Tag = 1;
            }
            if (metroTextBox1.Text == "")
            {
                errors.SetError(this.metroTextBox1, "Campo Obrigatório");
                errors.Tag = 1;
            }
            if (mtxtUsuarioClientes.Text == "")
            {
                errors.SetError(this.mtxtUsuarioClientes, "Campo Obrigatório");
                errors.Tag = 1;
            }
            if (mtxtSenhaClientes.Text != metroTextBox1.Text)
            {
                errors.SetError(this.mtxtSenhaClientes, "Os campos não conferem");
                errors.SetError(this.metroTextBox1, "Os campos não conferem");
                errors.Tag = 1;
            }

            if ((int)errors.Tag == 0)
            {
                var userDomain = _appCar.GetUser(userName: mtxtUsuarioClientes.Text);
                if (userDomain.Name == null)
                {
                    User = new Domain.Entities.User(mtxtUsuarioClientes.Text, mtxtSenhaClientes.Text, false);
                    this.Hide();
                    RegisterFinish form = new RegisterFinish(this.StyleManager);
                    form.User = User;
                    form.ShowDialog();
                    this.Close();
                }
                else
                {
                    MetroMessageBox.Show(this, "Usuário já cadastrado", "Cadastro de cliente", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
                }
            }
        }
Ejemplo n.º 2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            NewCard form = new NewCard(this.StyleManager);

            if (User.isAdmin)
            {
                form.User = _appUser.GetUser(id: FullClient.Client.User_Id);
            }
            else
            {
                form.User = User;
            }

            form.ShowDialog();
        }
Ejemplo n.º 3
0
        public UserModel GetUserInfo(string userName, string Password, string DeviceID, string DeviceToken, string
                                     DeviceName, string Platform, int QryOption, string UserCode, string VersionCode)
        {
            Encryption encObj = new Encryption();

            string decryptUser1 = "";

            string decryptPwd1 = "";

            if (!String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(Password))
            {
                decryptUser1 = encObj.EncryptWord(Cipher.Decrypt(userName));
                decryptPwd1  = encObj.EncryptWord(Cipher.Decrypt(Password));
            }

            UserModel model = userdb.GetUser(decryptUser1, decryptPwd1, DeviceID, DeviceToken,
                                             DeviceName, Platform, QryOption, UserCode, VersionCode);

            return(model);
        }
Ejemplo n.º 4
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            var username = metroTextBox1.Text;
            var password = metroTextBox2.Text;

            if (username == "")
            {
                error.SetError(metroTextBox1, "Campo Obrigatório");
            }
            if (password == "")
            {
                error.SetError(metroTextBox2, "Campo Obrigatório");
            }
            if (password != "" && username != "")
            {
                var user = _appUser.GetUser(username, password);
                if (user.Id != 0)
                {
                    if (user.Admin)
                    {
                        FrmPrincipal admin = new FrmPrincipal();
                        admin.User = user;
                        this.Hide();
                        admin.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        FrmUsuario client = new FrmUsuario();
                        client.User = user;
                        this.Hide();
                        client.ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "Usuário não encontrado", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
                }
            }
        }
Ejemplo n.º 5
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            var usuario = metroTextBox1.Text;

            if (usuario == "")
            {
                error.SetError(metroTextBox1, "Insira o usuário");
            }
            else
            {
                var user = _appUser.GetUser(userName: usuario);
                if (user.Id == 0)
                {
                    MetroMessageBox.Show(this, "Usuário não Encontrado", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, 100);
                }
                else
                {
                    MetroMessageBox.Show(this, user.Password, "Sua senha é", MessageBoxButtons.OK, MessageBoxIcon.Question, 100);
                }
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Gets a User by unique Identifier
 /// </summary>
 /// <param name="id"></param>
 /// <returns>Found User</returns>
 public User GetUser(int id)
 {
     return(_dbUser.GetUser(id));
 }