Rev | Line | |
---|
[5756] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Web;
|
---|
| 5 | using System.ServiceModel.Security;
|
---|
| 6 | using System.Web.Security;
|
---|
| 7 | using HLWebOKBAdminPlugin.OKBAdministrationService;
|
---|
| 8 |
|
---|
| 9 | namespace 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.