Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6117


Ignore:
Timestamp:
05/03/11 20:31:27 (13 years ago)
Author:
wtollsch
Message:

#1433 completed add, delete and update methods for AlgorithmClass, Algorithm, ProblemClass, Problem in AdminModel

Location:
branches/WebApplication/MVC2/HLWebOKBAdminPlugin
Files:
3 edited

Legend:

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

    r6050 r6117  
    3939            AdminModel am = new AdminModel();
    4040            Session["SelectedSubMenu"] = "AlgorithmClass";
    41             var algorithmClasses = am.AlgorithmClassGetAll();
    42            
     41            var algorithmClasses = am.AlgorithmClassGetAll();           
     42
    4343            return View(algorithmClasses);
    4444        }//ActionResult AlgorithmClass
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AdminModel.cs

    r6050 r6117  
    1111        private IList<AlgorithmClass> algorithmClassList;
    1212
     13
    1314        public String SelectedSubMenu { get; set; }
    1415        public IList<AlgorithmClass> AlgorithmClassProp { get { return algorithmClassList; } set { ;} }
    1516
     17        //***************************************Algorithm Class********************************************
    1618        //get all algorithm classes
    1719        public IList<AlgorithmClass> AlgorithmClassGetAll() {
     
    3032            return algorithmClassList;
    3133        }//AlgorithmClassGetAll
    32        
     34
     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);
     44            }
     45
     46            return 0;
     47        }//AddAlgorithmClass
     48
     49        public void DeleteAlgorithmClass(long id) {
     50            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     51
     52            if (adminClient != null){
     53                adminClient.DeleteAlgorithmClass(id);
     54            }
     55        }//DeleteAlgorithmClass
     56
     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
     72
     73        //***************************************Algorithms*************************************************
    3374        //get all algorithms
    3475        public IList<Algorithm> AlgorithmsGetAll() {
     
    4889        }//AlgorithmsGetAll
    4990
     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);
     102            }
     103
     104            return 0;
     105        }//AddAlgorithm
     106
     107        public void DeleteAlgorithm(long id) {
     108            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     109
     110            if (adminClient != null) {
     111                adminClient.DeleteAlgorithm(id);
     112            }
     113        }//DeleteAlgorithm
     114
     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
     131
     132        //***************************************Problem Class**********************************************
    50133        public IList<ProblemClass> ProblemClassGetAll() {
    51134            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     
    63146        }//ProblemClassGetAll
    64147
     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);
     157            }
     158
     159            return 0;
     160        }//AddProblemClass
     161
     162        public void DeleteProblemClass(long id) {
     163            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     164
     165            if (adminClient != null) {
     166                adminClient.DeleteProblemClass(id);
     167            }
     168        }//DeleteProblemClass
     169
     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
     185
     186        //***************************************Problems***************************************************
    65187        public IList<Problem> ProblemsGetAll() {
    66188            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     
    78200            return problemList;
    79201        }//ProblemsGetAll
     202
     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);
     214            }
     215
     216            return 0;
     217        }//AddProblem
     218
     219        public void DeleteProblem(long id) {
     220            AdministrationServiceClient adminClient = Admin.GetClientFactory();
     221
     222            if (adminClient != null) {
     223                adminClient.DeleteProblem(id);
     224            }
     225        }//DeleteProblem
     226
     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
    80243    }
    81244}
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Views/Admin/Algorithm.aspx

    r6050 r6117  
    1616
    1717    <asp:ListBox ID="lbxAlgorithm" runat="server" DataSourceID="odsAlgorithm"
    18         DataTextField="Name" DataValueField="Id" Width="240px" Height="350px" style="margin-top: 0px"></asp:ListBox>
     18        DataTextField="Name" DataValueField="Id" Width="240px" Height="350px"
     19        style="margin-top: 0px" AutoPostBack="True"></asp:ListBox>
    1920    <asp:ObjectDataSource ID="odsAlgorithm" runat="server"
    2021        SelectMethod="AlgorithmsGetAll"
Note: See TracChangeset for help on using the changeset viewer.