protected void callbackControlSalvar_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            string param = "";
            if (e.Parameter != null)
            {
                param = e.Parameter.ToString();
            }

            float totalGrid = 0;

            if (GRIDITENSINSERIDOS.GetTotalSummaryValue(GRIDITENSINSERIDOS.TotalSummary["VALOR", DevExpress.Data.SummaryItemType.Sum]) == null)
            {
                totalGrid = 0;
            }
            else
            {
                totalGrid = float.Parse(GRIDITENSINSERIDOS.GetTotalSummaryValue(GRIDITENSINSERIDOS.TotalSummary["VALOR", DevExpress.Data.SummaryItemType.Sum]).ToString());
            }

            if (totalGrid != float.Parse(dxtxtValorDID.Value.ToString()) && totalGrid != 0)
            {
                e.Result = "ERROR:Valor dos Itens está diferente do valor do DID!!!";
            }
            else
            {
                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 (totalGrid == 0 && !string.IsNullOrEmpty(txtContrato.Text) && hdfReconhecimentoDivida.Get("RECONHECIMENTO").ToString().Equals("false"))
                                                {
                                                    e.Result = "ERROR:Informe os Itens do Contrato Indicado!!!";
                                                }
                                                else
                                                {
                                                    var centrocustoCtrl = new CentroDeCustoCtrl();
                                                    bool testeOCG = centrocustoCtrl.centroCustoTemOCG(Convert.ToInt16(cbbCentroCusto.Value));
                                                    if (ObjetivoComumDeGastoCtrl.VerificaValordeLicitacaobyCentroDeCusto(cbbCentroCusto.Value.ToString(), float.Parse(dxtxtValorDID.Text)) && string.IsNullOrEmpty(txtContrato.Text) && string.IsNullOrEmpty(param) && testeOCG)
                                                    {
                                                        e.Result = "ErroLicitacao";
                                                    }
                                                    else
                                                    {
                                                        string op = "";
                                                        if (Request.QueryString["op"] != null)
                                                        {
                                                            op = Request.QueryString["op"].ToString();
                                                        }

                                                        string teste = hdfDadosDotacao.Get("CONTROLASALDO").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 é maior do que o Saldo disponível !!!";
                                                                }
                                                                else
                                                                {
                                                                    e.Result = GravaDID();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (float.Parse(txtSaldo.Text) < float.Parse(dxtxtValorDID.Text))
                                                                {
                                                                    e.Result = "ERROR:Valor Solicitado é maior do que o Saldo disponível !!!";
                                                                }
                                                                else
                                                                {
                                                                    e.Result = GravaDID();
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            e.Result = GravaDID();
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        protected void pcEncaminhar_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            SituacaoCtrl controleSituacao = new SituacaoCtrl();
            CentroDeCustoCtrl controleCentroCusto = new CentroDeCustoCtrl();
            ObjetivoComumDeGastoCtrl controleObjetivo = new ObjetivoComumDeGastoCtrl();
            FluxoAssuntoCtrl controleFluxoAssunto = new FluxoAssuntoCtrl();

            //txtTeste.Text = GetSelectedRowValueRadioButton("ID", ASPxGridView2);
            //txtAssunto.Text = GetSelectedRowValueRadioButton("DESCRICAO", ASPxGridView2);
            //txtExercicio.Text = GetSelectedRowValueRadioButton("EXERCICIO", ASPxGridView2);

            List<object> dadosGrid = GetSelectRowValueRadioNovo("ID", "DESCRICAO", "EXERCICIO", "VALORDID", "TRAMITEID", ASPxGridView2);

            string valorDID = string.Empty;

            foreach (List<object> obj in dadosGrid)
            {
                txtTeste.Text = obj[0].ToString();
                txtAssunto.Text = obj[1].ToString();
                txtExercicio.Text = obj[2].ToString();
                valorDID = obj[3].ToString();
                txtTramiteID.Text = obj[4].ToString();
            }

            var ctrlTramite = new TramiteCtrl();
            txtTramiteIDBancoDados.Text = ctrlTramite.RetornaUltimoTramite(txtTeste.Text).ToString();

            Session.Remove("IDPROCESSO");
            Session.Add("IDPROCESSO", txtTeste.Text);

            string centroCusto = controleCentroCusto.getCentroCustoByProcessoNumero(int.Parse(txtTeste.Text)).ToString();
            txtCentroCusto.Text = centroCusto;

            cbbSituacao.DataSourceID = string.Empty;
            cbbSituacao.DataSource = controleSituacao.getSituacaoByPerfilAssuntoFluxo(txtAssunto.Text, txtTeste.Text, centroCusto);
            cbbSituacao.DataBind();
            if (cbbSituacao.Items.Count == 1)
            {
                cbbSituacao.SelectedIndex = 0;
            }

            ObjectDataSource3.SelectParameters["centroCusto"].DefaultValue = centroCusto;
            ObjectDataSource3.DataBind();
            gridDID.DataBind();
            //string valorDID = GetSelectedRowValueRadioButton("VALORDID", ASPxGridView2);

            ASPxTextBox1.Text = controleObjetivo.testeTelaOGC(controleFluxoAssunto.getFluxoAtual(txtTeste.Text), centroCusto);

            controleSituacao = null;
            controleCentroCusto = null;
            controleObjetivo = null;
            controleFluxoAssunto = null;
            GC.Collect();
        }