Changeset 6161
- Timestamp:
- 05/07/11 15:22:44 (14 years ago)
- Location:
- branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AdminModel.cs
r6117 r6161 13 13 14 14 public String SelectedSubMenu { get; set; } 15 public IList<AlgorithmClass> AlgorithmClassProp { get { return algorithmClassList; } set { ;} } 16 15 public IList<AlgorithmClass> AlgorithmClassProp { get { return AlgorithmClassGetAll(); } set { ;} } 16 17 17 18 //***************************************Algorithm Class******************************************** 18 19 //get all algorithm classes 19 p ublicIList<AlgorithmClass> AlgorithmClassGetAll() {20 private IList<AlgorithmClass> AlgorithmClassGetAll() { 20 21 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 21 22 … … 33 34 }//AlgorithmClassGetAll 34 35 35 public long AddAlgorithmClass(string name, string description) { 36 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 37 38 if (adminClient != null) { 39 AlgorithmClass ac = new AlgorithmClass(); 40 ac.Description = description; 41 ac.Name = name; 42 43 return adminClient.AddAlgorithmClass(ac); 36 private long AddAlgorithmClass(AlgorithmClass algorithmClass) { 37 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 38 39 if (adminClient != null) { 40 return adminClient.AddAlgorithmClass(algorithmClass); 44 41 } 45 42 … … 55 52 }//DeleteAlgorithmClass 56 53 57 public void UpdateAlgorithmClass(long id, string name, string description) { 58 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 59 60 if (adminClient != null) { 61 AlgorithmClass ac = adminClient.GetAlgorithmClass(id); 62 63 if (ac != null) { 64 ac.Id = id; 65 ac.Name = name; 66 ac.Description = description; 67 68 adminClient.UpdateAlgorithmClass(ac); 69 } 70 } 71 }//UpdateAlgorithmClass 54 public long SaveAlgorithmClass(AlgorithmClass algorithmClass) { 55 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 56 57 if (adminClient != null) { 58 if (algorithmClass.Id == 0) { 59 return AddAlgorithmClass(algorithmClass); 60 } 61 else { 62 AlgorithmClass ac = adminClient.GetAlgorithmClass(algorithmClass.Id); 63 64 if (ac != null) { 65 adminClient.UpdateAlgorithmClass(algorithmClass); 66 return algorithmClass.Id; 67 } 68 } 69 } 70 71 return 0; 72 }//SaveAlgorithmClass 72 73 73 74 //***************************************Algorithms************************************************* … … 89 90 }//AlgorithmsGetAll 90 91 91 public long AddAlgorithm(string name, string description, string dataTypeName, string dataTypeTypeName) { 92 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 93 94 if (adminClient != null) { 95 Algorithm al = new Algorithm(); 96 al.DataTypeName = dataTypeName; 97 al.DataTypeTypeName = dataTypeTypeName; 98 al.Description = description; 99 al.Name = name; 100 101 return adminClient.AddAlgorithm(al); 92 private long AddAlgorithm(Algorithm algorithm) { 93 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 94 95 if (adminClient != null) { 96 return adminClient.AddAlgorithm(algorithm); 102 97 } 103 98 … … 113 108 }//DeleteAlgorithm 114 109 115 public void UpdateAlgorithm(long id, string name, string description, string dataTypeName, string dataTypeTypeName) { 116 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 117 118 if (adminClient != null) { 119 Algorithm al = adminClient.GetAlgorithm(id); 120 121 if (al != null){ 122 al.DataTypeName = dataTypeName; 123 al.DataTypeTypeName = dataTypeTypeName; 124 al.Description = description; 125 al.Name = name; 126 127 adminClient.UpdateAlgorithm(al); 128 } 129 } 130 }//UpdateAlgorithm 110 public long SaveAlgorithm(Algorithm algorithm) { 111 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 112 113 if (adminClient != null) { 114 if (algorithm.Id == 0) { 115 return AddAlgorithm(algorithm); 116 } 117 else { 118 Algorithm al = adminClient.GetAlgorithm(algorithm.Id); 119 120 if (al != null) { 121 adminClient.UpdateAlgorithm(algorithm); 122 return algorithm.Id; 123 } 124 } 125 } 126 127 return 0; 128 }//SaveAlgorithm 131 129 132 130 //***************************************Problem Class********************************************** … … 146 144 }//ProblemClassGetAll 147 145 148 public long AddProblemClass(string name, string description) { 149 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 150 151 if (adminClient != null) { 152 ProblemClass pc = new ProblemClass(); 153 pc.Description = description; 154 pc.Name = name; 155 156 return adminClient.AddProblemClass(pc); 146 private long AddProblemClass(ProblemClass problemClass) { 147 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 148 149 if (adminClient != null) { 150 return adminClient.AddProblemClass(problemClass); 157 151 } 158 152 … … 168 162 }//DeleteProblemClass 169 163 170 public void UpdateProblemClass(long id, string name, string description) { 171 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 172 173 if (adminClient != null) { 174 ProblemClass pc = adminClient.GetProblemClass(id); 175 176 if (pc != null){ 177 pc.Id = id; 178 pc.Name = name; 179 pc.Description = description; 180 181 adminClient.UpdateProblemClass(pc); 182 } 183 } 184 }//UpdateProblemClass 164 public long SaveProblemClass(ProblemClass problemClass) { 165 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 166 167 if (adminClient != null) { 168 if (problemClass.Id == 0) { 169 return AddProblemClass(problemClass); 170 } 171 else { 172 ProblemClass pc = adminClient.GetProblemClass(problemClass.Id); 173 174 if (pc != null) { 175 adminClient.UpdateProblemClass(problemClass); 176 return problemClass.Id; 177 } 178 } 179 } 180 181 return 0; 182 }//SaveProblemClass 185 183 186 184 //***************************************Problems*************************************************** … … 201 199 }//ProblemsGetAll 202 200 203 public long AddProblem(string name, string description, string dataTypeName, string dataTypeTypeName) { 204 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 205 206 if (adminClient != null) { 207 Problem pr = new Problem(); 208 pr.DataTypeName = dataTypeName; 209 pr.DataTypeTypeName = dataTypeTypeName; 210 pr.Description = description; 211 pr.Name = name; 212 213 return adminClient.AddProblem(pr); 201 private long AddProblem(Problem problem) { 202 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 203 204 if (adminClient != null) { 205 return adminClient.AddProblem(problem); 214 206 } 215 207 … … 225 217 }//DeleteProblem 226 218 227 public void UpdateProblem(long id, string name, string description, string dataTypeName, string dataTypeTypeName) { 228 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 229 230 if (adminClient != null) { 231 Problem pr = adminClient.GetProblem(id); 232 233 if (pr != null) { 234 pr.DataTypeName = dataTypeName; 235 pr.DataTypeTypeName = dataTypeTypeName; 236 pr.Description = description; 237 pr.Name = name; 238 239 adminClient.UpdateProblem(pr); 240 } 241 } 242 }//UpdateProblem 219 public long SaveProblem(Problem problem) { 220 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 221 222 if (adminClient != null) { 223 if (problem.Id == 0) { 224 return AddProblem(problem); 225 } 226 else { 227 Problem pr = adminClient.GetProblem(problem.Id); 228 229 if (pr != null) { 230 adminClient.UpdateProblem(problem); 231 return problem.Id; 232 } 233 } 234 } 235 236 return 0; 237 }//SaveProblem 243 238 } 244 239 } -
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AlgorithmClassModel.cs
r6144 r6161 16 16 public AlgorithmClass AlgorithmClass { get; set; } 17 17 18 public AlgorithmClassModel() { 19 AlgorithmClass = new AlgorithmClass(); 20 }//AlgorithmClassModel 21 18 22 //***************************************Algorithm Class******************************************** 23 private IList<Platform> PlatformsGetAll() { 24 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 25 26 IList<Platform> platformList = new List<Platform>(); 27 28 if (adminClient != null) { 29 Platform[] platforms = adminClient.GetPlatforms(); 30 foreach (Platform pl in platforms) { 31 platformList.Add(pl); 32 } 33 }//if (adminClient != null) 34 35 return platformList; 36 }//ProblemClassGetAll 37 38 private IList<ProblemClass> ProblemClassGetAll() { 39 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 40 41 IList<ProblemClass> problemClassList = new List<ProblemClass>(); 42 43 if (adminClient != null) { 44 ProblemClass[] problemClasses = adminClient.GetProblemClasses(); 45 foreach (ProblemClass pc in problemClasses) { 46 problemClassList.Add(pc); 47 } 48 }//if (adminClient != null) 49 50 return problemClassList; 51 }//ProblemClassGetAll 52 19 53 //get all algorithm classes 20 54 private IList<AlgorithmClass> AlgorithmClassGetAll() {
Note: See TracChangeset
for help on using the changeset viewer.