public override void Delete(int id) { var p = new SqlParameter[] { new SqlParameter("id", id) }; HelperDAO.ExecutaProc("spDelete" + Tabela, p); }
public bool VerificaUsuario(string usuario) { SqlParameter[] parametros = { new SqlParameter("Usuario", usuario), }; var tabela = HelperDAO.ExecutaProcSelect("spVerificaUsuario", parametros); return(tabela.Rows.Count > 0); }
public virtual void Delete(int id) { var p = new SqlParameter[] { new SqlParameter("id", id), new SqlParameter("tabela", Tabela) }; HelperDAO.ExecutaProc("spDelete", p); }
public virtual int ProximoId() { var p = new SqlParameter[] { new SqlParameter("tabela", Tabela) }; var tabela = HelperDAO.ExecutaProcSelect("spProximoId", p); return(Convert.ToInt32(tabela.Rows[0][0])); }
internal void Update(OsViewModel model) { SqlParameter[] parametros = { new SqlParameter("OsId", model.Id) }; HelperDAO.ExecutaProc("sp_DeleteProjetoOS", parametros); Insert(model); }
internal void Insert(OsViewModel model) { if (model.Projetos != null && model.Projetos.Count > 0) { foreach (var item in model.Projetos) { HelperDAO.ExecutaProc("sp_InsertProjetoOS", CriaParametros(model.Id, item)); } } }
public override List <FuncionarioViewModel> Listagem() { var tabela = HelperDAO.ExecutaProcSelect("spListagem" + Tabela, null); List <FuncionarioViewModel> lista = new List <FuncionarioViewModel>(); foreach (DataRow registro in tabela.Rows) { lista.Add(MontaModel(registro)); } return(lista); }
public bool VerificaUsuario(string nome, string senha) { SqlParameter[] parametros = { new SqlParameter("user", nome), new SqlParameter("senha", senha) }; var tabela = HelperDAO.ExecutaProcSelect("spLogin", parametros); return(tabela.Rows.Count > 0); }
public List <ProjetoViewModel> ProjetosDoCliente(int?clienteId) { SqlParameter[] parametros = { new SqlParameter("ClienteId", clienteId) }; var tabela = HelperDAO.ExecutaProcSelect("spProjetosDoCliente", parametros); List <ProjetoViewModel> lista = new List <ProjetoViewModel>(); foreach (DataRow registro in tabela.Rows) { lista.Add(MontaModel(registro)); } return(lista); }
public virtual List <T> Listagem() { var p = new SqlParameter[] { new SqlParameter("tabela", Tabela), new SqlParameter("Ordem", "1") // 1 é o primeiro campo da tabela, ou seja, a chave primária }; var tabela = HelperDAO.ExecutaProcSelect("spListagem", p); List <T> lista = new List <T>(); foreach (DataRow registro in tabela.Rows) { lista.Add(MontaModel(registro)); } return(lista); }
public virtual T Consulta(int id) { var p = new SqlParameter[] { new SqlParameter("id", id), new SqlParameter("tabela", Tabela) }; var tabela = HelperDAO.ExecutaProcSelect("spConsulta", p); if (tabela.Rows.Count == 0) { return(null); } else { return(MontaModel(tabela.Rows[0])); } }
internal static List <int> Listagem(OsViewModel model) { List <int> projetosID = new List <int>(); SqlParameter[] parametros = { new SqlParameter("OsId", model.Id) }; var tabela = HelperDAO.ExecutaProcSelect("sp_ListagemProjetoOS", parametros); if (tabela.Rows.Count > 0) { foreach (DataRow r in tabela.Rows) { projetosID.Add((int)r["ProjetoId"]); } } return(projetosID); }
public List <FuncionarioViewModel> FiltraFunction(int?Id, string Nome, string Setor) { SqlParameter[] parametros = { HelperDAO.NullSqlParameter("Id", Id), new SqlParameter("Nome", string.IsNullOrEmpty(Nome) ? "DEFAULT" : Nome), new SqlParameter("Setor", string.IsNullOrEmpty(Setor) ? "DEFAULT" : Setor), }; var strId = Id.HasValue ? "@Id" : "DEFAULT"; var strNome = string.IsNullOrEmpty(Nome) ? "DEFAULT" : "@Nome"; var strSetor = string.IsNullOrEmpty(Setor) ? "DEFAULT" : "@Setor"; var tabela = HelperDAO.ExecutaFuncSelect("SELECT * from [dbo].[FiltroFuncionario] (" + strId + "," + strNome + "," + strSetor + ") ", parametros); List <FuncionarioViewModel> lista = new List <FuncionarioViewModel>(); foreach (DataRow registro in tabela.Rows) { lista.Add(MontaModel(registro)); } return(lista); }
public List <ConsultaViewModel> Filtra(string orientacao, string ostipo, string tecnologia) { SqlParameter[] parametros = { new SqlParameter("Orientacao", orientacao), new SqlParameter("OsTipo", ostipo), new SqlParameter("Tecnologia", tecnologia), }; var tabela = HelperDAO.ExecutaProcSelect("spMelhoresClientes", parametros); List <ConsultaViewModel> lista = new List <ConsultaViewModel>(); if (tabela != null && tabela.Rows.Count > 0) { foreach (DataRow registro in tabela.Rows) { lista.Add(MontaModel(registro)); } } return(lista); }
internal void AtivaFuncs() { HelperDAO.ExecutaProc("spAtivaFuncionarios", null); }
public virtual void Update(T model) { HelperDAO.ExecutaProc("spUpdate" + Tabela, CriaParametros(model)); }
public virtual void Insert(T model) { HelperDAO.ExecutaProc("spInsert" + Tabela, CriaParametros(model)); }