Free cookie consent management tool by TermsFeed Policy Generator

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

#1433 adjusted HLWebOKBAdminPlugin to new Service (AdministrationService)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/AlgorithmClassController.cs

    r5258 r5700  
    77using System.Web.Security;
    88using System.ServiceModel.Security;
    9 using HLWebPluginHost.OKBService;
     9//using HLWebPluginHost.OKBService;
    1010using System.Diagnostics;
     11using HLWebOKBAdminPlugin.OKBAdministrationService;
     12using HLWebOKBAdminPlugin.OKBAuthenticationService;
    1113
    1214namespace HLWebOKBAdminPlugin.Controllers
     
    2224
    2325        //returns a certificated service client for current user .... call this function in every method
    24         private OKBService.OKBServiceClient CertificateValidator() {
    25             OKBService.OKBServiceClient sc = new OKBService.OKBServiceClient();
    26 
    27             sc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName;
    28             sc.ClientCredentials.UserName.Password = HttpContext.Session["pwd"].ToString();
    29             sc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
    30 
    31             return sc;
    32         }//CertificateValidator       
     26                         
     27        //private OKBService.OKBServiceClient CertificateValidator() {
     28        //    OKBService.OKBServiceClient sc = new OKBService.OKBServiceClient();
     29        //    sc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName;
     30        //    //sc.ClientCredentials.UserName.Password = HttpContext.Session["pwd"].ToString();
     31        //    sc.ClientCredentials.UserName.Password = "Gerhard";
     32        //    sc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
     33
     34        //    return sc;
     35        //}//CertificateValidator   
     36
     37        private AdministrationServiceClient CertificateValidator() {
     38            AdministrationServiceClient asc = new AdministrationServiceClient();
     39
     40            asc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName;
     41            //asc.ClientCredentials.UserName.Password = HttpContext.Session["pwd"].ToString();
     42            asc.ClientCredentials.UserName.Password = "Gerhard";
     43            asc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
     44
     45            return asc;
     46        }//CertificateValidator
    3347
    3448        //
     
    4256
    4357            //get certificated service client
    44             OKBService.OKBServiceClient sc = CertificateValidator();
     58            AdministrationServiceClient asc = CertificateValidator();                       
    4559
    4660            var tstModel = new AlgorithmClassViewModel {
     
    5266            //get list of Algorithm Classes
    5367            var algorithmClasses = new List<AlgorithmClass>();
    54             AlgorithmClass[] ac = sc.GetAlgorithmClasses();
     68            AlgorithmClass[] ac = asc.GetAlgorithmClasses();
    5569            foreach (AlgorithmClass a in ac) {
    5670                algorithmClasses.Add(a);
     
    7084
    7185            //get certificated service client
    72             OKBService.OKBServiceClient sc = CertificateValidator();
     86            AdministrationServiceClient asc = CertificateValidator();
    7387
    7488            //the viewmodel contains data for the view
    7589            var viewModel = new AlgorithmClassViewModel {
    76                 AlgorithmClass = sc.GetAlgorithmClass(id)
     90                AlgorithmClass = asc.GetAlgorithmClass(id)
    7791            };
    7892
     
    91105
    92106            //get certificated service client
    93             OKBService.OKBServiceClient sc = CertificateValidator();
     107            AdministrationServiceClient asc = CertificateValidator();
    94108
    95109            //the viewmodel with empty AlgorithmClass object
     
    113127            try {
    114128                //get certificated service client
    115                 OKBService.OKBServiceClient sc = CertificateValidator();
     129                AdministrationServiceClient asc = CertificateValidator();
    116130
    117131                //create new AlgorithmClass object
    118                 AlgorithmClass ac = new HLWebPluginHost.OKBService.AlgorithmClass();
     132                AlgorithmClass ac = new AlgorithmClass();
    119133                ac.Id = algorithmClass.Id;
    120134                ac.Name = algorithmClass.Name;
     
    122136
    123137                //add new AlgorithmClass
    124                 sc.AddAlgorithmClass(ac);
     138                asc.AddAlgorithmClass(ac);
    125139
    126140                //redirect to the home page
     
    148162           
    149163            //get certificated service client
    150             OKBService.OKBServiceClient sc = CertificateValidator();
     164            AdministrationServiceClient asc = CertificateValidator();
    151165
    152166            //the viewmodel contains data for the view
    153167            var viewModel = new AlgorithmClassViewModel {
    154                 AlgorithmClass = sc.GetAlgorithmClass(id)
     168                AlgorithmClass = asc.GetAlgorithmClass(id)
    155169            };
    156170
     
    169183
    170184            //get certificated service client
    171             OKBService.OKBServiceClient sc = CertificateValidator();
     185            AdministrationServiceClient asc = CertificateValidator();
    172186
    173187            //get AlgorithmClass object from DB
    174             var algorithmClass = sc.GetAlgorithmClass(id);
     188            var algorithmClass = asc.GetAlgorithmClass(id);
    175189
    176190            try {
     
    178192                UpdateModel(algorithmClass, "AlgorithmClass");
    179193
    180                 AlgorithmClass ac = new HLWebPluginHost.OKBService.AlgorithmClass();
     194                AlgorithmClass ac = new AlgorithmClass();
    181195                ac.Id = algorithmClass.Id;
    182196                ac.Name = algorithmClass.Name;
    183197                ac.Description = algorithmClass.Description;
    184198
    185                 sc.UpdateAlgorithmClass(ac);
     199                asc.UpdateAlgorithmClass(ac);
    186200
    187201                return RedirectToAction("Index");
     
    207221
    208222            //get certificated service client
    209             OKBService.OKBServiceClient sc = CertificateValidator();
     223            AdministrationServiceClient asc = CertificateValidator();
    210224
    211225            //the viewmodel contains data for the view
    212226            var viewModel = new AlgorithmClassViewModel {
    213                 AlgorithmClass = sc.GetAlgorithmClass(id)
     227                AlgorithmClass = asc.GetAlgorithmClass(id)
    214228            };
    215229
     
    228242   
    229243            //get certificated service client
    230             OKBService.OKBServiceClient sc = CertificateValidator();
     244            AdministrationServiceClient asc = CertificateValidator();
    231245
    232246            //load object from db
    233             var algorithmClass = sc.GetAlgorithmClass(id);
     247            var algorithmClass = asc.GetAlgorithmClass(id);
    234248
    235249            try {
    236250                //delete object
    237                 sc.DeleteAlgorithmClass(id);
     251                asc.DeleteAlgorithmClass(id);
    238252
    239253                return RedirectToAction("Index");
Note: See TracChangeset for help on using the changeset viewer.