Example #1
0
        public override PartialViewResult PicView()
        {
            string           type      = Request["type"];
            string           name      = Request["name"];
            string           pageindex = Request["pageindex"];
            MediaInfoService service   = new MediaInfoService();
            MediaCondition   pc        = new MediaCondition();

            if (!string.IsNullOrEmpty(type))
            {
                pc.MediaTypeId = new Guid(type);
            }
            pc.FileName   = name;
            pc.MediaClass = MediaClass.文档;
            pc.PageIndex  = int.Parse(pageindex);
            Paging page = new Paging(pc);

            page.PageSize = 3 * 6;
            List <Media> list = service.GetListByMediaTypeId(pc, ref page).ToList();

            MediaInfoListModel model = new MediaInfoListModel(list);

            model.Paging = page;
            return(PartialView("_PicView", model));
        }
Example #2
0
        public ActionResult Index(MediaCondition condition, string selectedMediaIds)
        {
            var entities = mediaService.SearchMedias(condition);
            var models   = new PagedList <Media>(entities, entities.Paging);

            ViewBag.SelectedMediaIds = selectedMediaIds;
            return(View(models));
        }
Example #3
0
 public VinylAlbum(AlbumData a, int ncFront, int ncBack, MediaCondition e, MediaCondition ee, short y, string p) : base()
 {
     Album           = a;
     Artist          = a.Artist;
     Title           = a.Title;
     SleeveCondition = ee;
     Year            = y;
     Country         = p;
     DiscList        = new();
     DiscList.Add(new VinylDisc(ncFront, ncBack, 'A', e));
     Id = Convert.ToBase64String(Guid.NewGuid().ToByteArray()); //porque puede ser que tenga dos copias del mismo álbum
     Id = Id.Remove(Id.Length - 2);
     Id.Replace('+', 'm');
 }
Example #4
0
        /*
         *         public IPhysicalAlbum(AlbumData a, string s, MediaCondition estado, short y = 0, string p = null)
         * {
         *  AlbumData = a;
         *  EstadoExterior = estado;
         *  Year = y;
         *  Country = p;
         *  Artist = AlbumData.Artist;
         *  Title = AlbumData.Title;
         * }*/

        public CompactDisc(AlbumData album, int nc, MediaCondition e, MediaCondition ee, SleeveType f, short y, string p)
        {
            Album           = album;
            Artist          = album.Artist;
            Title           = album.Title;
            SleeveCondition = ee;
            Year            = y;
            Country         = p;
            SleeveType      = f;
            Discos          = new List <Disc>(1);
            Discos.Add(new Disc(nc, e));
            Id = Convert.ToBase64String(Guid.NewGuid().ToByteArray()); //porque puede ser que tenga dos copias del mismo álbum
            Id = Id.Remove(Id.Length - 2);
            Id.Replace('+', 'm');
        }
Example #5
0
        public IPagedList <Media> SearchMedias(MediaCondition condition)
        {
            var query = new Repository <Media>().Table;

            if (!string.IsNullOrEmpty(condition.FileName))
            {
                query = query.Where(t => t.FileName.Contains(condition.FileName));
            }
            if (condition.MediaType != null)
            {
                query = query.Where(t => t.MediaType == condition.MediaType);
            }

            query = query.Where(t => t.IsDelete == false);
            query = query.Where(t => t.IsPublic == true);
            query = query.OrderByDescending(t => t.CreateDate);

            return(new PagedList <Media>(query, condition.PageIndex, condition.PageSize));
        }
Example #6
0
        public IList <Media> GetListByMediaTypeId(MediaCondition condition, ref Paging paging)
        {
            using (var repository = new Repository <Media>())
            {
                Expression <Func <Media, bool> > where = PredicateExtensions.True <Media>();
                //if (condition.MediaTypeId.HasValue)
                //{
                //    where = where.And(p =>p.MediaType_Id == condition.MediaTypeId  );
                //}
                if (!string.IsNullOrEmpty(condition.FileName))
                {
                    where = where.And(p => p.FileName.Contains(condition.FileName));
                }


                //where = where.And(p => p.MediaClass == condition.MediaClass);

                return(repository.GetPaged(ref paging, where, m => m.CreateDate).ToList());
            }
        }
Example #7
0
 public static bool Compare(FileInfo info, MediaCondition condition)
 {
     try
     {
         PropertyInfo property = GetPropertyInfo(info.MediaInfo, condition.Property.ToLower());
         if (property.Name.ToLower().Equals("duration"))
         {
             switch (condition.Comparator)
             {
                 case ">":
                     return (TimeSpan) property.GetValue(info.MediaInfo, null) > condition.Duration;
                 case "<":
                     return (TimeSpan) property.GetValue(info.MediaInfo, null) < condition.Duration;
                 case "=":
                     return (TimeSpan) property.GetValue(info.MediaInfo, null) == condition.Duration;
                 case "!=":
                     return (TimeSpan) property.GetValue(info.MediaInfo, null) != condition.Duration;
             }
         }
         else
         {
             switch (condition.Comparator)
             {
                 case ">":
                     return (int) property.GetValue(info.MediaInfo, null) > condition.Value;
                 case "<":
                     return (int) property.GetValue(info.MediaInfo, null) < condition.Value;
                 case "=":
                     return (int) property.GetValue(info.MediaInfo, null) == condition.Value;
                 case "!=":
                     return (int) property.GetValue(info.MediaInfo, null) != condition.Value;
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Uh-oh. That comparison didn't work quite right\r\n"+ex);
     }
     return false;
 }
Example #8
0
 public Disc(int numberOfSongs, MediaCondition mediaCondition)
 {
     NumberOfSongs  = numberOfSongs;
     MediaCondition = mediaCondition;
 }