private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string NumeroOrcamento = null;
            string BDI             = null;
            string Total           = null;

            dotacaoOrcamentariaTableAdapter.Fill(this.sCOOPDataSet.DotacaoOrcamentaria);

            SCOOPDataSet.OrcamentoDataTable Dt = new OrcamentoTableAdapter().GetDataBy2(dataGridView1.Rows[Convert.ToInt32(bindingNavigatorPositionItem1.TextBox.Text) - 1].Cells[1].Value.ToString());

            foreach (SCOOPDataSet.OrcamentoRow linha in Dt)
            {
                CodigoOrcamento        = linha.Sequencial.ToString();
                MskTxtBoxCodigo.Text   = linha.Codigo;
                TxtBoxDescricao.Text   = linha.Descricao;
                MskTxtDataCriacao.Text = linha.Dt_criacao.ToShortDateString();
                TxtBoxLocal.Text       = linha.Logradouro;
                try { BairroComboBox.Text = linha.Bairro; }
                catch (Exception) { }
                try { DotacaoOrcamentariaComboBox.Text = new DotacaoOrcamentariaTableAdapter().ObterDescricaoDotacaoOrcamentaria(linha.DotacaoOrcamentaria); }
                catch (Exception ex) { }
                try{ tipoOrcamentoTableAdapter.FillBy1(this.sCOOPDataSet.TipoOrcamento, (int)DotacaoOrcamentariaComboBox.SelectedValue); }
                catch (Exception ex) { }
                try { TipoOrcamentoComboBox.Text = new TipoOrcamentoTableAdapter().ObterDescricaoTipoOrcamento(linha.TipoOrcamento); }
                catch (Exception) { }
                try { FiscalComboBox.Text = new FiscalizacaoTableAdapter().ObterDescricaoFiscalizacao(linha.Fiscal).ToString(); }
                catch (Exception ex) { }
                NumeroOrcamento    = linha.Codigo;
                CidadeTextBox.Text = linha.Cidade;
                try
                {
                    BDIComboBox.Text = linha.BDI.ToString();
                    BDI = linha.BDI.ToString();
                }
                catch (Exception ex)
                {
                    try
                    {
                        Total = new Orc_ServicoTableAdapter().TotalServicoPorOrcamento(MskTxtBoxCodigo.Text).Value.ToString();
                    }
                    catch (Exception)
                    { }
                }
            }
            this.orc_ServicoTableAdapter.FillBy1(this.sCOOPDataSet.Orc_Servico, NumeroOrcamento);
            preencherDataGridViewServico();
            BttAtualizar.Visible        = true;
            BttContrato.Visible         = false;
            BttCadastrarServico.Visible = false;
            groupBox1.Enabled           = true;
            GrupoBoxServicos.Enabled    = true;
            BDIComboBox.Text            = BDI;
            comboBox1_SelectedIndexChanged(null, null);
            tabControl1.SelectedTab = tabPage1;
        }
Esempio n. 2
0
        public void CarregarServicoOrc_ServicoParaOrc_Cont_Servico(string NumeroOrcamento)
        {
            SCOOPDataSet.Orc_ServicoDataTable Dt = new Orc_ServicoTableAdapter().GetDataBy3(NumeroOrcamento);

            try
            {
                int SequenciaOrcamentoContratado = (int)new Orcamento_ContratadoTableAdapter().ObterSequencialOrcamentoContratado((int)new OrcamentoTableAdapter().ObterSequencialOrcamento(MskTxtBoxCodigo.Text));
                foreach (SCOOPDataSet.Orc_ServicoRow linha in Dt)
                {
                    new Orc_Cont_ServicoTableAdapter().Insert(linha.Codigo_Servico, linha.Seq_Servico, MskTxtBoxCodigo.Text, SequenciaOrcamentoContratado, DateTime.Now, linha.Quantidade, linha.Valor, DateTime.Now, "Admin");
                }
                this.orc_Cont_ServicoTableAdapter.FillBy(this.sCOOPDataSet.Orc_Cont_Servico, MskTxtBoxCodigo.Text);
                PreencherTotalDataGridView();
                TxtBoxTotalOrçamento.Text = String.Format("{0:C2}", new Orc_Cont_ServicoTableAdapter().ObterTotalOrcamento(MskTxtBoxCodigo.Text));
                MessageBox.Show(null, "Seriço Carregado com Sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao Obter Serviços do Orçamento!", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }