public List <Cliente> Listar(Cliente cli, string conString) { List <Cliente> lista = new List <Cliente>(); DataTable d; using (Conexao c = new Conexao(conString)) { c.Query("Select Id,Nome,Cpf From Cliente"); c.Query(cli.Id > 0 ? c.WhereAnd($"Id = {cli.Id}") : ""); c.Query(!G1.Nada(cli.Nome) ? c.WhereAnd($"Nome Like {c.StrLike(cli.Nome)}") : ""); c.Query(!G1.Nada(cli.Cpf) ? c.WhereAnd($"Cpf = {c.Str(cli.Cpf)}") : ""); d = c.DtSql(); } if (G1.DtOk(d)) { lista = JsonConvert.DeserializeObject <List <Cliente> >(G1.DtToJson(d), G1.CfJson()); } return(lista); }
public List <ItensLocacao> Listar(ItensLocacao iloc, string conString) { List <ItensLocacao> lista = new List <ItensLocacao>(); DataTable d; using (Conexao c = new Conexao(conString)) { c.Query("Select IdItem, IdLocacao, Status, IdFilme From ItensLocacao"); c.Query(iloc.IdItem > 0 ? c.WhereAnd($"IdItem = {iloc.IdItem}") : ""); c.Query(!G1.Nada(iloc.IdLocacao) ? c.WhereAnd($"IdLocacao Like {(iloc.IdLocacao)}") : ""); c.Query(!G1.Nada(iloc.Status) ? c.WhereAnd($"Status Like {(iloc.Status)}") : ""); c.Query(!G1.Nada(iloc.IdFilme) ? c.WhereAnd($"IdFilme = {(iloc.IdFilme)}") : ""); d = c.DtSql(); } if (G1.DtOk(d)) { lista = JsonConvert.DeserializeObject <List <ItensLocacao> >(G1.DtToJson(d), G1.CfJson()); } return(lista); }
public List <Filmes> Listar(Filmes film, string conString) { List <Filmes> lista = new List <Filmes>(); DataTable d; using (Conexao c = new Conexao(conString)) { c.Query("Select Id,Titulo,Genero, Status From Filmes"); c.Query(film.Id > 0 ? c.WhereAnd($"Id = {film.Id}") : ""); c.Query(!G1.Nada(film.Titulo) ? c.WhereAnd($"Titulo Like {c.StrLike(film.Titulo)}") : ""); c.Query(!G1.Nada(film.Genero) ? c.WhereAnd($"Genero = {c.Str(film.Genero)}") : ""); c.Query(!G1.Nada(film.Status) ? c.WhereAnd($"Status = {film.Status}") : ""); d = c.DtSql(); } if (G1.DtOk(d)) { lista = JsonConvert.DeserializeObject <List <Filmes> >(G1.DtToJson(d), G1.CfJson()); } return(lista); }
public List <Locacao> Listar(Locacao loc, string conString) { List <Locacao> lista = new List <Locacao>(); DataTable d; using (Conexao c = new Conexao(conString)) { c.Query("Select Id, Status, IdCliente, DtLocacao, DtDevolucao From Locacao"); c.Query(loc.Id > 0 ? c.WhereAnd($"Id = {loc.Id}") : ""); c.Query(loc.Status > 0 ? c.WhereAnd($"Status = {loc.Status}") : ""); c.Query(loc.IdCliente > 0 ? c.WhereAnd($"IdCliente = {loc.IdCliente}") : ""); c.Query(G1.IsDate(loc.DtLocacao) ? c.WhereAnd($"DtLocacao = {c.Data(loc.DtLocacao)}") : ""); c.Query(G1.IsDate(loc.DtDevolucao) ? c.WhereAnd($"DtDevolucao = {c.Data(loc.DtDevolucao)}") : ""); d = c.DtSql(); } if (G1.DtOk(d)) { lista = JsonConvert.DeserializeObject <List <Locacao> >(G1.DtToJson(d), G1.CfJson()); } return(lista); }