Ejemplo n.º 1
0
        public Core.Business.PictureSort Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPictureSort");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.PictureSort pictureSort = new Core.Business.PictureSort();

                if (!reader.IsDBNull(0)) pictureSort.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) pictureSort.PictureSortName = reader.GetString(1);

                reader.Close();
                return pictureSort;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Ejemplo n.º 2
0
        public IList<Core.Business.PictureSort> GetAllPictureSort()
        {
            IList<Core.Business.PictureSort> pictureSortlist = new List<Core.Business.PictureSort>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPictureSortsAll");

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.PictureSort pictureSort = new Core.Business.PictureSort();

                    if (!reader.IsDBNull(0)) pictureSort.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) pictureSort.PictureSortName = reader.GetString(1);

                    pictureSort.MarkOld();
                    pictureSortlist.Add(pictureSort);
                }
                reader.Close();
            }
            return pictureSortlist;
        }