public void updateCustomMoveAbaixoSequencia(int sequencia, int id) { DAOGeral daogeral = new DAOGeral(); daogeral.executaComRetorno("UPDATE " + this.table + " SET SEQUENCIA = " + sequencia + " WHERE SEQUENCIA = " + (sequencia - 1)); daogeral = new DAOGeral(); daogeral.executaComRetorno("UPDATE " + this.table + " SET SEQUENCIA = " + (sequencia - 1) + " WHERE ID = " + id); }
public virtual DataTable getAll(string filtro, string campopesquisa) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT * FROM " + table + (filtro != "" ? " WHERE " + campopesquisa + " LIKE '" + filtro + "%'" : "") + " ORDER BY ID"); if (dt.Rows.Count > 0) { return(dt); } return(null); }
public virtual T get(int?id) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT * FROM " + table + " WHERE ID = " + (id == null ? 0 : id)); if (dt.Rows.Count > 0) { return(ConvertToClass(dt.Rows[0])); } return(null); }
public override DataTable getAll(string filtro, string campopesquisa) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT TABLEX.ID,TABLEX.CODIGO_COMANDO,TABLEX.DESCRICAO_COMANDO,TIPO.NOME AS TIPO FROM " + table + " TABLEX LEFT JOIN TIPOCOMANDO TIPO ON TABLEX.TIPO = TIPO.ID " + (filtro != "" ? " WHERE " + campopesquisa + " LIKE '" + filtro + "%'" : "") + " ORDER BY ID"); if (dt.Rows.Count > 0) { return(dt); } return(null); }
public Receita getCustomUltimo() { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT TOP 1 * FROM " + table + " ORDER BY ID DESC"); if (dt.Rows.Count > 0) { return(ConvertToClass(dt.Rows[0])); } return(null); }
public Usuario consultaUsuarioAutenticacao(string usuario, string senha) { DAOGeral daogeral = new DAOGeral(); Usuario objusuario = new Usuario();; DataTable dtusuario = daogeral.executaComRetorno("select * from " + table + " where usuario = '" + usuario + "' and senha = '" + senha + "' order by usuario"); if (dtusuario.Rows.Count > 0) { objusuario = objusuario.convertToUsuario(dtusuario.Rows[0]); } return(objusuario); }
public void ordenaSequencia(int id_receita) { DAOGeral daogeral = new DAOGeral(); daogeral.executaComRetorno("UPDATE ItensReceita" + " SET sequencia = x.teste" + " FROM(" + " select ROW_NUMBER() OVER(ORDER BY id ASC) AS teste, id_receita, id from ItensReceita where id_receita = " + id_receita + " ) x" + " where ItensReceita.id_receita = x.id_receita" + " and ItensReceita.id = x.id"); }
public DataTable getCustomReceita(int?id_receita) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT sequencia as SEQUÊNCIA,objetivo as OBJETIVO,CASE WHEN objetivo = 'Peso' THEN valor + ' kg' ELSE valor END as VALOR, CASE WHEN objetivo = 'Peso' THEN corte + ' kg' ELSE corte END as CORTE,acao as AÇÃO,parametro1 as PARAMETRO,CAST(rele.codigo as varchar) + '-' + rele.nome as RELE,tipo_limite as [TIPO_LIMITE],CASE WHEN tipo_limite = 'Peso' THEN valor_limite + ' kg' ELSE valor_limite END as [VALOR_LIMITE],itens.id as ID FROM " + table + " itens" + " LEFT JOIN Rele rele on itens.parametro2 = CAST(rele.id as varchar)" + " WHERE ID_RECEITA = " + (id_receita == null ? 0 : id_receita) + " ORDER BY SEQUÊNCIA"); if (dt.Rows.Count > 0) { return(dt); } return(null); }
public Rele getCustomReleCodigo(string codigo) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT * FROM " + table + " WHERE CODIGO = '" + codigo + "' ORDER BY ID"); Rele obj = new Rele(); if (dt.Rows.Count > 0) { obj = ConvertToClass(dt.Rows[0]); return(obj); } return(null); }
public List <TipoRele> getAllCustom() { List <TipoRele> listTipoRele = new List <TipoRele>(); DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT * FROM " + table); for (int i = 0; i < dt.Rows.Count; i++) { listTipoRele.Add(ConvertToClass(dt.Rows[i])); } return(listTipoRele); }
public DataTable getItensReceita(int?id_receita) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT itens.*,rele.codigo as codigo_rele,rele.nome as nome_rele,tiporele.id as id_tiporele,tiporele.nome as nome_tiporele FROM " + table + " itens" + " LEFT JOIN Rele rele on itens.parametro2 = CAST(rele.id as varchar)" + " LEFT JOIN TipoRele tiporele on rele.tipo = TipoRele.id" + " WHERE ID_RECEITA = " + (id_receita == null ? 0 : id_receita) + " ORDER BY itens.sequencia"); if (dt.Rows.Count > 0) { return(dt); } return(null); }
public List <Comando> getCustomTipoComando(string tipo_comando) { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT * FROM " + table + " com left join TipoComando tipo on com.tipo = tipo.id WHERE tipo.nome = '" + tipo_comando + "'"); List <Comando> list = new List <Comando>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { list.Add(ConvertToClass(dt.Rows[i])); } return(list); } return(null); }
public List <Rele> getCustomListRele() { DAOGeral daogeral = new DAOGeral(); DataTable dt = daogeral.executaComRetorno("SELECT ID,CODIGO,(CODIGO + '-' + NOME) AS NOME,TIPO,DATEINSERT,DATEUPDATE FROM " + table + " ORDER BY ID"); List <Rele> list = new List <Rele>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { list.Add(ConvertToClass(dt.Rows[i])); } return(list); } return(null); }
public List <Usuario> consultaUsuarios() { List <Usuario> listusuario = new List <Usuario>(); DAOGeral daogeral = new DAOGeral(); Usuario objusuario; DataTable dtusuario = daogeral.executaComRetorno("select * from " + table + " order by usuario"); if (dtusuario.Rows.Count > 0) { for (int i = 0; i < dtusuario.Rows.Count; i++) { objusuario = new Usuario(); objusuario = objusuario.convertToUsuario(dtusuario.Rows[i]); listusuario.Add(objusuario); } } return(listusuario); }
public void delete(int?id) { DAOGeral daogeral = new DAOGeral(); daogeral.executaComRetorno("DELETE FROM " + this.table + " WHERE ID = " + id); }
public void deleteCustomReceita(int id_receita) { DAOGeral daogeral = new DAOGeral(); daogeral.executaComRetorno("DELETE FROM " + this.table + " WHERE ID_RECEITA = " + id_receita); }