public static LibraryCollection GetLibraries(IYZDbProvider provider, IDbConnection cn, string libType, string filter, string sort) { try { LibraryCollection alllibs = new LibraryCollection(); using (YZReader reader = new YZReader(provider.GetLibraries(cn, libType, filter, sort))) { while (reader.Read()) { Library lib = new Library(reader); if (!String.IsNullOrEmpty(lib.Name)) { alllibs.Add(lib); } } } return(alllibs); } catch (Exception e) { throw new BPMException(BPMExceptionType.DBLoadDataErr, "YZAppLibrary", e.Message); } }
/// <summary> /// Add a new library to the collection and to persistent storage /// </summary> /// <param name="newLibrary"></param> public static async Task AddLibraryAsync(Library newLibrary) { LibraryCollection.Add(newLibrary); // Need to wait for the Library to be added to ensure that its ID is available await DbAccess.InsertAsync(newLibrary); // Reform the library names collection LibraryNames = LibraryCollection.Select(lib => lib.Name).ToList(); }
public static LibraryCollection GetLibraries(IYZDbProvider provider, IDbConnection cn, string uid, string libType, string filter, string sort) { LibraryCollection alllibs = GetLibraries(provider, cn, libType, filter, sort); LibraryCollection libs = new LibraryCollection(); using (BPMConnection bpmcn = new BPMConnection()) { bpmcn.WebOpen(); foreach (Library lib in alllibs) { string rsid = String.Format("Library://{0}", lib.LibID); if (BPM.Client.Security.SecurityManager.CheckPermision(bpmcn, rsid, BPMPermision.Read)) { libs.Add(lib); } } } return(libs); }
private void LoadLibraryCollection() { LibraryCollection.Clear(); ContainerLibraries.Visibility = Visibility.Visible; ItemCollection.Clear(); ContainerMovies.Visibility = Visibility.Collapsed; CastCollection.Clear(); ContainerCast.Visibility = Visibility.Collapsed; MainGrid.RowDefinitions[2].Height = new GridLength(0); lvLibrarySections.ItemsSource = null; foreach (DataRow row in Database.GetLibrarySections().Rows) { LibraryCollection.Add(new Library() { id = long.Parse(row["id"].ToString()), name = row["name"].ToString() }); } lvLibrarySections.ItemsSource = LibraryCollection; }