PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/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. //===================================================================================
  17. using EmployeeModule.Models;
  18. using UIComposition.EmployeeModule.Models;
  19. namespace UIComposition.EmployeeModule.Services
  20. {
  21. /// <summary>
  22. /// Dummy employee data service class. Provides dummy data for employees and projects.
  23. /// Replace with your real employee data access or employee data service proxy.
  24. /// </summary>
  25. public class EmployeeDataService : IEmployeeDataService
  26. {
  27. private Employees employees;
  28. private Projects projects;
  29. public Employees GetEmployees()
  30. {
  31. if (this.employees == null)
  32. {
  33. // Dummy Data.
  34. this.employees = new Employees
  35. {
  36. new Employee()
  37. {
  38. Id = "1",
  39. Name = "John",
  40. LastName = "Smith",
  41. Phone = "(425) 555 8912",
  42. Email = "John.Smith@Contoso.com"
  43. },
  44. new Employee()
  45. {
  46. Id = "2",
  47. Name = "Bonnie",
  48. LastName = "Skelly",
  49. Phone = "(206) 555 7301",
  50. Email = "Bonnie.Skelly@Contoso.com"
  51. },
  52. new Employee()
  53. {
  54. Id = "3",
  55. Name = "Dana",
  56. LastName = "Birkby",
  57. Phone = "(425) 555 7492",
  58. Email = "Dana.Birkby@Contoso.com"
  59. },
  60. new Employee()
  61. {
  62. Id = "4",
  63. Name = "David",
  64. LastName = "Probst",
  65. Phone = "(425) 555 2836",
  66. Email = "David.Probst@Contoso.com"
  67. },
  68. };
  69. }
  70. return this.employees;
  71. }
  72. public Projects GetProjects()
  73. {
  74. if (this.projects == null)
  75. {
  76. // Dummy data.
  77. this.projects = new Projects
  78. {
  79. new Project() {Id = "1", ProjectName = "Project 1", Role = "Dev Lead"},
  80. new Project() {Id = "1", ProjectName = "Project 2", Role = "Tech Reviewer"},
  81. new Project() {Id = "2", ProjectName = "Project 1", Role = "Test Lead"},
  82. new Project() {Id = "2", ProjectName = "Project 2", Role = "Tech Reviewer"},
  83. new Project() {Id = "3", ProjectName = "Project 1", Role = "Architect"},
  84. new Project() {Id = "3", ProjectName = "Project 2", Role = "Tech Reviewer"},
  85. new Project() {Id = "3", ProjectName = "Project 3", Role = "Tech Reviewer"},
  86. new Project() {Id = "4", ProjectName = "Project 1", Role = "Test Lead"},
  87. new Project() {Id = "4", ProjectName = "Project 2", Role = "Tech Reviewer"},
  88. new Project() {Id = "4", ProjectName = "Project 3", Role = "Tech Reviewer"},
  89. new Project() {Id = "4", ProjectName = "Project 4", Role = "Tech Reviewer"}
  90. };
  91. }
  92. return this.projects;
  93. }
  94. }
  95. }