private void toolStripButton1_Click(object sender, EventArgs e) { if (bsOrcamento.Current != null) { if (MessageBox.Show("Deseja reabrir Orçamento?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { try { using (TFTarefas ftarefa = new TFTarefas()) { ftarefa.pCd_Empresa = (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa; if (ftarefa.ShowDialog() == DialogResult.OK) { if (ftarefa.pDs_tarefa != null) { TRegistro_Tarefas rtarefa = new TRegistro_Tarefas(); rtarefa.Cd_empresa = ftarefa.pCd_Empresa; rtarefa.Ds_tarefa = ftarefa.pDs_tarefa; rtarefa.Id_orcamentostr = (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr; rtarefa.Nr_versaostr = (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr; rtarefa.Login = Utils.Parametros.pubLogin; TCN_Tarefas.Gravar(rtarefa, null); } } } (bsOrcamento.Current as TRegistro_Orcamento).St_registro = "O"; TCN_Orcamento.Gravar(bsOrcamento.Current as TRegistro_Orcamento, null); MessageBox.Show("Orçamento reaberto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void buscaOrcCompleto() { if ((bsOrcamento.Current as TRegistro_Orcamento) != null) { (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto = TCN_OrcProjeto.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, string.Empty, string.Empty, null); (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto.ForEach(p => { p.lFicha = TCN_FichaTec.Buscar(p.Cd_empresa, p.Id_orcamentostr, p.Nr_versaostr, p.Id_projetostr, p.Id_registrostr, string.Empty, null); }); //Buscar Despesas (bsOrcamento.Current as TRegistro_Orcamento).lDespesas = TCN_Despesas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, string.Empty, string.Empty, null); //Buscar Tarefas (bsOrcamento.Current as TRegistro_Orcamento).lTarefas = TCN_Tarefas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, null); //Buscar mao obra (bsOrcamento.Current as TRegistro_Orcamento).lMaoObra = TCN_CadMaoObra.Busca( (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, string.Empty, null); //Buscar encargos (bsOrcamento.Current as TRegistro_Orcamento).lOEncargo = TCN_OrcamentoEncargo.Buscar( string.Empty, (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, null); } }
private void bsOrcamento_PositionChanged(object sender, EventArgs e) { if (bsOrcamento.Current != null) { //Buscar Atividades (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto = TCN_OrcProjeto.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, string.Empty, string.Empty, null); //Buscar Despesas (bsOrcamento.Current as TRegistro_Orcamento).lDespesas = TCN_Despesas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, string.Empty, string.Empty, null); //Buscar Tarefas (bsOrcamento.Current as TRegistro_Orcamento).lTarefas = TCN_Tarefas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, null); //Buscar mao obra (bsOrcamento.Current as TRegistro_Orcamento).lMaoObra = TCN_CadMaoObra.Busca( (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, string.Empty, null); (bsOrcamento.Current as TRegistro_Orcamento).lOEncargo = TCN_OrcamentoEncargo.Buscar(string.Empty, (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, null); calculaEncargos(); bsOrcamento.ResetCurrentItem(); bsAtividade_PositionChanged(this, new EventArgs()); } }