コード例 #1
0
        private void btn_Cadastrar_Click(object sender, EventArgs e)
        {
            if (txt_Id.Text.Trim().Length == 0 || txt_Nome.Text.Trim().Length == 0)
            {
                MessageBox.Show("Preencha todos os campos!");
                return;
            }

            int num;

            if (!int.TryParse(txt_Id.Text, out num))
            {
                MessageBox.Show("O campo \"Id:\" deve ser um valor númerico");
                return;
            }

            if (GerenciaBanco.CadastrarUsuario(num, txt_Nome.Text))
            {
                MessageBox.Show("Usuario cadastrado com sucesso!");
            }
            else
            {
                MessageBox.Show("Foi encontrado algum erro no ato de cadastrar usuario!");
            }
        }
コード例 #2
0
        private void btn_Adicionar_Click(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            if (d.ShowDialog() == DialogResult.OK)
            {
                GerenciaBanco.adicionarImagem(d.FileName);
            }
        }
コード例 #3
0
 private void btn_carregar_Click(object sender, EventArgs e)
 {
     MemoryStream[] foto = new MemoryStream[2];
     foto = GerenciaBanco.getImagens();
     foreach (MemoryStream item in foto)
     {
         pic_foto.Image = Image.FromStream(item);
         MessageBox.Show("Pressione ok!");
     }
 }
コード例 #4
0
        private void btn_pesquisar_Click(object sender, EventArgs e)
        {
            string nome = GerenciaBanco.getNomePorCodigo(txt_codigo.Text);

            if (lbl_nome != null)
            {
                this.Controls.Remove(lbl_nome);
            }
            lbl_nome          = new Label();
            lbl_nome.Text     = nome;
            lbl_nome.Location = new Point(50, 50);
            this.Controls.Add(lbl_nome);
        }
コード例 #5
0
        private void cmb_nome_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyData == Keys.Up || e.KeyData == Keys.Down || e.KeyData == Keys.Left || e.KeyData == Keys.Right || cmb_nome.Text.Length == 0)
            {
                return;
            }

            string[] nomes = GerenciaBanco.getListaUsuario(cmb_nome.Text).ToArray();
            cmb_nome.DroppedDown = nomes.Length > 0 ? true : false;
            cmb_nome.Items.Clear();
            cmb_nome.Items.AddRange(nomes);
            cmb_nome.SelectionStart = cmb_nome.Text.Length;
        }
コード例 #6
0
 private void btn_consultar_Click(object sender, EventArgs e)
 {
     dgv_lista.DataSource = GerenciaBanco.getCompras();
 }
コード例 #7
0
 private void btn_Cadastrar_Click(object sender, EventArgs e)
 {
     GerenciaBanco.CadastrarAluno(txt_AlunoNome.Text, int.Parse(txt_IdResponsavel.Text), txt_ResponsavelNome.Text);
 }
コード例 #8
0
 private void btn_consultar_Click(object sender, EventArgs e)
 {
     dtv_usuarios.DataSource = GerenciaBanco.getUsuarios();
 }
コード例 #9
0
 public FormConsultaTodosUsuarios()
 {
     InitializeComponent();
     dtv_usuarios.DataSource = GerenciaBanco.getUsuarios();
 }
コード例 #10
0
 private void btn_cadastrar_Click(object sender, EventArgs e)
 {
     GerenciaBanco.CadastrarCompra(int.Parse(txt_id.Text), txt_item.Text, int.Parse(txt_quantidade.Text), int.Parse(txt_iduser.Text));
 }