Beispiel #1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     cruds = new VO.CrudVO();
     try
     {
         cruds.itemcodigo    = textBox2.Text;
         cruds.itemdescricao = textBox3.Text;
         cruds.itempreco     = Convert.ToDouble(textBox4.Text);
         cruds.itemid        = Convert.ToInt32(textBox1.Text);
         cruds.Atualizar();
         dataGridView1[0, catchRowIndex].Value = textBox1.Text;
         dataGridView1[1, catchRowIndex].Value = textBox2.Text;
         dataGridView1[2, catchRowIndex].Value = textBox3.Text;
         dataGridView1[3, catchRowIndex].Value = textBox4.Text;
         btnUpdate.Enabled = false;
         btnDelete.Enabled = false;
         textBox1.Clear();
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
     }
     catch (Exception)
     {
         MessageBox.Show("Ocorreu um erro ao realizar a operação", "Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         cruds               = new VO.CrudVO();
         cruds.itemcodigo    = textBox2.Text;
         cruds.itemdescricao = textBox3.Text;
         cruds.itempreco     = Convert.ToDouble(textBox4.Text);
         cruds.Inserir();
         dataGridView1.Rows.Add(null, textBox2.Text, textBox3.Text, textBox4.Text);
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
     }
     catch (Exception)
     {
         MessageBox.Show("Ocorreu um erro ao realizar a operação", "Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     cruds = new VO.CrudVO();
     try
     {
         cruds.itemcodigo = textBox2.Text;
         cruds.itemid     = Convert.ToInt32(textBox1.Text);
         cruds.Remover();
         dataGridView1.Rows.RemoveAt(catchRowIndex);
         btnUpdate.Enabled = false;
         btnDelete.Enabled = false;
         textBox1.Clear();
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
     }
     catch (Exception)
     {
         MessageBox.Show("Ocorreu um erro ao realizar a operação", "Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }