public static void Init() { Task.Run(() => { try { projects = MDMService.GetProjects().ToDictionary(k => k.Id, v => v); } catch (Exception ex) { Logger.Log.Error(ex, "DbService.Init() - MDMService.GetProjects()."); } }); }
public static List <ProjectMDM> GetProjects() { try { if (projects == null) { projects = MDMService.GetProjects().ToDictionary(k => k.Id, v => v); } return(projects.Values.ToList()); } catch (Exception ex) { Logger.Log.Error(ex, "MDMService.GetProjects();"); } return(null); }
public static ProjectMDM FindProject(int id) { ProjectMDM project = null; if (id != 0) { try { if (projects == null) { projects = MDMService.GetProjects().ToDictionary(k => k.Id, v => v); } projects.TryGetValue(id, out project); } catch (Exception ex) { Logger.Log.Error(ex, "MDMService.GetProjects();"); } } return(project); }
public void GetProjectsTest() { var projects = MDMService.GetProjects(); Assert.AreEqual(projects.Count, 25); }
private void LoadProjects() { var projects = MDMService.GetProjects(); cbProjects.DataSource = projects; }