示例#1
0
        private void UserForm_Load(object sender, EventArgs e)
        {
            DAO.dao_user dao = new DAO.dao_user();

            txtMatric.Text    = (dao.getMatricula() + 1).ToString();
            txtMatric.Enabled = false;
        }
示例#2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            DAO.dao_user dao  = new DAO.dao_user();
            string       user = dao.doLogin(txtLogin.Text, txtPass.Text);

            if (user != null)
            {
                ((MainForm)this.MdiParent).mnItLogin.Visible  = false;
                ((MainForm)this.MdiParent).mnItLogout.Visible = true;
                ((MainForm)this.MdiParent).mnProd.Enabled     = true;
                if (user == "admin")
                {
                    ((MainForm)this.MdiParent).mnItCadUser.Visible = true;
                }
                ((MainForm)this.MdiParent).currentUser = user;

                ((MainForm)this.MdiParent).Text = "Gerenciamento de Padaria | Usuário ativo: " + user;

                this.Close();
            }
            else
            {
                MessageBox.Show("Credenciais não conferem, favor verificar.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        private void btnCad_Click(object sender, EventArgs e)
        {
            if (val.checkEmpty(this) == false)
            {
                return;
            }
            if (val.validaCpfCnpj(txtCpf.Text, txtCpf) == false)
            {
                return;
            }
            if (val.validaData(txtDtNasc.Text, txtDtNasc) == false)
            {
                return;
            }
            if (val.validaNumero(txtTel1.Text, txtTel1) == false)
            {
                return;
            }
            if (val.validaNumero(txtTel2.Text, txtTel2) == false)
            {
                return;
            }
            if (val.validaNumero(txtCep.Text, txtCep) == false)
            {
                return;
            }
            if (txtCep.Text.Length != 8)
            {
                MessageBox.Show("CEP deve conter 8 digitos.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                if (val.validaUF(cmbBoxUf.SelectedItem.ToString(), cmbBoxUf) == false)
                {
                    return;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Por favor, selecione um dos itens da lista.", "Erro");
                cmbBoxUf.Focus();
                return;
            }

            if (txtPass.Text != txtRePass.Text)
            {
                MessageBox.Show("Senhas não conferem, favor verificar", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPass.Focus();
                return;
            }

            DAO.dao_user dao = new DAO.dao_user();

            dao.insertUser(txtNome.Text, DateTime.Parse(txtDtNasc.Text).ToString("yyyy-MM-dd"),
                           txtCpf.Text, txtCep.Text, txtLogr.Text, txtBairro.Text, txtCidade.Text, cmbBoxUf.Text,
                           txtTel1.Text, txtTel2.Text, int.Parse(txtMatric.Text), txtLogin.Text, txtPass.Text);


            val.clearAll(panLogin);
            val.clearAll(panFunc);
        }