public PCOItem(PCOService service, dynamic DataJSON, Boolean loadFromFile) { this.Service = service; if (loadFromFile) { this.UpdateFromFile(DataJSON); } else { this.Update(DataJSON); } }
public bool ServiceExists(int id) { PCOService checkService = GetService(id); if (checkService != null && checkService.IsComplete) { return(true); } else { return(false); } }
public PCOItem(PCOService service, dynamic DataJSON) { this.Service = service; this.Update(DataJSON); }
public static List <PCOService> GetServices(Campus location, bool forceUpdate) { int currentFetchPage = 0; //int lastValidPage = 0; PCO thisPCO = new PCO(location); thisPCO.GetCurrentData(); bool isLastPage = false; currentFetchPage = thisPCO.CurrentDatePage; while (!isLastPage) { dynamic pcoData = Utility.GetRequestObject(thisPCO.Location.ServicesURL.Replace("{recordNo}", currentFetchPage.ToString())); if (pcoData != null) { if (pcoData.data != null) { isLastPage = (pcoData.data.Count == 0); foreach (dynamic serviceDynamic in pcoData.data) { int serviceID = (serviceDynamic.id != null) ? Convert.ToInt32(serviceDynamic.id.ToString()) : 0; PCOService thisService = thisPCO.GetService(serviceID); if (thisService == null) { thisService = new PCOService(location, serviceDynamic); if (thisService.IsComplete) { thisPCO.Plans.Add(thisService); } } else { if (!thisService.IsConfirmed || forceUpdate) { thisService.Update(serviceDynamic); } } if (thisService.IsPast) { thisPCO.CurrentDatePage = currentFetchPage; } else { isLastPage = true; } if (forceUpdate) { thisPCO.LastUpdated = DateTime.Now; thisPCO.UpdateData(); } } } if (!isLastPage) { currentFetchPage += 25; } } } thisPCO.LastUpdated = DateTime.Now; thisPCO.UpdateData(); return(thisPCO.Plans); }
public PCOService GetService(int id) { PCOService checkService = this.Plans.Find(p => p.ID == id); return(checkService); }