コード例 #1
0
        private void alterarBt_Click(object sender, EventArgs e)
        {
            DAO.OrigemDAO  oDAO = new DAO.OrigemDAO();
            DAO.UsuarioDAO uDAO = new DAO.UsuarioDAO();

            DataGridViewRow row      = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex];
            int             idCelula = Int16.Parse(row.Cells[0].Value.ToString());

            string valor  = row.Cells[2].Value.ToString();
            int    origem = Int16.Parse(row.Cells[3].Value.ToString());
            string descr  = row.Cells[5].Value.ToString();
            int    resp   = Int16.Parse(row.Cells[6].Value.ToString());
            string nota   = row.Cells[7].Value.ToString();

            clear();

            id                    = idCelula;
            depositTb.Text        = valor;
            origemDp.SelectedText = oDAO.NomeOrigem(origem);
            descripTb.Text        = descr;
            respDp.SelectedText   = uDAO.NomeColaborador(resp);
            notaTb.Text           = nota;

            switchAlterar();
        }
コード例 #2
0
ファイル: Menu.cs プロジェクト: ZekeLionhart/ControleDoacoes
        private void logoffBt_Click(object sender, EventArgs e)
        {
            DAO.UsuarioDAO uDAO = new DAO.UsuarioDAO();
            uDAO.DeslogarUsuario();

            this.Hide();
            Login logoff = new Login();

            logoff.ShowDialog();
            this.Close();
        }
コード例 #3
0
        private void newUser()
        {
            if (nomeTb.Text == "")
            {
                MessageBox.Show("Insira o nome do colaborador!");
                nomeTb.Focus();
            }
            else if (accessDp.Text == "")
            {
                MessageBox.Show("Insira um tipo de acesso!");
                accessDp.Focus();
            }
            else if (nomeTb.Text == userTb.Text)
            {
                MessageBox.Show("O login do colaborador deve ser diferente de seu nome!");
                nomeTb.Focus();
            }
            else
            {
                var result = MessageBox.Show("Confirmar criação?", "Confirmação", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    if (senhaTb.Text != confTb.Text)
                    {
                        MessageBox.Show("Confirmação de senha incorreta!");
                    }
                    else
                    {
                        Objetos.Colaborador user = new Objetos.Colaborador();
                        DAO.UsuarioDAO      uDAO = new DAO.UsuarioDAO();

                        user.Usuario    = userTb.Text;
                        user.HashSenha  = senhaTb.Text;
                        user.TipoAcesso = accessDp.Text;
                        user.Nome       = nomeTb.Text;
                        user.Rg         = rgTb.Text;
                        user.Cpf        = cpfTb.Text;
                        if (nascTb.Text != "  /  /")
                        {
                            user.DataNascimento = DateTime.Parse(nascTb.Text).Date;
                        }

                        clear();

                        uDAO.CadastrarColaborador(user);
                        switchTabela();
                    }
                }
            }
        }
コード例 #4
0
        public Entrada()
        {
            InitializeComponent();

            Objetos.Entrada entrada = new Objetos.Entrada();
            DAO.OrigemDAO   oDAO    = new DAO.OrigemDAO();
            DAO.UsuarioDAO  uDAO    = new DAO.UsuarioDAO();

            origemDp.ValueMember   = "idOrigem";
            origemDp.DisplayMember = "Nome";
            origemDp.DataSource    = oDAO.ConsultarOrigem();
            respDp.DataSource      = uDAO.NomesColaboradores();
            respDp.DisplayMember   = "Nome";
            respDp.SelectedItem    = entrada.FkNomeColaboradorResponsavel;

            updateTable();
            switchTabela();
        }
コード例 #5
0
        public Saída()
        {
            InitializeComponent();

            Objetos.Saida  saida = new Objetos.Saida();
            DAO.SaidaDAO   sDAO  = new DAO.SaidaDAO();
            DAO.CaixaDAO   cDAO  = new DAO.CaixaDAO();
            DAO.UsuarioDAO uDAO  = new DAO.UsuarioDAO();

            tipoDp.SelectedItem  = "Fixa";
            respDp.DataSource    = uDAO.NomesColaboradores();
            respDp.DisplayMember = "Nome";
            respDp.SelectedItem  = saida.FkNomeColaboradorResponsavel;

            dataGridView1.DataSource = sDAO.ConsultarSaida();
            dataGridView1.Sort(this.dataGridView1.Columns["DataHoraRegistro"], ListSortDirection.Descending);
            dinheiroSaidaLb.Text = "R$" + String.Format("{0:0.00}", cDAO.ConsultarSaldo());
            switchTabela();
        }
コード例 #6
0
        private void deleteBt_Click(object sender, EventArgs e)
        {
            DataGridViewRow row         = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex];
            int             valorCelula = Int16.Parse(row.Cells[0].Value.ToString());

            DAO.UsuarioDAO uDAO = new DAO.UsuarioDAO();
            string         user = Objetos.Colaborador.usuarioLogado;

            string verif = InputDialogBox.Show("Tem certeza que deseja fazer isso?\nEssa ação é irreversível! (Digite 'SIM' para confirmar)");

            if (verif == "SIM")
            {
                uDAO.RemoverColaborador(valorCelula);
                dataGridView1.DataSource = uDAO.ConsultarColaboradores();
            }
            else
            {
                MessageBox.Show("Operação cancelada.");
            }
        }
コード例 #7
0
        private void alterarBt_Click(object sender, EventArgs e)
        {
            DAO.UsuarioDAO uDAO = new DAO.UsuarioDAO();

            DataGridViewRow row      = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex];
            int             idCelula = Int16.Parse(row.Cells[0].Value.ToString());
            string          valor    = row.Cells[2].Value.ToString();
            string          tipo     = row.Cells[4].Value.ToString();
            string          descr    = row.Cells[5].Value.ToString();
            int             resp     = Int16.Parse(row.Cells[6].Value.ToString());
            string          nota     = row.Cells[7].Value.ToString();

            clear();
            id                  = idCelula;
            saqueTb.Text        = Convert.ToString(Convert.ToDouble(valor) * -1);
            tipoDp.SelectedItem = tipo;
            respDp.SelectedText = uDAO.NomeColaborador(resp);
            notaTb.Text         = nota;
            descripTb.Text      = descr;
            switchAlterar();
        }
コード例 #8
0
ファイル: Login.cs プロジェクト: ZekeLionhart/ControleDoacoes
        private void loginTest()
        {
            if (userTb.Text == "")
            {
                MessageBox.Show("Insira um nome de login!");
                userTb.Focus();
            }
            else if (senhaTb.Text == "")
            {
                MessageBox.Show("Insira a senha!");
                senhaTb.Focus();
            }
            else
            {
                Objetos.Colaborador user = new Objetos.Colaborador();
                DAO.UsuarioDAO      uDAO = new DAO.UsuarioDAO();

                user.Usuario   = userTb.Text;
                user.HashSenha = senhaTb.Text;


                if (uDAO.LogarUsuario(user))
                {
                    this.Hide();
                    Menu login = new Menu();
                    login.ShowDialog();
                    this.Close();
                }
                else
                {
                    if (i == 2)
                    {
                        this.Close();
                    }

                    i++;
                }
            }
        }
コード例 #9
0
        private void updateTable()
        {
            DAO.UsuarioDAO uDAO = new DAO.UsuarioDAO();

            dataGridView1.DataSource = uDAO.ConsultarColaboradores();
        }
コード例 #10
0
 private void passBt_Click(object sender, EventArgs e)
 {
     DAO.UsuarioDAO uDAO = new DAO.UsuarioDAO();
     uDAO.AlterarSenha();
 }