コード例 #1
0
        public static void Excluir(TRegistro_OrcamentoEncargo val, BancoDados.TObjetoBanco banco)
        {
            bool st_transacao            = false;
            TCD_OrcamentoEncargo qtb_cad = new TCD_OrcamentoEncargo();

            try
            {
                if (banco == null)
                {
                    st_transacao = qtb_cad.CriarBanco_Dados(true);
                }
                //verificar os valores
                qtb_cad.Excluir(val);
                if (st_transacao)
                {
                    qtb_cad.Banco_Dados.Commit_Tran();
                }
            }
            catch (Exception ex)
            {
                if (st_transacao)
                {
                    qtb_cad.Banco_Dados.RollBack_Tran();
                }
                throw new Exception("Erro excluir encargo: " + ex.Message.Trim());
            }
            finally
            {
                if (st_transacao)
                {
                    qtb_cad.deletarBanco_Dados();
                }
            }
        }
コード例 #2
0
 private void bbAddProjeto_Click(object sender, EventArgs e)
 {
     using (Cadastro.FFolha folha = new Cadastro.FFolha())
     {
         if (bsEncargos.Count > 0)
         {
             List <TRegistro_CadEncargosFolha> lencargo = new List <TRegistro_CadEncargosFolha>();
             (bsEncargos.List as List <TRegistro_OrcamentoEncargo>).ForEach(p =>
             {
                 TRegistro_CadEncargosFolha ea = new TRegistro_CadEncargosFolha();
                 ea.Id_encargostr = p.Id_encargostr;
                 ea.st_agregar    = true;
                 ea.Ds_encargo    = p.ds_encargo;
                 lencargo.Add(ea);
             });
             folha.rLfolha = lencargo;
         }
         if (folha.ShowDialog() == DialogResult.OK)
         {
             // bsEncargos.Clear();
             folha.rLfolha.ForEach(p =>
             {
                 if (p.st_agregar)
                 {
                     TRegistro_OrcamentoEncargo oe = new TRegistro_OrcamentoEncargo();
                     oe.Cd_empresastr = (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa;
                     oe.Id_orcamento  = (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamento;
                     oe.Nr_versao     = (bsOrcamento.Current as TRegistro_Orcamento).Nr_versao;
                     oe.Id_encargo    = p.Id_encargo;
                     oe.ds_encargo    = p.Ds_encargo;
                     oe.pc_encargo    = p.Pc_encargo;
                     bsEncargos.Add(oe);
                 }
                 else
                 {
                     TRegistro_OrcamentoEncargo oe = new TRegistro_OrcamentoEncargo();
                     oe.Cd_empresastr = (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa;
                     oe.Id_orcamento  = (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamento;
                     oe.Nr_versao     = (bsOrcamento.Current as TRegistro_Orcamento).Nr_versao;
                     oe.Id_encargo    = p.Id_encargo;
                     oe.ds_encargo    = p.Ds_encargo;
                     oe.pc_encargo    = p.Pc_encargo;
                     (bsOrcamento.Current as TRegistro_Orcamento).lOEncargoDel.Add(oe);
                 }
             });
             calculaEncargos();
         }
     }
 }
コード例 #3
0
 private void bbEncargoimportar_Click(object sender, EventArgs e)
 {
     using (Cadastro.FFolha folha = new Cadastro.FFolha())
     {
         if (bsEncargo.Count > 0)
         {
             List <TRegistro_CadEncargosFolha> lencargo = new List <TRegistro_CadEncargosFolha>();
             (bsEncargo.List as List <TRegistro_OrcamentoEncargo>).ForEach(p =>
             {
                 TRegistro_CadEncargosFolha ea = new TRegistro_CadEncargosFolha();
                 ea.Id_encargostr = p.Id_encargostr;
                 ea.st_agregar    = true;
                 ea.Ds_encargo    = p.ds_encargo;
                 lencargo.Add(ea);
             });
             folha.rLfolha = lencargo;
         }
         if (folha.ShowDialog() == DialogResult.OK)
         {
             folha.rLfolha.ForEach(p =>
             {
                 if (p.st_agregar)
                 {
                     TRegistro_OrcamentoEncargo oe = new TRegistro_OrcamentoEncargo();
                     oe.Cd_empresastr = (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa;
                     oe.Id_orcamento  = (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamento;
                     oe.Nr_versao     = (bsOrcamento.Current as TRegistro_Orcamento).Nr_versao;
                     oe.Id_encargo    = p.Id_encargo;
                     oe.ds_encargo    = p.Ds_encargo;
                     oe.pc_encargo    = p.Pc_encargo;
                     bsEncargo.Add(oe);
                 }
                 else
                 {
                     TRegistro_OrcamentoEncargo oe = new TRegistro_OrcamentoEncargo();
                     oe.Cd_empresastr = (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa;
                     oe.Id_orcamento  = (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamento;
                     oe.Nr_versao     = (bsOrcamento.Current as TRegistro_Orcamento).Nr_versao;
                     oe.Id_encargo    = p.Id_encargo;
                     oe.ds_encargo    = p.Ds_encargo;
                     oe.pc_encargo    = p.Pc_encargo;
                     (bsOrcamento.Current as TRegistro_Orcamento).lOEncargoDel.Add(oe);
                 }
             });
             MessageBox.Show("Encargos corrigidos com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
コード例 #4
0
        public static string Gravar(TRegistro_OrcamentoEncargo val, BancoDados.TObjetoBanco banco)
        {
            bool st_transacao            = false;
            TCD_OrcamentoEncargo qtb_cad = new TCD_OrcamentoEncargo();

            try
            {
                if (banco == null)
                {
                    st_transacao = qtb_cad.CriarBanco_Dados(true);
                }
                else
                {
                    qtb_cad.Banco_Dados = banco;
                }
                val.Id_encargostr = CamadaDados.TDataQuery.getPubVariavel(qtb_cad.Gravar(val), "@P_ID_ENCARGO");
                if (st_transacao)
                {
                    qtb_cad.Banco_Dados.Commit_Tran();
                }
                return(val.Id_encargostr);
            }
            catch (Exception ex)
            {
                if (st_transacao)
                {
                    qtb_cad.Banco_Dados.RollBack_Tran();
                }
                throw new Exception("Erro gravar encargo: " + ex.Message.Trim());
            }
            finally
            {
                if (st_transacao)
                {
                    qtb_cad.deletarBanco_Dados();
                }
            }
        }