Esempio n. 1
0
        public override List <T> RetrieveByName <T>(BaseEntity entity)
        {
            var lst = new List <T>();

            try
            {
                var instance  = SqlDao.GetInstance();
                var lstResult = instance.ExecuteQueryProcedure(_mapper.GetRetriveByName(entity));

                if (lstResult.Count > 0)
                {
                    var objs = _mapper.BuildObjects(lstResult);

                    foreach (var obj in objs)
                    {
                        lst.Add((T)Convert.ChangeType(obj, typeof(T)));
                    }
                }
            }
            catch (Exception ex)
            {
                _exMan.ManageException(ex);
            }

            return(lst);
        }
        public override List <T> RetrieveAll <T>()
        {
            var lstUsers = new List <T>();

            var lstResult = Dao.ExecuteQueryProcedure(Mapper.GetRetrieveAllStatement());
            var dic       = new Dictionary <string, object>();

            if (lstResult.Count > 0)
            {
                var objs = Mapper.BuildObjects(lstResult);
                foreach (var c in objs)
                {
                    lstUsers.Add((T)Convert.ChangeType(c, typeof(T)));
                }
            }

            return(lstUsers);
        }