Example #1
0
 private void InserirItem()
 {
     if (bsLoteCustodia.Current != null)
     {
         if ((bsLoteCustodia.Current as CamadaDados.Financeiro.Titulo.TRegistro_LoteCustodia).St_registro.Trim().ToUpper().Equals("E"))
         {
             MessageBox.Show("Não é permitido inserir cheque lote ENVIADO.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         using (TFTitulosCustodia fCustodia = new TFTitulosCustodia())
         {
             fCustodia.Cd_empresa = (bsLoteCustodia.Current as CamadaDados.Financeiro.Titulo.TRegistro_LoteCustodia).Cd_empresa;
             if (fCustodia.ShowDialog() == DialogResult.OK)
             {
                 if (fCustodia.lChCustodia != null)
                 {
                     try
                     {
                         CamadaDados.Financeiro.Titulo.TList_LoteCustodia_X_Titulo lLote = new CamadaDados.Financeiro.Titulo.TList_LoteCustodia_X_Titulo();
                         fCustodia.lChCustodia.ForEach(p => lLote.Add(
                                                           new CamadaDados.Financeiro.Titulo.TRegistro_LoteCustodia_X_Titulo()
                         {
                             Cd_banco        = p.Cd_banco,
                             Cd_empresa      = p.Cd_empresa,
                             Nr_lanctocheque = p.Nr_lanctocheque,
                             Id_lote         = (bsLoteCustodia.Current as CamadaDados.Financeiro.Titulo.TRegistro_LoteCustodia).Id_lote
                         }));
                         CamadaNegocio.Financeiro.Titulo.TCN_LoteCustodia_X_Titulo.Gravar(lLote, null);
                         MessageBox.Show("Cheques gravados com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         this.LimparFiltros();
                         id_lotebusca.Text = (bsLoteCustodia.Current as CamadaDados.Financeiro.Titulo.TRegistro_LoteCustodia).Id_lote.Value.ToString();
                         this.afterBusca();
                     }
                     catch (Exception ex)
                     {
                         MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Necessario selecionar lote para inserir cheque.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #2
0
 private void InserirItem()
 {
     if (bsLoteCustodia.Current != null)
     {
         if (string.IsNullOrEmpty(cd_empresa.Text))
         {
             MessageBox.Show("Obrigatorio informar empresa.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             cd_empresa.Focus();
             return;
         }
         using (TFTitulosCustodia fCustodia = new TFTitulosCustodia())
         {
             fCustodia.Cd_empresa = cd_empresa.Text;
             if (fCustodia.ShowDialog() == DialogResult.OK)
             {
                 if (fCustodia.lChCustodia != null)
                 {
                     fCustodia.lChCustodia.ForEach(p => (bsLoteCustodia.Current as CamadaDados.Financeiro.Titulo.TRegistro_LoteCustodia).lChCustodia.Add(p));
                     bsLoteCustodia.ResetCurrentItem();
                 }
             }
         }
     }
 }