public UnidadeExercicioFuncao[] ListarUnidadesExercicioFuncao(string unidadeExercicio) { DetachedCriteria dc = DetachedCriteria.For(typeof(UnidadeExercicioFuncao)); dc.Add(Expression.Eq("UnidadeExercicio.Id", int.Parse(unidadeExercicio))); dc.CreateAlias("Funcao", "fun"); dc.AddOrder(Order.Asc("fun.Descricao")); dc.AddOrder(Order.Asc("Id")); UnidadeExercicioFuncao[] oUnidadeExercicioFuncao = UnidadeExercicioFuncao.FindAll(dc); return(oUnidadeExercicioFuncao); }
public static UnidadeExercicioFuncao[] listarUEF(string ue, string sue, string fun) { DetachedCriteria dc = DetachedCriteria.For(typeof(UnidadeExercicioFuncao)); dc.AddOrder(Order.Asc("Descricao")); if (!string.IsNullOrEmpty(ue) && string.IsNullOrEmpty(sue)) { dc.Add(Expression.Eq("UnidadeExercicio.Id", Convert.ToInt32(ue))); } if (!string.IsNullOrEmpty(sue)) { dc.Add(Expression.Eq("UnidadeExercicio.Id", Convert.ToInt32(sue))); } if (!string.IsNullOrEmpty(fun)) { dc.Add(Expression.Eq("Funcao.Id", Convert.ToInt32(fun))); } return(UnidadeExercicioFuncao.FindAll(dc)); }