예제 #1
0
 private void bbAddLote_Click(object sender, EventArgs e)
 {
     using (Proc_Commoditties.TFNovoLote fLote = new Proc_Commoditties.TFNovoLote())
     {
         fLote.pCd_empresa    = pCd_empresa;
         fLote.pNm_empresa    = pNm_empresa;
         fLote.pCd_produto    = pCd_produto;
         fLote.pDs_produto    = pDs_produto;
         fLote.pCd_fornecedor = pCd_fornecedor;
         fLote.pNm_fornecedor = pNm_fornecedor;
         if (fLote.ShowDialog() == DialogResult.OK)
         {
             if (fLote.rLote != null)
             {
                 try
                 {
                     fLote.rLote.Tp_lote     = "T";
                     fLote.rLote.St_registro = "P";
                     CamadaNegocio.Sementes.TCN_LoteSemente.Gravar(fLote.rLote, null);
                     MessageBox.Show("Lote adicionado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     bsLoteSemente.Add(fLote.rLote);
                     bsLoteSemente.ResetBindings(true);
                 }
                 catch (Exception ex)
                 { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); }
             }
         }
     }
 }
예제 #2
0
 private void afterAltera()
 {
     if (bsLoteSemente.Current != null)
     {
         if ((bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).Tp_lote.Trim().ToUpper().Equals("P"))
         {
             using (TFLoteSemente fLote = new TFLoteSemente())
             {
                 fLote.vModo     = Utils.TTpModo.tm_Edit;
                 fLote.rSementes = (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente);
                 if (fLote.ShowDialog() == DialogResult.OK)
                 {
                     try
                     {
                         CamadaNegocio.Sementes.TCN_LoteSemente.Alterar(fLote.rSementes, null);
                         MessageBox.Show("Lote alterado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         limparFiltros();
                         id_lote.Text = fLote.rSementes.Id_lote.ToString();
                         afterBusca();
                     }
                     catch (Exception ex)
                     {
                         MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
             }
         }
         else
         {
             using (Proc_Commoditties.TFNovoLote fLote = new Proc_Commoditties.TFNovoLote())
             {
                 fLote.rLote = bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente;
                 if (fLote.ShowDialog() == DialogResult.OK)
                 {
                     try
                     {
                         CamadaNegocio.Sementes.TCN_LoteSemente.Alterar(fLote.rLote, null);
                         MessageBox.Show("Lote alterado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         limparFiltros();
                         id_lote.Text = fLote.rLote.Id_lote.ToString();
                         afterBusca();
                     }
                     catch (Exception ex)
                     { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Obrigatorio selecionar lote para alterar.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #3
0
 private void afterNovo()
 {
     using (Proc_Commoditties.TFNovoLote fLote = new Proc_Commoditties.TFNovoLote())
     {
         if (fLote.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 CamadaNegocio.Sementes.TCN_LoteSemente.Gravar(fLote.rLote, null);
                 MessageBox.Show("Lote gravado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 limparFiltros();
                 id_lote.Text = fLote.rLote.Id_lote.ToString();
                 afterBusca();
             }
             catch (Exception ex)
             { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); }
         }
     }
 }