PageRenderTime 31ms CodeModel.GetById 15ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 1ms

/V4/Quickstarts/UIComposition/EmployeeModule/Services/EmployeeDataService.cs

#
C# | 100 lines | 73 code | 5 blank | 22 comment | 4 complexity | 751b7db62d2f4e2c254923cb402fe411 MD5 | raw file
  1//===================================================================================
  2// Microsoft patterns & practices
  3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
  4//===================================================================================
  5// Copyright (c) Microsoft Corporation.  All rights reserved.
  6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9// FITNESS FOR A PARTICULAR PURPOSE.
 10//===================================================================================
 11// The example companies, organizations, products, domain names,
 12// e-mail addresses, logos, people, places, and events depicted
 13// herein are fictitious.  No association with any real company,
 14// organization, product, domain name, email address, logo, person,
 15// places, or events is intended or should be inferred.
 16//===================================================================================
 17using EmployeeModule.Models;
 18using UIComposition.EmployeeModule.Models;
 19
 20namespace UIComposition.EmployeeModule.Services
 21{
 22    /// <summary>
 23    /// Dummy employee data service class. Provides dummy data for employees and projects.
 24    /// Replace with your real employee data access or employee data service proxy.
 25    /// </summary>
 26    public class EmployeeDataService : IEmployeeDataService
 27    {
 28        private Employees employees;
 29        private Projects projects;
 30
 31        public Employees GetEmployees()
 32        {
 33            if (this.employees == null)
 34            {
 35                // Dummy Data.
 36                this.employees = new Employees
 37                                      {
 38                                          new Employee()
 39                                              {
 40                                                  Id = "1",
 41                                                  Name = "John",
 42                                                  LastName = "Smith",
 43                                                  Phone = "(425) 555 8912",
 44                                                  Email = "John.Smith@Contoso.com"
 45                                              },
 46                                          new Employee()
 47                                              {
 48                                                  Id = "2",
 49                                                  Name = "Bonnie",
 50                                                  LastName = "Skelly",
 51                                                  Phone = "(206) 555 7301",
 52                                                  Email = "Bonnie.Skelly@Contoso.com"
 53                                              },
 54                                          new Employee()
 55                                              {
 56                                                  Id = "3",
 57                                                  Name = "Dana",
 58                                                  LastName = "Birkby",
 59                                                  Phone = "(425) 555 7492",
 60                                                  Email = "Dana.Birkby@Contoso.com"
 61                                              },
 62                                          new Employee()
 63                                              {
 64                                                  Id = "4",
 65                                                  Name = "David",
 66                                                  LastName = "Probst",
 67                                                  Phone = "(425) 555 2836",
 68                                                  Email = "David.Probst@Contoso.com"
 69                                              },
 70                                      };
 71            }
 72
 73            return this.employees;
 74        }
 75
 76        public Projects GetProjects()
 77        {
 78            if (this.projects == null)
 79            {
 80                // Dummy data.
 81                this.projects = new Projects
 82                                     {
 83                                         new Project() {Id = "1", ProjectName = "Project 1", Role = "Dev Lead"},
 84                                         new Project() {Id = "1", ProjectName = "Project 2", Role = "Tech Reviewer"},
 85                                         new Project() {Id = "2", ProjectName = "Project 1", Role = "Test Lead"},
 86                                         new Project() {Id = "2", ProjectName = "Project 2", Role = "Tech Reviewer"},
 87                                         new Project() {Id = "3", ProjectName = "Project 1", Role = "Architect"},
 88                                         new Project() {Id = "3", ProjectName = "Project 2", Role = "Tech Reviewer"},
 89                                         new Project() {Id = "3", ProjectName = "Project 3", Role = "Tech Reviewer"},
 90                                         new Project() {Id = "4", ProjectName = "Project 1", Role = "Test Lead"},
 91                                         new Project() {Id = "4", ProjectName = "Project 2", Role = "Tech Reviewer"},
 92                                         new Project() {Id = "4", ProjectName = "Project 3", Role = "Tech Reviewer"},
 93                                         new Project() {Id = "4", ProjectName = "Project 4", Role = "Tech Reviewer"}
 94                                     };
 95            }
 96
 97            return this.projects;
 98        }
 99    }
100}