Exemplo n.º 1
0
            public Tuple<WEBDID, string[]> recuperaDadosDID(string idDID)
            {
                var did = new WEBDID();

                string[] retorno = new string[54];

                var conn = Persist.GetConn.getConn();

                var comando = new FbCommand("sp_flx_getdidedicao", conn);
                comando.CommandType = System.Data.CommandType.StoredProcedure;

                comando.Parameters.Add("@ID_DID", FbDbType.Integer).Value = idDID;
                comando.Parameters.Add("@ID", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@CONTRATO", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@DATA", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@HISTORICO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@PROCESSOAQUISICAO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@VALOR", FbDbType.Numeric).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@IDCENTROCUSTO", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@IDMODALIDADEEMPENHO", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@IDFORNECEDOR", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@IDTIPOAQUISICAO", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@IDORIGEMRECURSO", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@DIDUNIDADE", FbDbType.Char).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@NUMERO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@DIDORGAO", FbDbType.Char).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@UNDNOME", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@PESNOME", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@CENNOME", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@PESCOD", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pesendereco", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pesbairro", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pescidade", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pesuf", FbDbType.Char).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pescep", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pestelefone", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pesemail", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@MODALIDADEEMPENHO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@PREFEITURA", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@logo", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@CNPJCPF", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@responsavel", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@ORDENADOR", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@TIPOPESSOA", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@dotacao", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@PA", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@Prjnome", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@DOTELEMENTO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@NATNOME", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@UNDFUNCIONAL", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@funcodigo", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@Funnome", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@subcodigo", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@subnome", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@Procodigo", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@pronome", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@undunificado", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@idassunto", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@exercicio", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@RestoPagar", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@LICNUMERO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@CTRNUMERO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@LICCOD", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@LICMODALIDADE", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@CONTROLEPORUO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;

                using (conn)
                {
                    conn.Open();
                    try
                    {
                        comando.ExecuteNonQuery();

                        retorno[0]  = comando.Parameters[1].Value.ToString();
                        retorno[1]  = comando.Parameters[2].Value.ToString();
                        retorno[2]  = comando.Parameters[3].Value.ToString();
                        retorno[3]  = comando.Parameters[4].Value.ToString();
                        retorno[4]  = comando.Parameters[5].Value.ToString();
                        retorno[5]  = comando.Parameters[6].Value.ToString();
                        retorno[6]  = comando.Parameters[7].Value.ToString();
                        retorno[7]  = comando.Parameters[8].Value.ToString();
                        retorno[8]  = comando.Parameters[9].Value.ToString();
                        retorno[9]  = comando.Parameters[10].Value.ToString();
                        retorno[10] = comando.Parameters[11].Value.ToString();
                        retorno[11] = comando.Parameters[12].Value.ToString();
                        retorno[12] = comando.Parameters[13].Value.ToString();
                        retorno[13] = comando.Parameters[14].Value.ToString();
                        retorno[14] = comando.Parameters[15].Value.ToString();
                        retorno[15] = comando.Parameters[16].Value.ToString();
                        retorno[16] = comando.Parameters[17].Value.ToString();
                        retorno[17] = comando.Parameters[18].Value.ToString();
                        retorno[18] = comando.Parameters[19].Value.ToString();
                        retorno[19] = comando.Parameters[20].Value.ToString();
                        retorno[20] = comando.Parameters[21].Value.ToString();
                        retorno[21] = comando.Parameters[22].Value.ToString();
                        retorno[22] = comando.Parameters[23].Value.ToString();
                        retorno[23] = comando.Parameters[24].Value.ToString();
                        retorno[24] = comando.Parameters[25].Value.ToString();
                        retorno[25] = comando.Parameters[26].Value.ToString();
                        retorno[26] = comando.Parameters[27].Value.ToString();
                        retorno[27] = comando.Parameters[28].Value.ToString();
                        retorno[28] = comando.Parameters[29].Value.ToString();
                        retorno[29] = comando.Parameters[30].Value.ToString();
                        retorno[30] = comando.Parameters[31].Value.ToString();
                        retorno[31] = comando.Parameters[32].Value.ToString();
                        retorno[32] = comando.Parameters[33].Value.ToString();
                        retorno[33] = comando.Parameters[34].Value.ToString();
                        retorno[34] = comando.Parameters[35].Value.ToString();
                        retorno[35] = comando.Parameters[36].Value.ToString();
                        retorno[36] = comando.Parameters[37].Value.ToString();
                        retorno[37] = comando.Parameters[38].Value.ToString();
                        retorno[38] = comando.Parameters[39].Value.ToString();
                        retorno[39] = comando.Parameters[40].Value.ToString();
                        retorno[40] = comando.Parameters[41].Value.ToString();
                        retorno[41] = comando.Parameters[42].Value.ToString();
                        retorno[42] = comando.Parameters[43].Value.ToString();
                        retorno[43] = comando.Parameters[44].Value.ToString();
                        retorno[44] = comando.Parameters[45].Value.ToString();
                        retorno[45] = comando.Parameters[46].Value.ToString();
                        retorno[46] = comando.Parameters[47].Value.ToString();
                        retorno[47] = comando.Parameters[48].Value.ToString();
                        retorno[48] = comando.Parameters[49].Value.ToString();
                        retorno[49] = comando.Parameters[50].Value.ToString();
                        retorno[50] = comando.Parameters[51].Value.ToString();
                        retorno[51] = comando.Parameters[52].Value.ToString();
                        retorno[52] = comando.Parameters[53].Value.ToString();

                    }
                    catch(Exception ex){
                        retorno[53] = ex.Message.ToString();
                    }

                    comando = new FbCommand("select * from webitemdid i where i.coddid =" + retorno[0], conn);
                    FbDataAdapter dta = new FbDataAdapter(comando);
                    dta.Fill(did.listItensDID);

                    comando = new FbCommand("select * from weborigemrecursodid ori join fonterecurso fr on fr.foncod = ori.SEQ where ori.iddid =" + retorno[0], conn);
                    FbDataAdapter dta2 = new FbDataAdapter(comando);
                    dta2.Fill(did.listOrigensRecurso);
                }

                return new Tuple<WEBDID,string[]>(did,retorno);
            }
