/* GET ALL */ public List <T> GetEntity <T>(string filename) where T : class, IEntity { var localList = LocalFileStorage.LoadFromLocalStorage <List <T> >(filename); var remoteList = new List <T>(); if (App.SyncWithServer) { remoteList = DataService.LoadFromServer <T>(filename); if (remoteList != null && remoteList.Any()) { if (localList == null || !localList.Any() || remoteList.Max(r => r.Changed) > localList.Max(l => l.Changed)) { //remote er nyere enn local remoteList.Save(filename); localList = remoteList; } else if (!remoteList.Any() || remoteList.Max(r => r.Changed) < localList.Max(l => l.Changed)) { //remote er eldre enn local localList.UploadToServer(filename); } } else { localList.UploadToServer(filename); } } return(localList); }
public IEnumerable <Art> GetArter() { ArtList = LocalFileStorage.LoadFromLocalStorage <List <Art> >(FILE_ART); GetSelectedArter(); foreach (var art in SelectedArtList) { var artToSelect = ArtList.FirstOrDefault(a => a.ID == art.ID); if (artToSelect != null) { artToSelect.Selected = true; } } //ArtList.AddRange(LocalFileStorage.Load<List<Art>>(FILE_MY_ART)); //TODO: add this functionality (egne arter) return(ArtList); }
public IEnumerable <LoggTypeGroup> GetLoggTypeGroups() { LoggTypeGroupList = LocalFileStorage.LoadFromLocalStorage <List <LoggTypeGroup> >(FILE_LOGGTYPE_GROUP); return(LoggTypeGroupList); }
public IEnumerable <LoggType> GetLoggTyper() { LoggTypeList = LocalFileStorage.LoadFromLocalStorage <List <LoggType> >(FILE_LOGGTYPER); return(LoggTypeList); }
public IEnumerable <ArtGroup> GetArtGroups() { ArtGroupList = LocalFileStorage.LoadFromLocalStorage <List <ArtGroup> >(FILE_ARTGROUP); return(ArtGroupList); }