Exemplo n.º 1
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();
         }
     }
 }
Exemplo n.º 2
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);
         }
     }
 }