Exemplo n.º 2
0
        protected void callbackGravaCabecaDID_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            WEBDID did = new WEBDID();
            WEBDID.Dados dados = new WEBDID.Dados();
            string[] retorno = new string[3];

            if (string.IsNullOrEmpty(txtProcessoID.Text)) {
                txtProcessoID.Text = "0";
            }

            ConfigurationManager.AppSettings["PrefeituraUsaDotacao"].ToString().ToUpper();

            if (string.IsNullOrEmpty(txtProcessoID.Text))
            {
                did._NUMERO = string.Empty;
            }
            else
            {
                did._NUMERO = txtProcessoID.Text;
            }

            if (cbbUndOrcamentaria.Value == null)
            {
                e.Result = "ERROR:Informe a Unidade Orçamentária !!!";
            }
            else
            {
                if (cbbCentroCusto.Value == null)
                {
                    e.Result = "ERROR:Informe o Centro de Custo !!!";
                }
                else
                {
                    if (txtDataDID.Value == null)
                    {
                        e.Result = "ERROR:Informe a Data !!!";
                    }
                    else
                    {
                        if (dxtxtValorDID.Value.ToString() == "0,00")
                        {
                            e.Result = "ERROR:Informe o Valor do DID!!!";
                        }
                        else
                        {
                            if (txtFornecedorNome.Value == null)
                            {
                                e.Result = "ERROR:Informe o Fornecedor !!!";
                            }
                            else
                            {
                                if (cbbModalidadeEmpenho.Value == null)
                                {
                                    e.Result = "ERROR:Modalidade de Empenho não informada !!!";
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(ASPxMemo1.Text))
                                    {
                                        e.Result = "ERROR:Informe a especificação do histórico !!!";
                                    }
                                    else
                                    {
                                        if (txtDotacao.Value == null)
                                        {
                                            e.Result = "ERROR:Informe a Dotação !!!";
                                        }
                                        else
                                        {
                                            if (cbbModalidadeEmpenho.Value == null)
                                            {
                                                e.Result = "ERROR:Informe a Modalidade de Empenho !!!";
                                            }
                                            else
                                            {
                                                if (string.IsNullOrEmpty(hdfDadosDotacao.Get("FONCOD").ToString()))
                                                {
                                                    e.Result = "ERROR:Por algum motivo não encontramos a Fonte de Recurso indicada no DID. Por favor selecione novamente a Dotação desejada com suas respectiva Fonte de Recurso !!!";
                                                }
                                                else
                                                {
                                                    string op = "";
                                                    if (Request.QueryString["op"] != null)
                                                    {
                                                        op = Request.QueryString["op"].ToString();
                                                    }

                                                    if (hdfDadosDotacao.Get("CONTROLASALDO").ToString() == "1")
                                                    {
                                                        if (op.Equals("edt"))
                                                        {
                                                            var saldoDID = float.Parse(Session[SessionTotalDID].ToString()) + CarregaSaldoDID();
                                                            var valorDID = float.Parse(dxtxtValorDID.Text);
                                                            if ((float)saldoDID < (float)valorDID)
                                                            {
                                                                e.Result = "ERROR:Valor Solicitado (" + valorDID.ToString("C") + ") é maior do que o Saldo disponível (" + saldoDID.ToString("C") + ") para este Centro de Custo e Fonte de Recurso!!!";
                                                            }
                                                            else
                                                            {
                                                                did.id = Convert.ToInt32(txtProcessoID.Text);
                                                                did.contrato = txtContrato.Text;
                                                                did.data = txtDataDID.Date.ToShortDateString().Replace("/", ".");
                                                                did.historico = ASPxMemo1.Text;

                                                                did.processoAquisicao = "Contrato: " + hdfContratosInfo.Get("NUMEROCONTRATO").ToString() + " - Licitação: " + hdfContratosInfo.Get("NUMEROLICITACAO").ToString();

                                                                did.valor = Double.Parse(dxtxtValorDID.Text);
                                                                did.idCentroCusto = int.Parse(cbbCentroCusto.Value.ToString());
                                                                did.idModalidadeEmpenho = int.Parse(cbbModalidadeEmpenho.Value.ToString());
                                                                did.idFornecedor = int.Parse(hfdDadosFornecedor.Get("PESCOD").ToString());
                                                                did.idTipoAquisicao = hdfContratosInfo.Get("IDMODALIDADE").ToString();
                                                                did.didUnidade = cbbUndOrcamentaria.Value.ToString().Substring(2, 2);
                                                                did.didOrgao = cbbUndOrcamentaria.Value.ToString().Substring(0, 2);
                                                                did.Dotacao = txtDotacao.Text;
                                                                did.CTRCOD = txtContrato.Text;
                                                                did.USUARIOENVIO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
                                                                did.USUARIODESTINO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
                                                                did.UNDFUNC_ENVIO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
                                                                did.UNDFUNC_DESTINO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
                                                                did.FONCOD = hdfDadosDotacao.Get("FONCOD").ToString();
                                                                did.FONNOME = hdfDadosDotacao.Get("FONNOME").ToString();

                                                                retorno = dados.gravaCabecaDID(did);
                                                                e.Result = retorno[2] + "#" + retorno[1] + "#" + retorno[0]; ;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (float.Parse(txtSaldo.Text) < float.Parse(dxtxtValorDID.Text))
                                                            {
                                                                var saldoDID = float.Parse(txtSaldo.Text);
                                                                var valorDID = float.Parse(dxtxtValorDID.Text);

                                                                e.Result = "ERROR:Valor Solicitado (" + valorDID.ToString("C") + ") é maior do que o Saldo disponível (" + saldoDID.ToString("C") + ") para este Centro de Custo e Fonte de Recurso!!!";
                                                            }
                                                            else
                                                            {
                                                                did.id = Convert.ToInt32(txtProcessoID.Text);
                                                                did.contrato = txtContrato.Text;
                                                                did.data = txtDataDID.Date.ToShortDateString().Replace("/", ".");
                                                                did.historico = ASPxMemo1.Text;

                                                                did.processoAquisicao = "Contrato: " + hdfContratosInfo.Get("NUMEROCONTRATO").ToString() + " - Licitação: " + hdfContratosInfo.Get("NUMEROLICITACAO").ToString();

                                                                did.valor = Double.Parse(dxtxtValorDID.Text);
                                                                did.idCentroCusto = int.Parse(cbbCentroCusto.Value.ToString());
                                                                did.idModalidadeEmpenho = int.Parse(cbbModalidadeEmpenho.Value.ToString());
                                                                did.idFornecedor = int.Parse(hfdDadosFornecedor.Get("PESCOD").ToString());
                                                                did.idTipoAquisicao = hdfContratosInfo.Get("IDMODALIDADE").ToString();
                                                                did.didUnidade = cbbUndOrcamentaria.Value.ToString().Substring(2, 2);
                                                                did.didOrgao = cbbUndOrcamentaria.Value.ToString().Substring(0, 2);
                                                                did.Dotacao = txtDotacao.Text;
                                                                did.CTRCOD = txtContrato.Text;
                                                                did.USUARIOENVIO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
                                                                did.USUARIODESTINO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
                                                                did.UNDFUNC_ENVIO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
                                                                did.UNDFUNC_DESTINO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
                                                                did.FONCOD = hdfDadosDotacao.Get("FONCOD").ToString();
                                                                did.FONNOME = hdfDadosDotacao.Get("FONNOME").ToString();

                                                                retorno = dados.gravaCabecaDID(did);
                                                                e.Result = retorno[2] + "#" + retorno[1] + "#" + retorno[0];

                                                                string teste = string.Empty;
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        did.id = Convert.ToInt32(txtProcessoID.Text);
                                                        did.contrato = txtContrato.Text;
                                                        did.data = txtDataDID.Date.ToShortDateString().Replace("/", ".");
                                                        did.historico = ASPxMemo1.Text;

                                                        did.processoAquisicao = "Contrato: " + hdfContratosInfo.Get("NUMEROCONTRATO").ToString() + " - Licitação: " + hdfContratosInfo.Get("NUMEROLICITACAO").ToString();

                                                        did.valor = Double.Parse(dxtxtValorDID.Text);
                                                        did.idCentroCusto = int.Parse(cbbCentroCusto.Value.ToString());
                                                        did.idModalidadeEmpenho = int.Parse(cbbModalidadeEmpenho.Value.ToString());
                                                        did.idFornecedor = int.Parse(hfdDadosFornecedor.Get("PESCOD").ToString());
                                                        did.idTipoAquisicao = hdfContratosInfo.Get("IDMODALIDADE").ToString();
                                                        did.didUnidade = cbbUndOrcamentaria.Value.ToString().Substring(2, 2);
                                                        did.didOrgao = cbbUndOrcamentaria.Value.ToString().Substring(0, 2);
                                                        did.Dotacao = txtDotacao.Text;
                                                        did.CTRCOD = txtContrato.Text;
                                                        did.USUARIOENVIO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
                                                        did.USUARIODESTINO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
                                                        did.UNDFUNC_ENVIO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
                                                        did.UNDFUNC_DESTINO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
                                                        did.FONCOD = hdfDadosDotacao.Get("FONCOD").ToString();
                                                        did.FONNOME = hdfDadosDotacao.Get("FONNOME").ToString();
                                                        retorno = dados.gravaCabecaDID(did);
                                                        e.Result = retorno[2] + "#" + retorno[1] + "#" + retorno[0];
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
            public string[] gravaCabecaDID(WEBDID did)
            {
                //retorno[0] = Mensagem;
                //retorno[1] = Numero do processo;
                //retorno[2] = ID da Tabela WEBDID;

                string[] retorno = new string[3];

                FbConnection conn = Persist.GetConn.getConn();

                FbCommand comando = new FbCommand("SP_FLX_GRAVACABECADID", conn);
                comando.CommandType = System.Data.CommandType.StoredProcedure;

                //comando.Parameters.Add("@ID", FbDbType.Integer).Value = did.id;

                if (string.IsNullOrEmpty(did.contrato))
                {
                    comando.Parameters.Add("@CONTRATO", FbDbType.Integer).Value = DBNull.Value;
                }
                else
                {
                    comando.Parameters.Add("@CONTRATO", FbDbType.Integer).Value = did.contrato;
                }
                comando.Parameters.Add("@DATA", FbDbType.VarChar).Value = did.data;
                comando.Parameters.Add("@HISTORICO", FbDbType.VarChar).Value = did.historico;
                comando.Parameters.Add("@PROCESSOAQUISICAO", FbDbType.VarChar).Value = did.processoAquisicao;
                comando.Parameters.Add("@VALOR", FbDbType.Decimal).Value = did.valor;
                comando.Parameters.Add("@IDCENTROCUSTO", FbDbType.Integer).Value = did.idCentroCusto;
                comando.Parameters.Add("@IDMODALIDADEEMPENHO", FbDbType.Integer).Value = did.idModalidadeEmpenho;
                comando.Parameters.Add("@IDFORNECEDOR", FbDbType.Integer).Value = did.idFornecedor;
                if (string.IsNullOrEmpty(did.contrato))
                {
                    comando.Parameters.Add("@IDTIPOAQUISICAO", FbDbType.Integer).Value = 0;
                }
                else {
                    comando.Parameters.Add("@IDTIPOAQUISICAO", FbDbType.Integer).Value = did.idTipoAquisicao;
                }
                comando.Parameters.Add("@DIDUNIDADE", FbDbType.Char).Value = did.didUnidade;
                comando.Parameters.Add("@DIDORGAO", FbDbType.Char).Value = did.didOrgao;
                comando.Parameters.Add("@DOTACAO", FbDbType.Integer).Value = did.Dotacao;

                if (string.IsNullOrEmpty(did.CTRCOD))
                {
                    comando.Parameters.Add("@CTRCOD", FbDbType.VarChar).Value = DBNull.Value;
                }
                else {
                    comando.Parameters.Add("@CTRCOD", FbDbType.VarChar).Value = did.CTRCOD;
                }
                comando.Parameters.Add("@USUARIOENVIO", FbDbType.Integer).Value = did.USUARIOENVIO;
                comando.Parameters.Add("@USUARIODESTINO", FbDbType.Integer).Value = did.USUARIODESTINO;
                comando.Parameters.Add("@UNDFUNC_ENVIO", FbDbType.Integer).Value = did.UNDFUNC_ENVIO;
                comando.Parameters.Add("@UNDFUNC_DESTINO", FbDbType.Integer).Value = did.UNDFUNC_DESTINO;
                comando.Parameters.Add("@FONCOD", FbDbType.VarChar).Value = did.FONCOD;
                comando.Parameters.Add("@FONNOME", FbDbType.VarChar).Value = did.FONNOME;
                comando.Parameters.Add("@PROC_NUMERO_IN", FbDbType.VarChar).Value = did._NUMERO; //Parametro pode vir vazio.

                comando.Parameters.Add("@DID_ID", FbDbType.Integer).Direction = System.Data.ParameterDirection.Output;
                comando.Parameters.Add("@PROC_NUMERO", FbDbType.VarChar).Direction = System.Data.ParameterDirection.Output;

                try
                {
                    conn.Open();
                    comando.ExecuteNonQuery();
                    retorno[0] = "Dados de Contrato e Dotação do DID " + comando.Parameters[21].Value.ToString() +" foram gravados com sucesso !!!";
                    retorno[1] = comando.Parameters[21].Value.ToString();
                    retorno[2] = comando.Parameters[20].Value.ToString();

                }
                catch (Exception ex)
                {
                    retorno[0] = ex.Message;
                }
                finally
                {
                    comando.Dispose();
                    conn.Close();
                    conn.Dispose();
                    conn = null;
                }

                return retorno;
            }
Exemplo n.º 4
0
        public string GravaDID()
        {
            #region GravaCabecaDID

            WEBDID did = new WEBDID();
            WEBDID.Dados dados = new WEBDID.Dados();
            string[] retorno = new string[3];

            if (string.IsNullOrEmpty(txtProcessoID.Text))
            {
                txtProcessoID.Text = "0";
            }

            ConfigurationManager.AppSettings["PrefeituraUsaDotacao"].ToString().ToUpper();

            did.id = Convert.ToInt32(txtProcessoID.Text);
            did.contrato = txtContrato.Text;
            did.data = txtDataDID.Date.ToShortDateString().Replace("/", ".");
            did.historico = ASPxMemo1.Text;

            did.processoAquisicao = "Contrato: " + hdfContratosInfo.Get("NUMEROCONTRATO").ToString() + " - Licitação: " + hdfContratosInfo.Get("NUMEROLICITACAO").ToString();

            did.valor = Double.Parse(dxtxtValorDID.Text);
            did.idCentroCusto = int.Parse(cbbCentroCusto.Value.ToString());
            did.idModalidadeEmpenho = int.Parse(cbbModalidadeEmpenho.Value.ToString());
            did.idFornecedor = int.Parse(hfdDadosFornecedor.Get("PESCOD").ToString());
            did.idTipoAquisicao = hdfContratosInfo.Get("IDMODALIDADE").ToString();
            did.didUnidade = cbbUndOrcamentaria.Value.ToString().Substring(2, 2);
            did.didOrgao = cbbUndOrcamentaria.Value.ToString().Substring(0, 2);
            did.Dotacao = txtDotacao.Text;
            did.CTRCOD = txtContrato.Text;
            did.USUARIOENVIO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
            did.USUARIODESTINO = int.Parse(hdfInfoUsuario.Get("IDUSUARIO").ToString());
            did.UNDFUNC_ENVIO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
            did.UNDFUNC_DESTINO = int.Parse(hdfInfoUsuario.Get("IDUNDFUNCIONAL").ToString());
            did.FONCOD = hdfDadosDotacao.Get("FONCOD").ToString();
            did.FONNOME = hdfDadosDotacao.Get("FONNOME").ToString();
            if (string.IsNullOrEmpty(txtProcessoID.Text))
            {
                did._NUMERO = string.Empty;
            }
            else
            {
                did._NUMERO = txtProcessoID.Text;
            }

            retorno = dados.gravaCabecaDID(did);

            #endregion

            #region Finaliza e Tramita DID CX Analise
            string retorno2 = string.Empty;

            var webdid = new WEBDID.Dados();

            retorno2 = webdid.gravaDID(retorno[1])[0];

            return retorno2;
            #endregion
        }