Changeset 6160 for branches/WebApplication/MVC2
- Timestamp:
- 05/07/11 14:45:38 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/ProblemModel.cs
r6153 r6160 8 8 namespace HLWebOKBAdminPlugin.Models 9 9 { 10 public class ProblemModel 11 { 12 /// <summary> 13 /// Get all Problems. 14 /// </summary> 15 public List<Problem> Problems 16 { 17 get 18 { 19 AdministrationServiceClient adminClient = Admin.GetClientFactory("okbtester", "okbtester"); 20 IList<Problem> problemList = new List<Problem>(); 21 Problem[] problems = adminClient.GetProblems(); 22 return problems.ToList<Problem>(); 23 } 24 } 10 public class ProblemModel { 25 11 26 public List<ProblemClass> ProblemClasses { 27 get { 28 AdministrationServiceClient adminClient = Admin.GetClientFactory("okbtester", "okbtester"); 29 IList<ProblemClass> problemClassList = new List<ProblemClass>(); 30 ProblemClass[] problemClass = adminClient.GetProblemClasses(); 31 return problemClass.ToList<ProblemClass>(); 32 } 33 } 12 public String SelectedSubMenu { get; set; } 13 public IList<Problem> Problems { get { return ProblemsGetAll(); } set { ;} } 14 public IList<ProblemClass> ProblemClasses { get { return ProblemClassGetAll(); } } 15 public IList<Platform> Platforms { get { return PlatformsGetAll(); } } 34 16 35 public List<Platform> Plattforms {36 get {37 AdministrationServiceClient adminClient = Admin.GetClientFactory("okbtester", "okbtester");38 IList<Platform> plattformList = new List<Platform>();39 Platform[] plattforms = adminClient.GetPlatforms();40 return plattforms.ToList<Platform>();41 }42 }43 44 /// <summary>45 /// Curretn Problem (for Detail)46 /// </summary>47 17 public Problem Problem { get; set; } 48 18 49 public void SaveProblem(Problem problem) { 50 AdministrationServiceClient adminClient = Admin.GetClientFactory("okbtester", "okbtester"); 51 adminClient.UpdateProblem(problem); 52 } 19 public ProblemModel() { 20 Problem = new Problem(); 21 }//ProblemModel 53 22 23 //***************************************Problems*************************************************** 24 private IList<Platform> PlatformsGetAll() { 25 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 54 26 27 IList<Platform> platformList = new List<Platform>(); 28 29 if (adminClient != null) { 30 Platform[] platforms = adminClient.GetPlatforms(); 31 foreach (Platform pl in platforms) { 32 platformList.Add(pl); 33 } 34 }//if (adminClient != null) 35 36 return platformList; 37 }//ProblemClassGetAll 38 39 private IList<ProblemClass> ProblemClassGetAll() { 40 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 41 42 IList<ProblemClass> problemClassList = new List<ProblemClass>(); 43 44 if (adminClient != null) { 45 ProblemClass[] problemClasses = adminClient.GetProblemClasses(); 46 foreach (ProblemClass pc in problemClasses) { 47 problemClassList.Add(pc); 48 } 49 }//if (adminClient != null) 50 51 return problemClassList; 52 }//ProblemClassGetAll 53 54 private IList<Problem> ProblemsGetAll() { 55 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 56 57 IList<Problem> problemList = new List<Problem>(); 58 59 if (adminClient != null) { 60 Problem[] problem = adminClient.GetProblems(); 61 foreach (Problem pr in problem) { 62 problemList.Add(pr); 63 64 } 65 }//if (adminClient != null) 66 67 return problemList; 68 }//ProblemsGetAll 69 70 private long AddProblem(Problem problem) { 71 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 72 73 if (adminClient != null) { 74 return adminClient.AddProblem(problem); 75 } 76 77 return 0; 78 }//AddProblem 79 80 public void DeleteProblem(long id) { 81 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 82 83 if (adminClient != null) { 84 adminClient.DeleteProblem(id); 85 } 86 }//DeleteProblem 87 88 public long SaveProblem(Problem problem) { 89 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 90 91 if (adminClient != null) { 92 if (problem.Id == 0) { 93 return AddProblem(problem); 94 } 95 else { 96 Problem pr = adminClient.GetProblem(problem.Id); 97 98 if (pr != null) { 99 adminClient.UpdateProblem(problem); 100 return problem.Id; 101 } 102 } 103 } 104 105 return 0; 106 }//SaveProblem 55 107 } 56 108 }
Note: See TracChangeset
for help on using the changeset viewer.