/// <summary> /// 更新播放列表 /// </summary> public bool UpdatePlaylist() { AMS_PlayListMd5Model model = AMS_PlayListMd5Model.Parse(ToModel().ToXml()); model.Id = _id; model.ReleaseDate = _SubmitDate; try { if (!string.IsNullOrEmpty(_Number) && _ItemList.Count > 0 && (_BeginDate < _EndDate)) { AMS_PlayListMd5Model samemodel = AMS_PlayListBLL.GetMd5PlaylistByNum(_Number); if (samemodel == null || samemodel.Id == _id) { foreach (AMS_VideoMd5Item item in model.VideoFiles) { if (item.RelativeUrl != item.Name) { FileOperate fo = new FileOperate(); if (!fo.UpdateFile(item.RelativeUrl, item.Name, SeatManage.EnumType.SeatManageSubsystem.MediaFiles)) { throw new Exception("文件" + item.Name + "上传失败!"); } } } foreach (AMS_VideoMd5Item videoitem in model.PlayVideoItems) { videoitem.RelativeUrl = videoitem.Name; videoitem.md5value = videoitem.md5value; } if (AMS_PlayListBLL.UpdateMd5PlayList(model) == AdvertManage.Model.Enum.HandleResult.Failed) { throw new Exception("更新播放列表失败,具体详情请查看错误日志!"); } return(true); } else { throw new Exception("已存在重复的编号!"); } } else { throw new Exception("信息填写错误!请仔细检查!"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(false); } }
/// <summary> /// 播放列表获取 /// </summary> public void DataBinding() { try { _PlaylistList.Clear(); List <AMS_PlayListMd5Model> modellist = AMS_PlayListBLL.GetMd5Playlist(); foreach (AMS_PlayListMd5Model model in modellist) { PlaylistInfoViewModel viewmodel = new PlaylistInfoViewModel(); viewmodel.ViewModelParse(model); _PlaylistList.Add(viewmodel); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }