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

Last change on this file since 4985 was 4985, checked in by wtollsch, 12 years ago

#1198 HLWebOkbAdminPlugin

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