Example #1
0
 private void button5_Click(object sender, EventArgs e)
 {
     try
     {
         ProdutoDTO obj = new ProdutoDTO();
         obj.IdProd = int.Parse(textBox19.Text);
         //MessageBox.Show(obj.IdProd.ToString());
         obj.CodBarras    = textBox14.Text;
         obj.NomeProd     = textBox15.Text;
         obj.DescProd     = textBox8.Text;
         obj.PrecoProd    = textBox16.Text;
         obj.EstoqueProd  = textBox17.Text;
         obj.UnidadeProd  = textBox18.Text;
         obj.TipoUnidProd = comboBox4.Text;
         if (radioButton9.Checked == true)
         {
             obj.AtivoProd = radioButton9.Text;
         }
         if (radioButton8.Checked == true)
         {
             obj.AtivoProd = radioButton8.Text;
         }
         obj.AcaoProd = "alteracao";
         string mensagem = ProdutoBLL.CadProduto(obj);
         MessageBox.Show(mensagem, "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         textBox14.Clear();
         textBox19.Clear();
         textBox15.Clear();
         textBox8.Clear();
         textBox16.Clear();
         textBox17.Clear();
         textBox18.Clear();
         comboBox4.SelectedIndex = -1;
         radioButton8.Checked    = false;
         radioButton9.Checked    = false;
         textBox14.Focus();
         button5.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
 private void btnCadastro_Click(object sender, EventArgs e)
 {
     try
     {
         ProdutoDTO obj = new ProdutoDTO();
         obj.CodBarras    = textBox9.Text;
         obj.NomeProd     = textBox10.Text;
         obj.DescProd     = textBox7.Text;
         obj.PrecoProd    = textBox11.Text;
         obj.EstoqueProd  = textBox12.Text;
         obj.UnidadeProd  = textBox13.Text;
         obj.TipoUnidProd = comboBox3.Text;
         if (radioButton6.Checked == true)
         {
             obj.AtivoProd = radioButton6.Text;
         }
         if (radioButton7.Checked == true)
         {
             obj.AtivoProd = radioButton7.Text;
         }
         obj.AcaoProd = "cadastro";
         string mensagem = ProdutoBLL.CadProduto(obj);
         MessageBox.Show(mensagem, "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         textBox9.Clear();
         textBox10.Clear();
         textBox7.Clear();
         textBox11.Clear();
         textBox12.Clear();
         textBox13.Clear();
         comboBox3.SelectedIndex = -1;
         radioButton6.Checked    = false;
         radioButton7.Checked    = false;
         textBox9.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        private void BtnCadasdProd_Click(object sender, EventArgs e)
        {
            //ve se os campos estao vazios, validar todas as informaçoes
            try
            {
                //metodos com sob

                ProdutoDTO obj = new ProdutoDTO();
                //armazenando os valores das caixas na propriedades

                //vai criar uma classe, e validar as informaçoes atráves delas,

                //provalvelmente vai ser em BLL

                obj.CodBarra  = txtCodProd.Text;
                obj.LoteProd  = txtLoteProd.Text;
                obj.ValProd   = mtbValProd.Text;
                obj.NomeProd  = txtProd.Text;
                obj.DescProd  = txtDescProd.Text;
                obj.QtdProd   = txtQtdProdCad.Text;
                obj.PrecoProd = txtPrecProdCasd.Text;
                obj.MedProd   = cbUnProd.Text;
                string mensagem = ProdutoBLL.CadProduto(obj);
                MessageBox.Show(mensagem, "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtCodProd.Clear();;
                txtLoteProd.Clear();
                mtbValProd.Clear();
                txtProd.Clear();
                txtQtdProdCad.Clear();
                txtPrecProdCasd.Clear();
                cbUnProd.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }