コード例 #1
0
ファイル: MODEL_Estoque.cs プロジェクト: Emanoz/prjEstoque
        public List <Estoque> GetAll()
        {
            string         query = "SELECT * FROM Estoque";
            List <Estoque> list  = new List <Estoque>();

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query);
                while (reader.Read())
                {
                    Estoque e = new Estoque();

                    e.CodEstoque = int.Parse(reader["CodEstoque"].ToString());
                    e.Local      = reader["Local"].ToString();

                    list.Add(e);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(list);
        }
コード例 #2
0
        public List <Equipamento> GetAll()
        {
            string             query = "SELECT * FROM Equipamento";
            List <Equipamento> list  = new List <Equipamento>();

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query);
                while (reader.Read())
                {
                    Equipamento e = new Equipamento();

                    e.CodEquipamento = int.Parse(reader["CodEquipamento"].ToString());
                    e.Descricao      = reader["Descricao"].ToString();
                    e.NumSerie       = reader["NumSerie"].ToString();
                    e.Estado         = reader["Estado"].ToString();
                    e.CodCategoria   = int.Parse(reader["CodCategoria"].ToString());
                    e.Pertencente    = reader["Pertencente"].ToString();
                    e.Patrimonio     = reader["Patrimonio"].ToString();

                    list.Add(e);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(list);
        }
コード例 #3
0
        public List <Termo_Emprestimo> GetAll()
        {
            string query = "SELECT * FROM Termo_de_Emprestimo";
            List <Termo_Emprestimo> list = new List <Termo_Emprestimo>();

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query);
                while (reader.Read())
                {
                    Termo_Emprestimo t = new Termo_Emprestimo();

                    t.CodTermo       = int.Parse(reader["CodTermo"].ToString());
                    t.DataRetirada   = DateTime.Parse(reader["DataRetirada"].ToString());
                    t.Rg             = reader["Rg"].ToString();;
                    t.DataDevolucao  = DateTime.Parse(reader["DataDevolucao"].ToString());
                    t.CodEquipamento = int.Parse(reader["CodEquipamento"].ToString());

                    list.Add(t);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(list);
        }
コード例 #4
0
ファイル: MODEL_Inventario.cs プロジェクト: Emanoz/prjEstoque
        public List <Inventario> GetAll()
        {
            string            query = "SELECT * FROM MostrarInventario";
            List <Inventario> list  = new List <Inventario>();

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query);
                while (reader.Read())
                {
                    Inventario c = new Inventario();

                    c.ID          = int.Parse(reader["ID"].ToString());
                    c.Descricao   = reader["Descricao"].ToString();
                    c.Estado      = reader["Estado"].ToString();
                    c.Pertencente = reader["Pertencente"].ToString();
                    c.Estoque     = reader["Estoque"].ToString();

                    list.Add(c);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(list);
        }
コード例 #5
0
        public List <Movimentacao> GetAll()
        {
            string query             = "SELECT * FROM Movimentacao";
            List <Movimentacao> list = new List <Movimentacao>();

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query);
                while (reader.Read())
                {
                    Movimentacao m = new Movimentacao();

                    m.CodMovimentacao  = int.Parse(reader["CodMovimentacao"].ToString());
                    m.CodUsuario       = int.Parse(reader["CodUsuario"].ToString());
                    m.CodEquipamento   = int.Parse(reader["CodEquipamento"].ToString());
                    m.CodEstoque       = int.Parse(reader["CodEstoque"].ToString());;
                    m.TipoMovimentacao = reader["Estado"].ToString();
                    m.DataMovimentacao = DateTime.Parse(reader["DataMovimentacao"].ToString());

                    list.Add(m);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(list);
        }
コード例 #6
0
        public List <TEMP_Movimentacao> GetAll()
        {
            string query = "SELECT * FROM MostrarMovimentacao";
            List <TEMP_Movimentacao> list = new List <TEMP_Movimentacao>();

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query);
                while (reader.Read())
                {
                    TEMP_Movimentacao c = new TEMP_Movimentacao();

                    c.Usuario     = reader["NomeUsu"].ToString();
                    c.Equipamento = reader["NomeEquip"].ToString();
                    c.Estoque     = reader["NomeLocal"].ToString();
                    c.TipoMov     = reader["Estado"].ToString();
                    c.DataMov     = DateTime.Parse(reader["dataMovimentacao"].ToString());

                    list.Add(c);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(list);
        }
コード例 #7
0
        public Usuario Logar(string usuario, string senha)
        {
            string  query = "SELECT CodUsuario, Nome, Cargo, Pin FROM USUARIO WHERE Usuario = @usuario AND Senha = @senha";
            Usuario u     = new Usuario(usuario, senha);

            try
            {
                SqlDataReader reader = db.CallExecuteReader(query, new SqlParameter("@usuario", u._Usuario),
                                                            new SqlParameter("@senha", u.Senha));
                reader.Read();

                u.CodUsuario = int.Parse(reader["CodUsuario"].ToString());
                u.Nome       = reader["Nome"].ToString();
                u.Cargo      = reader["Cargo"].ToString();
                u.Pin        = reader["Pin"].ToString();
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(u);
        }