Changeset 6213 for branches/WebApplication/MVC2/HLWebOKBAdminPlugin
- Timestamp:
- 05/17/11 11:16:41 (14 years ago)
- Location:
- branches/WebApplication/MVC2/HLWebOKBAdminPlugin
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/ProblemController.cs
r6162 r6213 21 21 { 22 22 Session["SelectedSubMenu"] = "Problem"; 23 23 ProblemModel pm = new ProblemModel(); 24 24 return View(pm); 25 25 } … … 43 43 Session["SelectedSubMenu"] = "Problem"; 44 44 ProblemModel pm = new ProblemModel(); 45 pm.Problems = pm.Problems.OrderByDescending(x => x.Name).ToArray<Problem>(); 46 return View("Index",pm); 45 46 //this is code for testing sortorder 47 IOrderedEnumerable<Problem> test = pm.Problems.OrderByDescending(x => x.Name); 48 IList<Problem> test2 = new List<Problem>(); 49 foreach(var item in test) { 50 test2.Add(item); 51 } 52 pm.Problems = test2; 53 54 // this should be the right code 55 //pm.Problems = pm.Problems.OrderByDescending(x => x.Name).ToArray<Problem>(); 56 return View("Index", pm); 47 57 } 48 58 /// <summary> … … 56 66 // We use here the ProblemMode, but I think 57 67 // we can also use the Problem class. (?) 58 68 ProblemModel pm = new ProblemModel(); 59 69 if(id == null) 60 70 pm.Problem = new Problem(); -
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AlgorithmModel.cs
r6161 r6213 6 6 using HLWebOKBAdminPlugin.Helpers; 7 7 8 namespace HLWebOKBAdminPlugin.Models { 8 namespace HLWebOKBAdminPlugin.Models 9 { 9 10 public class AlgorithmModel { 10 11 11 12 public String SelectedSubMenu { get; set; } 12 public IList<Algorithm> Algorithms { get { return AlgorithmsGetAll(); } } 13 public IList<Algorithm> Algorithms { get { return AlgorithmGetAll(); } set { ;} } 14 public IList<AlgorithmClass> AlgorithmClasses { get { return AlgorithmClassGetAll(); } } 15 public IList<Platform> Platforms { get { return PlatformsGetAll(); } } 13 16 14 17 public Algorithm Algorithm { get; set; } … … 18 21 }//AlgorithmModel 19 22 20 //***************************************Algorithms************************************************* 23 //***************************************Algorithms*************************************************** 21 24 private IList<Platform> PlatformsGetAll() { 22 25 AdministrationServiceClient adminClient = Admin.GetClientFactory(); … … 32 35 33 36 return platformList; 34 }// ProblemClassGetAll37 }//AlgorithmClassGetAll 35 38 36 private IList< ProblemClass> ProblemClassGetAll() {39 private IList<AlgorithmClass> AlgorithmClassGetAll() { 37 40 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 38 41 39 IList< ProblemClass> problemClassList = new List<ProblemClass>();42 IList<AlgorithmClass> algorithmClassList = new List<AlgorithmClass>(); 40 43 41 44 if (adminClient != null) { 42 ProblemClass[] problemClasses = adminClient.GetProblemClasses();43 foreach (ProblemClass pc in problemClasses) {44 problemClassList.Add(pc);45 AlgorithmClass[] algorithmClasses = adminClient.GetAlgorithmClasses(); 46 foreach(AlgorithmClass ac in algorithmClasses) { 47 algorithmClassList.Add(ac); 45 48 } 46 49 }//if (adminClient != null) 47 50 48 return problemClassList;49 }// ProblemClassGetAll51 return algorithmClassList; 52 }//AlgorithmClassGetAll 50 53 51 //get all algorithms 52 private IList<Algorithm> AlgorithmsGetAll() { 54 private IList<Algorithm> AlgorithmGetAll() { 53 55 AdministrationServiceClient adminClient = Admin.GetClientFactory(); 54 56 … … 57 59 if (adminClient != null) { 58 60 Algorithm[] algorithm = adminClient.GetAlgorithms(); 59 foreach (Algorithm alin algorithm) {60 algorithmList.Add(al );61 foreach(Algorithm alg in algorithm) { 62 algorithmList.Add(alg); 61 63 62 64 } … … 64 66 65 67 return algorithmList; 66 }//Algorithm sGetAll68 }//AlgorithmGetAll 67 69 68 70 private long AddAlgorithm(Algorithm algorithm) { … … 92 94 } 93 95 else { 94 Algorithm al = adminClient.GetAlgorithm(algorithm.Id);96 Algorithm alg = adminClient.GetAlgorithm(algorithm.Id); 95 97 96 if (al != null) {98 if (alg != null) { 97 99 adminClient.UpdateAlgorithm(algorithm); 98 100 return algorithm.Id; … … 103 105 return 0; 104 106 }//SaveAlgorithm 105 106 107 } 107 108 } -
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/ProblemModel.cs
r6160 r6213 11 11 12 12 public String SelectedSubMenu { get; set; } 13 public IList<Problem> Problems { get { return ProblemsGetAll(); } set { ;} } 13 public IList<Problem> Problems { 14 get { return ProblemsGetAll(); } 15 set { ;} 16 } 14 17 public IList<ProblemClass> ProblemClasses { get { return ProblemClassGetAll(); } } 15 18 public IList<Platform> Platforms { get { return PlatformsGetAll(); } } -
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Views/Admin/Menu.ascx
r6130 r6213 6 6 </li> 7 7 <li <% if(Session["SelectedSubMenu"] == "Algorithm") {%> class="selected" <%}%>> 8 <%: Html.ActionLink("Algorithm", " Algorithm", "Admin")%>8 <%: Html.ActionLink("Algorithm", "Index", "Algorithm")%> 9 9 </li> 10 10 <li <% if(Session["SelectedSubMenu"] == "ProblemClass") {%> class="selected" <%}%>>
Note: See TracChangeset
for help on using the changeset viewer.