Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/17/11 11:16:41 (14 years ago)
Author:
gschwarz
Message:

#1433 Updated Problem Control/View; Added Algorithm Control/View => bug still exist in SortDesc

Location:
branches/WebApplication/MVC2/HLWebOKBAdminPlugin
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/ProblemController.cs

    r6162 r6213  
    2121        {
    2222            Session["SelectedSubMenu"] = "Problem";
    23       ProblemModel pm = new ProblemModel();
     23            ProblemModel pm = new ProblemModel();
    2424      return View(pm);
    2525    }
     
    4343            Session["SelectedSubMenu"] = "Problem";
    4444            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);
    4757        }
    4858        /// <summary>
     
    5666            // We use here the ProblemMode, but I think
    5767            // we can also use the Problem class. (?)
    58       ProblemModel pm = new ProblemModel();
     68            ProblemModel pm = new ProblemModel();
    5969            if(id == null)
    6070                pm.Problem = new Problem();
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AlgorithmModel.cs

    r6161 r6213  
    66using HLWebOKBAdminPlugin.Helpers;
    77
    8 namespace HLWebOKBAdminPlugin.Models {
     8namespace HLWebOKBAdminPlugin.Models
     9{
    910    public class AlgorithmModel {
    10        
     11
    1112        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(); } }
    1316
    1417        public Algorithm Algorithm { get; set; }
     
    1821        }//AlgorithmModel
    1922
    20         //***************************************Algorithms*************************************************
     23        //***************************************Algorithms***************************************************
    2124        private IList<Platform> PlatformsGetAll() {
    2225            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     
    3235
    3336            return platformList;
    34         }//ProblemClassGetAll
     37        }//AlgorithmClassGetAll
    3538
    36         private IList<ProblemClass> ProblemClassGetAll() {
     39        private IList<AlgorithmClass> AlgorithmClassGetAll() {
    3740            AdministrationServiceClient adminClient = Admin.GetClientFactory();
    3841
    39             IList<ProblemClass> problemClassList = new List<ProblemClass>();
     42            IList<AlgorithmClass> algorithmClassList = new List<AlgorithmClass>();
    4043
    4144            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);
    4548                }
    4649            }//if (adminClient != null)
    4750
    48             return problemClassList;
    49         }//ProblemClassGetAll
     51            return algorithmClassList;
     52        }//AlgorithmClassGetAll
    5053
    51         //get all algorithms
    52         private IList<Algorithm> AlgorithmsGetAll() {
     54        private IList<Algorithm> AlgorithmGetAll() {
    5355            AdministrationServiceClient adminClient = Admin.GetClientFactory();
    5456
     
    5759            if (adminClient != null) {
    5860                Algorithm[] algorithm = adminClient.GetAlgorithms();
    59                 foreach (Algorithm al in algorithm) {
    60                     algorithmList.Add(al);
     61                foreach(Algorithm alg in algorithm) {
     62                    algorithmList.Add(alg);
    6163
    6264                }
     
    6466
    6567            return algorithmList;
    66         }//AlgorithmsGetAll
     68        }//AlgorithmGetAll
    6769
    6870        private long AddAlgorithm(Algorithm algorithm) {
     
    9294                }
    9395                else {
    94                     Algorithm al = adminClient.GetAlgorithm(algorithm.Id);
     96                    Algorithm alg = adminClient.GetAlgorithm(algorithm.Id);
    9597
    96                     if (al != null) {
     98                    if (alg != null) {
    9799                        adminClient.UpdateAlgorithm(algorithm);
    98100                        return algorithm.Id;
     
    103105            return 0;
    104106        }//SaveAlgorithm
    105        
    106107    }
    107108}
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/ProblemModel.cs

    r6160 r6213  
    1111
    1212        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        }
    1417        public IList<ProblemClass> ProblemClasses { get { return ProblemClassGetAll(); } }
    1518        public IList<Platform> Platforms { get { return PlatformsGetAll(); } }
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Views/Admin/Menu.ascx

    r6130 r6213  
    66</li>
    77<li <% if(Session["SelectedSubMenu"] == "Algorithm") {%> class="selected" <%}%>>
    8     <%: Html.ActionLink("Algorithm", "Algorithm", "Admin") %>
     8    <%: Html.ActionLink("Algorithm", "Index", "Algorithm")%>
    99</li>
    1010<li <% if(Session["SelectedSubMenu"] == "ProblemClass") {%> class="selected" <%}%>>
Note: See TracChangeset for help on using the changeset viewer.