Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/11 20:56:57 (13 years ago)
Author:
wtollsch
Message:

#1433 adjusted HLWebOKBAdminPlugin to new Service (AdministrationService)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/AlgorithmClassModel.cs

    r5005 r5700  
    55using System.ServiceModel.Security;
    66using System.Web.Security;
     7using HLWebOKBAdminPlugin.OKBAdministrationService;
    78
    89namespace HLWebPluginHost.Models {
    910    public class AlgorithmClassModel {
    1011
     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
    1122        public int NumOfClasses { get; set; }
    12         public List<OKBService.AlgorithmClass> AlgorithmClassList { get; set; }
     23        public List<AlgorithmClass> AlgorithmClassList { get; set; }
    1324
    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();
    2028
    21             var agcList = new List<OKBService.AlgorithmClass>();
     29            var agcList = new List<AlgorithmClass>();
    2230
    23             OKBService.AlgorithmClass[] ac = sc.GetAlgorithmClasses();
    24             foreach (OKBService.AlgorithmClass a in ac) {
     31            AlgorithmClass[] ac = asc.GetAlgorithmClasses();
     32            foreach (AlgorithmClass a in ac) {
    2533                agcList.Add(a);
    2634
     
    3442            long retValue;
    3543            //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();
    4045
    41             OKBService.AlgorithmClass ac = new OKBService.AlgorithmClass();
     46            AlgorithmClass ac = new AlgorithmClass();
    4247            //test
    4348            //ac.Id = 8;
    4449            ac.Name = name;
    4550            ac.Description = description;
    46             retValue = sc.AddAlgorithmClass(ac);
     51            retValue = asc.AddAlgorithmClass(ac);
    4752           
    4853            return true;
Note: See TracChangeset for help on using the changeset viewer.