Пример #1
0
 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().");
         }
     });
 }
Пример #2
0
 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);
 }
Пример #3
0
        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);
        }
Пример #4
0
        public void GetProjectsTest()
        {
            var projects = MDMService.GetProjects();

            Assert.AreEqual(projects.Count, 25);
        }
Пример #5
0
        private void LoadProjects()
        {
            var projects = MDMService.GetProjects();

            cbProjects.DataSource = projects;
        }