protected void SqlDataSource2_Init(object sender, EventArgs e) { if (!IsCallback) { Control.UsuariosControle ctrlUsu = new Control.UsuariosControle(); string idUsu = ctrlUsu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString(); string idUndFunc = Control.UndFuncionalCtrl.getUndFuncByUsuID(idUsu).ToString(); string undOrc = Control.UnidadeOrcamentariaCtrl.GetUnidadeOrcamentriaByUnidadeFuncional(idUndFunc).undUnificado; Control.PerfilCtrl perfil = new Control.PerfilCtrl(); bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(idUsu); perfil = null; if (!perfilConsultaGeral) { SqlDataSource2.SelectCommand = "select undunificado, undnome from unidadeorcamentaria where " + "undunificado IN ( " + " SELECT UO.undunificado " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " WHERE " + " uog.uogunidadegestora = " + " (SELECT UOG.uogunidadegestora " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " where uo.undunificado = '" + undOrc + "' " + " ) " + ") "; } else { SqlDataSource2.SelectCommand = "select undunificado, undnome from unidadeorcamentaria "; } SqlDataSource2.DataBind(); } }
protected XPDataView AtualizarGrid() { Control.UsuariosControle ctrlUsu = new Control.UsuariosControle(); string dataCadINI = ""; string dataCadFIM = ""; string envolvido = ""; string procNum = ""; string undorca = ""; string situacao = ""; string usuarioEnvio = ""; string assunto = ""; string usuarioDefault = ctrlUsu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString(); Control.PerfilCtrl perfil = new Control.PerfilCtrl(); bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(usuarioDefault); perfil = null; string sqlTable = "select " + "id," + "NUMERO," + "datahoracadastro," + "responsavel," + "nome," + "ENVID," + "descricao," + "UNDABREV ," + "unidfuncnome," + "undunificado," + "usuarioenvio," + "Cast(valor as numeric(15,2)) valor," + "cast(VAL_LIQUIDADO as numeric(15,2)) VAL_LIQUIDADO," + "CENNOME," + "SITUACAO_ATUAL " + "from CONSULTA_PROCESSOS "; if (dtCadastroIni.Value != null) { dataCadINI = "'" + DateTime.Parse(dtCadastroIni.Value.ToString()).ToShortDateString().Replace("/", ".") + "' "; } else { dataCadINI = "DATAHORACADASTRO"; } if (dtCadastroFim.Value != null) { dataCadFIM = "'" + DateTime.Parse(dtCadastroFim.Value.ToString()).ToShortDateString().Replace("/", ".") + "' "; } else { dataCadFIM = "DATAHORACADASTRO"; } if (cbbEnvolvido.Value != null) { envolvido = cbbEnvolvido.Value.ToString(); } else { envolvido = "ENVID "; } if (txtNumProcesso.Value != null) { procNum = " like '" + txtNumProcesso.Value.ToString() + "%'"; } else { procNum = " = NUMERO "; } if (cbbUndOrc.Value != null) { undorca = "= '" + cbbUndOrc.Value.ToString() + "' "; } else { if (!perfilConsultaGeral) { string idUndFunc = Control.UndFuncionalCtrl.getUndFuncByUsuID(usuarioDefault).ToString(); string undOrcCad = Control.UnidadeOrcamentariaCtrl.GetUnidadeOrcamentriaByUnidadeFuncional(idUndFunc).undUnificado; undorca = "in ( SELECT UO.undunificado " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " WHERE " + " uog.uogunidadegestora = " + " (SELECT UOG.uogunidadegestora " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " where uo.undunificado = '" + undOrcCad + "' " + " ) ) "; } else { undorca = "= UNDUNIFICADO "; } } if (cbbAssunto.Value != null) { assunto = cbbAssunto.Value.ToString() ; } else { assunto = "ASSID "; } string idSituacao = string.Empty; if (cbbSituacao.Value != null) { situacao = cbbSituacao.Value.ToString(); } //usuarioEnvio = "USUARIOENVIO"; sqlTable += " WHERE "; sqlTable += " ("; sqlTable += " (DATAHORACADASTRO >= " + dataCadINI + ") "; sqlTable += " AND "; sqlTable += " (DATAHORACADASTRO <= " + dataCadFIM + ")"; sqlTable += " ) "; sqlTable += " AND "; sqlTable += " ENVID = " + envolvido; sqlTable += " AND "; sqlTable += " NUMERO " + procNum; sqlTable += " AND "; //sqlTable += " UNDUNIFICADO = " + undorca; sqlTable += " UNDUNIFICADO " + undorca; if(cbbSituacao.Value != null){ //sqlTable += "and (" + situacao + " in (Select idSituacaoProjeto from webtramite where idProcesso = proc.ID)) "; sqlTable += "and SITID in (Select sit.id from webgruposituacoes gsit join websituacaoprocesso sit on sit.id_gruposituacao = gsit.id where gsit.id = " + cbbSituacao.Value + ")"; } //sqlTable += " AND "; //sqlTable += "USUARIOENVIO = " + usuarioEnvio; sqlTable += " AND ASSID = "+ assunto; sqlTable += "AND ((EXCLUIR IS NULL AND EXERCICIO <> (SELECT FIRST 1 ENTEXERCICIO FROM ENTIDADE)) "; sqlTable += "OR "; sqlTable += "(EXERCICIO = (SELECT FIRST 1 ENTEXERCICIO FROM ENTIDADE)))"; DevExpress.Xpo.Session xpoSession = new DevExpress.Xpo.Session(); XpoDataSource1.Session = xpoSession; //string connTeste = AcessoDados.AcessoDados.GetConnectionStringXPO(); XpoDataSource1.Session.Connection = Persist.GetConn.getConn(); SelectedData resultSet = xpoSession.ExecuteQuery(sqlTable); XPDataView dv = new XPDataView(); dv.AddProperty("ID", typeof(int)); dv.AddProperty("NUMERO", typeof(string)); dv.AddProperty("DATAHORACADASTRO", typeof(DateTime)); dv.AddProperty("RESPONSAVEL", typeof(string)); dv.AddProperty("NOME", typeof(string)); dv.AddProperty("ENVID", typeof(int)); dv.AddProperty("DESCRICAO", typeof(string)); dv.AddProperty("UNDABREV", typeof(string)); dv.AddProperty("UNIDFUNCNOME", typeof(string)); dv.AddProperty("UNDUNIFICADO", typeof(int)); dv.AddProperty("USUARIOENVIO", typeof(int)); dv.AddProperty("VALOR", typeof(decimal)); dv.AddProperty("VAL_LIQUIDADO", typeof(decimal)); dv.AddProperty("CENNOME", typeof(string)); dv.AddProperty("SITUACAO_ATUAL", typeof(string)); dv.LoadData(resultSet); ASPxGridView1.DataSource = dv; Session["DTable"] = dv; ASPxGridView1.DataBind(); return dv; }
protected XPDataView AtualizarGrid() { UsuariosControle ctrlUsu = new Control.UsuariosControle(); string usuarioDefault = ctrlUsu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString(); PerfilCtrl perfil = new Control.PerfilCtrl(); bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(usuarioDefault); perfil = null; string centrocusto = string.Empty; string undorca = string.Empty; string sqlTable = "select distinct " + "CENCOD,"+ "CENNOME,"+ "FONCOD,"+ "FONNOME,"+ "UNDUNIFICADO,"+ "UNDNOME,"+ "CCCMESES,"+ "DESPJAN,"+ "DESPFEV,"+ "DESPMAR,"+ "DESPABR,"+ "DESPMAI,"+ "DESPJUN,"+ "DESPJUL,"+ "DESPAGO,"+ "DESPSET,"+ "DESPOUT,"+ "DESPNOV,"+ "DESPDEZ,"+ "DIDJAN,"+ "DIDFEV,"+ "DIDMAR,"+ "DIDABR,"+ "DIDMAI,"+ "DIDJUN,"+ "DIDJUL,"+ "DIDAGO,"+ "DIDSET,"+ "DIDOUT,"+ "DIDNOV,"+ "DIDDEZ,"+ "SALDOJAN,"+ "SALDOFEV,"+ "SALDOMAR,"+ "SALDOABR,"+ "SALDOMAI,"+ "SALDOJUN,"+ "SALDOJUL,"+ "SALDOAGO,"+ "SALDOSET,"+ "SALDOOUT,"+ "SALDONOV,"+ "SALDODEZ " + "from VW_FLX_REL_EXT_CENCUSTO_GRID "; if (cbbCentroCusto.Value != null) { centrocusto = cbbCentroCusto.Value.ToString(); } else { centrocusto = "CENCOD "; } if (cbbUndOrc.Value != null) { undorca = "= '" + cbbUndOrc.Value.ToString() + "' "; } else { if (!perfilConsultaGeral) { string idUndFunc = Control.UndFuncionalCtrl.getUndFuncByUsuID(usuarioDefault).ToString(); string undOrcCad = Control.UnidadeOrcamentariaCtrl.GetUnidadeOrcamentriaByUnidadeFuncional(idUndFunc).undUnificado; undorca = "in ( SELECT UO.undunificado " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " WHERE " + " uog.uogunidadegestora = " + " (SELECT UOG.uogunidadegestora " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " where uo.undunificado = '" + undOrcCad + "' " + " ) ) "; } else { undorca = "= UNDUNIFICADO "; } } ////usuarioEnvio = "USUARIOENVIO"; sqlTable += " WHERE "; sqlTable += " CENCOD = " + centrocusto; sqlTable += " AND "; sqlTable += " UNDUNIFICADO " + undorca; DevExpress.Xpo.Session xpoSession = new DevExpress.Xpo.Session(); XpoDataSource1.Session = xpoSession; XpoDataSource1.Session.Connection = Persist.GetConn.getConn(); SelectedData resultSet = xpoSession.ExecuteQuery(sqlTable); XPDataView dv = new XPDataView(); dv.AddProperty("CENCOD", typeof(int)); dv.AddProperty("CENNOME", typeof(string)); dv.AddProperty("FONCOD", typeof(int)); dv.AddProperty("FONNOME", typeof(string)); dv.AddProperty("UNDUNIFICADO", typeof(string)); dv.AddProperty("UNDNOME", typeof(string)); dv.AddProperty("CCCMESES", typeof(decimal)); dv.AddProperty("DESPJAN", typeof(decimal)); dv.AddProperty("DESPFEV", typeof(decimal)); dv.AddProperty("DESPMAR", typeof(decimal)); dv.AddProperty("DESPABR", typeof(decimal)); dv.AddProperty("DESPMAI", typeof(decimal)); dv.AddProperty("DESPJUN", typeof(decimal)); dv.AddProperty("DESPJUL", typeof(decimal)); dv.AddProperty("DESPAGO", typeof(decimal)); dv.AddProperty("DESPSET", typeof(decimal)); dv.AddProperty("DESPOUT", typeof(decimal)); dv.AddProperty("DESPNOV", typeof(decimal)); dv.AddProperty("DESPDEZ", typeof(decimal)); dv.AddProperty("DIDJAN", typeof(decimal)); dv.AddProperty("DIDFEV", typeof(decimal)); dv.AddProperty("DIDMAR", typeof(decimal)); dv.AddProperty("DIDABR", typeof(decimal)); dv.AddProperty("DIDMAI", typeof(decimal)); dv.AddProperty("DIDJUN", typeof(decimal)); dv.AddProperty("DIDJUL", typeof(decimal)); dv.AddProperty("DIDAGO", typeof(decimal)); dv.AddProperty("DIDSET", typeof(decimal)); dv.AddProperty("DIDOUT", typeof(decimal)); dv.AddProperty("DIDNOV", typeof(decimal)); dv.AddProperty("DIDDEZ", typeof(decimal)); dv.AddProperty("SALDOJAN", typeof(decimal)); dv.AddProperty("SALDOFEV", typeof(decimal)); dv.AddProperty("SALDOMAR", typeof(decimal)); dv.AddProperty("SALDOABR", typeof(decimal)); dv.AddProperty("SALDOMAI", typeof(decimal)); dv.AddProperty("SALDOJUN", typeof(decimal)); dv.AddProperty("SALDOJUL", typeof(decimal)); dv.AddProperty("SALDOAGO", typeof(decimal)); dv.AddProperty("SALDOSET", typeof(decimal)); dv.AddProperty("SALDOOUT", typeof(decimal)); dv.AddProperty("SALDONOV", typeof(decimal)); dv.AddProperty("SALDODEZ", typeof(decimal)); dv.LoadData(resultSet); ASPxGridView1.DataSource = dv; Session["DTable"] = dv; ASPxGridView1.DataBind(); return dv; }
protected void SqlDataSource1_Init(object sender, EventArgs e) { string idUsu = ""; string idUndFunc = ""; string undOrc = ""; Control.UsuariosControle ctrlUsu = new UsuariosControle(); var usuarioCtrl = new UsuariosControle(); var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo(); idUsu = usuarioInfo.Item2; idUndFunc = usuarioInfo.Item3; undOrc = usuarioInfo.Item4; bool parametro = Control.Configuracoes.Dados.getParametroGradeDIDComplementar(); Control.PerfilCtrl perfil = new Control.PerfilCtrl(); bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(idUsu); string sql = "select undunificado, undnome from unidadeorcamentaria UO where "; if (!perfilConsultaGeral) { //if (!parametro) //{ // sql += "uo.undunificado in (SELECT UO.undunificado " + // " FROM unidadeorcamentaria UO " + // " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + // " WHERE " + // " uog.uogunidadegestora = " + // " (SELECT UOG.uogunidadegestora " + // " FROM unidadeorcamentaria UO " + // " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + // " where uo.undunificado = '" + undOrc + "' " + // " ) " + // ")"; //} //else //{ sql += "uo.undunificado in (select UNDUNIFICADO from SCI_USUARIOS_UNDORC where usu_codigo = " + idUsu + " )"; //} } else { sql += "uo.undunificado = uo.undunificado"; } SqlDataSource1.SelectCommand = sql; SqlDataSource1.DataBind(); }
protected void SqlDataSource1_Init(object sender, EventArgs e) { UsuariosControle ctrlUsu = new UsuariosControle(); bool parametro = Control.Configuracoes.Dados.getParametroGradeDIDComplementar(); string idUsu = ctrlUsu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString(); string idUndFunc = Control.UndFuncionalCtrl.getUndFuncByUsuID(idUsu).ToString(); string unidOrcDefault = Control.UnidadeOrcamentariaCtrl.GetUnidadeOrcamentriaByUnidadeFuncional(idUndFunc).undUnificado; Control.PerfilCtrl perfil = new Control.PerfilCtrl(); bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(idUsu); string sql = "select undunificado, undnome from unidadeorcamentaria UO where "; if (!perfilConsultaGeral) { if (!parametro) { sql += "uo.undunificado in (SELECT UO.undunificado " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " WHERE " + " uog.uogunidadegestora = " + " (SELECT UOG.uogunidadegestora " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " where uo.undunificado = '" + unidOrcDefault + "' " + " ) " + ")"; } else { sql += "uo.undunificado in (select UNDUNIFICADO from SCI_USUARIOS_UNDORC where usu_codigo = " + idUsu + " )"; } } else { sql += "uo.undunificado = uo.undunificado"; } SqlDataSource1.SelectCommand = sql; SqlDataSource1.DataBind(); }
protected XPDataView AtualizarGrid() { Control.UsuariosControle ctrlUsu = new Control.UsuariosControle(); string usuarioDefault = ctrlUsu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString(); Control.PerfilCtrl perfil = new Control.PerfilCtrl(); bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(usuarioDefault); perfil = null; string dataIni = string.Empty; string dataFim = string.Empty; string envolvido = string.Empty; string procNum = string.Empty; string undorca = string.Empty; string sqlTable = "select " + "CTRCOD," + "CTRNUMERO," + "CTRPESSOA," + "CTRCONTROLEPORUO," + "PESNOME," + "UO," + "adcobjeto ," + "adcinicio," + "adcfinal," + "licnumero," + "liccod," + "MODALIDADE," + "IDMODALIDADE, " + "VALORCONTRATO, " + "SALDOCONTRATO, " + "SITUACAOADITIVOS " + "from VW_FLX_CONTRATOS "; if (dtCadastroIni.Value != null) { dataIni = "'" + DateTime.Parse(dtCadastroIni.Value.ToString()).ToShortDateString().Replace("/", ".") + "' "; } else { dataIni = "ADCINICIO"; } if (dtCadastroFim.Value != null) { dataFim = "'" + DateTime.Parse(dtCadastroFim.Value.ToString()).ToShortDateString().Replace("/", ".") + "' "; } else { dataFim = "ADCFINAL"; } if (cbbEnvolvido.Value != null) { envolvido = cbbEnvolvido.Value.ToString(); } else { envolvido = "CTRPESSOA "; } if (txtNumProcesso.Value != null) { procNum = " like '" + txtNumProcesso.Value.ToString() + "%'"; } else { procNum = " = CTRNUMERO "; } if (cbbUndOrc.Value != null) { undorca = "= '" + cbbUndOrc.Value.ToString() + "' "; } else { if (!perfilConsultaGeral) { string idUndFunc = Control.UndFuncionalCtrl.getUndFuncByUsuID(usuarioDefault).ToString(); string undOrcCad = Control.UnidadeOrcamentariaCtrl.GetUnidadeOrcamentriaByUnidadeFuncional(idUndFunc).undUnificado; undorca = "in ( SELECT UO.undunificado " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " WHERE " + " uog.uogunidadegestora = " + " (SELECT UOG.uogunidadegestora " + " FROM unidadeorcamentaria UO " + " JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " + " where uo.undunificado = '" + undOrcCad + "' " + " ) ) "; } else { undorca = "= UO "; } } ////usuarioEnvio = "USUARIOENVIO"; sqlTable += " WHERE "; sqlTable += " ("; sqlTable += " (ADCFINAL >= " + dataFim + ") "; sqlTable += " AND "; sqlTable += " (ADCINICIO <= " + dataIni + ")"; sqlTable += " ) "; sqlTable += " AND "; sqlTable += " CTRPESSOA = " + envolvido; sqlTable += " AND "; sqlTable += " CTRNUMERO " + procNum; sqlTable += " AND "; sqlTable += " UO " + undorca; DevExpress.Xpo.Session xpoSession = new DevExpress.Xpo.Session(); XpoDataSource1.Session = xpoSession; XpoDataSource1.Session.Connection = Persist.GetConn.getConn(); var resultSet = xpoSession.ExecuteQuery(sqlTable); var dv = new XPDataView(); dv.AddProperty("CTRCOD", typeof(int)); dv.AddProperty("CTRNUMERO", typeof(string)); dv.AddProperty("CTRPESSOA", typeof(DateTime)); dv.AddProperty("CTRCONTROLEPORUO", typeof(string)); dv.AddProperty("PESNOME", typeof(string)); dv.AddProperty("UO", typeof(int)); dv.AddProperty("ADCOBJETO", typeof(string)); dv.AddProperty("ADCINICIO", typeof(string)); dv.AddProperty("ADCFINAL", typeof(string)); dv.AddProperty("LICNUMERO", typeof(int)); dv.AddProperty("LICCOD", typeof(int)); dv.AddProperty("MODALIDADE", typeof(decimal)); dv.AddProperty("IDMODALIDADE", typeof(decimal)); dv.AddProperty("VALORCONTRATO", typeof(decimal)); dv.AddProperty("SALDOCONTRATO", typeof(decimal)); dv.AddProperty("SITUACAOADITIVOS", typeof(string)); dv.LoadData(resultSet); ASPxGridView1.DataSource = dv; Session["DTable"] = dv; ASPxGridView1.DataBind(); return dv; }