//listar cadastros
 public void CarregarDataGrid()
 {
     dgvVendedores.DataSource = BusinesUsuario.ListarUsuarios();
     dgvVendedores.Columns["id_vendedor"].Visible = false;
     dgvVendedores.Columns["id_cargo"].Visible    = false;
     dgvVendedores.Columns["senha"].Visible       = false;
     dgvVendedores.Columns["foto"].Visible        = false;
     dgvVendedores.Columns["login"].Visible       = false;
 }
示例#2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtUser.Text != "Usuário")
     {
         BusinesUsuario obj          = new BusinesUsuario();
         var            validateUser = obj.LoginUser(txtUser.Text, txtPassword.Text);
         if (validateUser == true)
         {
             if (UserLoginCache.Cargo == 1)
             {
                 Administrador.FormAdministrador mainMenu = new Administrador.FormAdministrador();
                 mainMenu.Show();
                 mainMenu.FormClosed += Logout;
                 this.Hide();
             }
             if (UserLoginCache.Cargo == 2)
             {
                 FormDashBoardAtendente mainMenu = new FormDashBoardAtendente();
                 mainMenu.Show();
                 mainMenu.FormClosed += Logout;
                 this.Hide();
             }
         }
         else
         {
             msgError("Usuário ou Senha inválido, verifique e tente novamente!");
         }
     }
     else
     {
         msgError("Por favor entre com seu USUÁRIO!");
     }
     if (txtPassword.Text != "Senha")
     {
     }
     else
     {
         msgError("Por favor entre com sua SENHA");
     }
 }
 private void btnSalvar_Click(object sender, EventArgs e)
 {
     try
     {
         string rpta = "";
         if (this.txtNome.Text == string.Empty || this.txtSobreNome.Text == string.Empty || this.txtLogin.Text == string.Empty ||
             string.IsNullOrEmpty(txtSenha.Text))
         {
             lblSuc.Visible = false;
             msgError("Alguns campos obrigatórios não foram preenchidos!");
         }
         else if (BusinesUsuario.ValidaUsuario(txtLogin.Text) && IsNew == true)
         {
             lblSuc.Visible = false;
             msgError("Já existe um VENDEDOR com Login " + txtLogin.Text + " no banco de dados");
             txtLogin.Focus();
         }
         else
         {
             if (this.IsNew)
             {
                 rpta = BusinesUsuario.InsertUsuario(
                     this.txtLogin.Text,
                     this.txtNome.Text.Trim().ToUpper(),
                     this.txtSobreNome.Text.Trim().ToUpper(),
                     this.txtEmail.Text.Trim().ToLower(),
                     this.txtTelefone.Text,
                     Convert.ToInt32(cbCargo.SelectedValue),
                     this.txtSenha.Text,
                     image
                     );
             }
             else
             {
                 rpta = BusinesUsuario.Update(
                     Convert.ToInt32(txtIdVendedor.Text),
                     this.txtLogin.Text,
                     this.txtNome.Text.Trim().ToUpper(),
                     this.txtSobreNome.Text.Trim().ToUpper(),
                     this.txtEmail.Text.Trim().ToLower(),
                     this.txtTelefone.Text,
                     Convert.ToInt32(cbCargo.SelectedValue),
                     this.txtSenha.Text,
                     image
                     );
             }
             if (rpta.Equals("OK"))
             {
                 if (this.IsNew)
                 {
                     lblError.Visible = false;
                     msgSuccess("Cadastro REALIZADO com sucesso!");
                 }
                 else
                 {
                     lblError.Visible = false;
                     msgSuccess("Cadastro ATUALIZADO com sucesso!");
                 }
             }
             else
             {
                 msgError(rpta);
             }
             IsNew                   = true;
             btnSalvar.Enabled       = false;
             btnCancelar.Enabled     = false;
             btnEditar.Enabled       = true;
             btnNovoCadastro.Enabled = true;
             DesabilitarEdição();
             txtNome.Focus();
             CarregarDataGrid();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
 private void ListarCargos()
 {
     cbCargo.DataSource    = BusinesUsuario.ListarFuncoes();
     cbCargo.ValueMember   = "id_cargo";
     cbCargo.DisplayMember = "cargo";
 }
示例#5
0
 //listando vendedores
 public void ListarUsuarios()
 {
     //dgvUsers.DataSource = BusinesUsuario.ListarUsuarios();
     this.dgvUsers.DataSource = BusinesUsuario.ListarUsuarios();
 }
示例#6
0
 //listando funcao de usuario
 private void ListarFuncao()
 {
     cbFuncao.DataSource    = BusinesUsuario.ListarFuncoes();
     cbFuncao.ValueMember   = "id_funcao";
     cbFuncao.DisplayMember = "nome_funcao";
 }