Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AlgorithmClassModel.cs @ 5700

Last change on this file since 5700 was 5700, checked in by wtollsch, 13 years ago

#1433 adjusted HLWebOKBAdminPlugin to new Service (AdministrationService)

File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using System.ServiceModel.Security;
6using System.Web.Security;
7using HLWebOKBAdminPlugin.OKBAdministrationService;
8
9namespace HLWebPluginHost.Models {
10    public class AlgorithmClassModel {
11
12        private AdministrationServiceClient CertificateValidator() {
13            AdministrationServiceClient asc = new AdministrationServiceClient();
14
15            asc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName;
16            asc.ClientCredentials.UserName.Password = HttpContext.Current.Session["pwd"].ToString();
17            asc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
18
19            return asc;
20        }//CertificateValidator
21
22        public int NumOfClasses { get; set; }
23        public List<AlgorithmClass> AlgorithmClassList { get; set; }
24
25        public List<AlgorithmClass> AlgorithmClassGetAll() {
26            //returns list of algorithm classes           
27            AdministrationServiceClient asc = CertificateValidator();
28
29            var agcList = new List<AlgorithmClass>();
30
31            AlgorithmClass[] ac = asc.GetAlgorithmClasses();
32            foreach (AlgorithmClass a in ac) {
33                agcList.Add(a);
34
35            }//foreach
36
37            return agcList;
38        }//AlgorithmClassGetAll
39
40        //Add AlgorithmClass table entry
41        public bool AddAlgorithmClass(string name, string description) {
42            long retValue;
43            //get service client
44            AdministrationServiceClient asc = CertificateValidator();
45
46            AlgorithmClass ac = new AlgorithmClass();
47            //test
48            //ac.Id = 8;
49            ac.Name = name;
50            ac.Description = description;
51            retValue = asc.AddAlgorithmClass(ac);
52           
53            return true;
54        }//AddAlgorithmClass
55    }
56}
Note: See TracBrowser for help on using the repository browser.