internal List <Object> Select(Object o, FlagPredicado condicao) { try { List <Persist> lst = fabrica.CriarPersist(o); String[] colunas = fabrica.CriarColunas(lst); String tabela = auxiliar.CriarNomeTabela(o); VerificaTabelaBanco(lst, tabela, o); String script = GerarScriptSelect(colunas, tabela, lst, condicao); return(ConvertList(dao.ExecuteReader(script, lst), fabrica.CriarPersistPuro(o), o)); } catch { throw; } }
public virtual List <Object> Buscar(FlagPredicado condicao) { return(conn.Select(this, condicao)); }
public SelectCondition(String atributo, FlagPredicado flag, Object valor = null) { this.atributo = atributo; this.predicado = flag; this.valor = valor; }
private String GerarScriptSelect(String[] colunas, String tabela, List <Persist> obj, FlagPredicado where) { Boolean ini = true; String script = string.Empty; script = "Select "; for (int i = 0; i < colunas.Length; i++) { script += colunas[i] + ","; } script = script.Remove(script.Length - 1, 1) + " "; script += String.Format(" from {0} ", tabela); script += "where 0=0"; //if (where != "") //{ for (int i = 0; i < obj.Count; i++) { if (obj[i].ObjValor != null) { if (where == FlagPredicado.And) { script += " " + (ini ? "and" : "and") + " " + colunas[i] + " = @" + i; } if (where == FlagPredicado.Or) { script += " " + (ini ? "and" : "or") + " " + colunas[i] + " = @" + i; } ini = false; } } //} return(script); }