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 dataGridDefault4_DoubleClick(object sender, DataGridViewCellEventArgs e) { using (TFTarefas fTarefa = new TFTarefas()) { if (fTarefa.ShowDialog() == DialogResult.OK) { (bsRequisito.Current as TRegistro_RequisitoOrc).obs = fTarefa.pDs_tarefa; } bsRequisito.ResetCurrentItem(); } }
private void toolStripButton2_Click(object sender, EventArgs e) { 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; bsTarefa.Add(rtarefa); bsTarefa.ResetCurrentItem(); } MessageBox.Show("Tarefa adicionada com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void OtimizarOrcamento() { if (MessageBox.Show("Deseja gerar nova versão do orçamento?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (bsOrcamento.Current != null) { if ((bsOrcamento.Current as TRegistro_Orcamento).St_registro.Trim().ToUpper().Equals("N")) { //Verificar se orçamento possui versão em Aberto if (new TCD_Orcamento().BuscarEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = "a.cd_empresa", vOperador = "=", vVL_Busca = "'" + (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa.Trim() + "'" }, new TpBusca() { vNM_Campo = "a.id_orcamento", vOperador = "=", vVL_Busca = (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr }, new TpBusca() { vNM_Campo = "isnull(a.st_registro, 'A')", vOperador = "=", vVL_Busca = "'A'" } }, "1") != null) { MessageBox.Show("Orçamento possui versão disponivel para OTIMIZAR.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string ds_tarefa = string.Empty; using (TFTarefas fTarefa = new TFTarefas()) { if (fTarefa.ShowDialog() == DialogResult.OK) { ds_tarefa = fTarefa.pDs_tarefa; } } try { TRegistro_Orcamento aux = TCN_Orcamento.GerarNovaVersao(bsOrcamento.Current as TRegistro_Orcamento, ds_tarefa, null); MessageBox.Show("Nova versão gerada com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); LimparFiltros(); cd_empresa.Text = aux.Cd_empresa; id_orcamento.Text = aux.Id_orcamentostr; nr_versao.Text = aux.Nr_versaostr; // cbAberto.Checked = true; afterBusca(); } catch (Exception ex) { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Permitido otimizar somente orçamento que estiver em NEGOCIAÇÃO.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Selecione um orcamento!", "Orçamento", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }