예제 #1
0
        public override void Delete(int id)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("id", id)
            };

            HelperDAO.ExecutaProc("spDelete" + Tabela, p);
        }
예제 #2
0
        public bool VerificaUsuario(string usuario)
        {
            SqlParameter[] parametros =
            {
                new SqlParameter("Usuario", usuario),
            };
            var tabela = HelperDAO.ExecutaProcSelect("spVerificaUsuario", parametros);

            return(tabela.Rows.Count > 0);
        }
예제 #3
0
        public virtual void Delete(int id)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("id", id),
                new SqlParameter("tabela", Tabela)
            };

            HelperDAO.ExecutaProc("spDelete", p);
        }
예제 #4
0
        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]));
        }
예제 #5
0
        internal void Update(OsViewModel model)
        {
            SqlParameter[] parametros =
            {
                new SqlParameter("OsId", model.Id)
            };

            HelperDAO.ExecutaProc("sp_DeleteProjetoOS", parametros);
            Insert(model);
        }
예제 #6
0
 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));
         }
     }
 }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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]));
            }
        }
예제 #12
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);
        }
예제 #13
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
 internal void AtivaFuncs()
 {
     HelperDAO.ExecutaProc("spAtivaFuncionarios", null);
 }
예제 #16
0
 public virtual void Update(T model)
 {
     HelperDAO.ExecutaProc("spUpdate" + Tabela, CriaParametros(model));
 }
예제 #17
0
 public virtual void Insert(T model)
 {
     HelperDAO.ExecutaProc("spInsert" + Tabela, CriaParametros(model));
 }