Changeset 5700 for branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models
- Timestamp:
- 03/15/11 20:56:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AlgorithmClassModel.cs
r5005 r5700 5 5 using System.ServiceModel.Security; 6 6 using System.Web.Security; 7 using HLWebOKBAdminPlugin.OKBAdministrationService; 7 8 8 9 namespace HLWebPluginHost.Models { 9 10 public class AlgorithmClassModel { 10 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 11 22 public int NumOfClasses { get; set; } 12 public List< OKBService.AlgorithmClass> AlgorithmClassList { get; set; }23 public List<AlgorithmClass> AlgorithmClassList { get; set; } 13 24 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; 25 public List<AlgorithmClass> AlgorithmClassGetAll() { 26 //returns list of algorithm classes 27 AdministrationServiceClient asc = CertificateValidator(); 20 28 21 var agcList = new List< OKBService.AlgorithmClass>();29 var agcList = new List<AlgorithmClass>(); 22 30 23 OKBService.AlgorithmClass[] ac =sc.GetAlgorithmClasses();24 foreach ( OKBService.AlgorithmClass a in ac) {31 AlgorithmClass[] ac = asc.GetAlgorithmClasses(); 32 foreach (AlgorithmClass a in ac) { 25 33 agcList.Add(a); 26 34 … … 34 42 long retValue; 35 43 //get service client 36 OKBService.OKBServiceClient sc = new OKBService.OKBServiceClient(); 37 sc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName; 38 sc.ClientCredentials.UserName.Password = HttpContext.Current.Session["pwd"].ToString(); 39 sc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; 44 AdministrationServiceClient asc = CertificateValidator(); 40 45 41 OKBService.AlgorithmClass ac = new OKBService.AlgorithmClass();46 AlgorithmClass ac = new AlgorithmClass(); 42 47 //test 43 48 //ac.Id = 8; 44 49 ac.Name = name; 45 50 ac.Description = description; 46 retValue = sc.AddAlgorithmClass(ac);51 retValue = asc.AddAlgorithmClass(ac); 47 52 48 53 return true;
Note: See TracChangeset
for help on using the changeset viewer.