- Timestamp:
- 03/15/11 20:56:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/AlgorithmClassController.cs
r5258 r5700 7 7 using System.Web.Security; 8 8 using System.ServiceModel.Security; 9 using HLWebPluginHost.OKBService;9 //using HLWebPluginHost.OKBService; 10 10 using System.Diagnostics; 11 using HLWebOKBAdminPlugin.OKBAdministrationService; 12 using HLWebOKBAdminPlugin.OKBAuthenticationService; 11 13 12 14 namespace HLWebOKBAdminPlugin.Controllers … … 22 24 23 25 //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 33 47 34 48 // … … 42 56 43 57 //get certificated service client 44 OKBService.OKBServiceClient sc = CertificateValidator();58 AdministrationServiceClient asc = CertificateValidator(); 45 59 46 60 var tstModel = new AlgorithmClassViewModel { … … 52 66 //get list of Algorithm Classes 53 67 var algorithmClasses = new List<AlgorithmClass>(); 54 AlgorithmClass[] ac = sc.GetAlgorithmClasses();68 AlgorithmClass[] ac = asc.GetAlgorithmClasses(); 55 69 foreach (AlgorithmClass a in ac) { 56 70 algorithmClasses.Add(a); … … 70 84 71 85 //get certificated service client 72 OKBService.OKBServiceClientsc = CertificateValidator();86 AdministrationServiceClient asc = CertificateValidator(); 73 87 74 88 //the viewmodel contains data for the view 75 89 var viewModel = new AlgorithmClassViewModel { 76 AlgorithmClass = sc.GetAlgorithmClass(id)90 AlgorithmClass = asc.GetAlgorithmClass(id) 77 91 }; 78 92 … … 91 105 92 106 //get certificated service client 93 OKBService.OKBServiceClientsc = CertificateValidator();107 AdministrationServiceClient asc = CertificateValidator(); 94 108 95 109 //the viewmodel with empty AlgorithmClass object … … 113 127 try { 114 128 //get certificated service client 115 OKBService.OKBServiceClientsc = CertificateValidator();129 AdministrationServiceClient asc = CertificateValidator(); 116 130 117 131 //create new AlgorithmClass object 118 AlgorithmClass ac = new HLWebPluginHost.OKBService.AlgorithmClass();132 AlgorithmClass ac = new AlgorithmClass(); 119 133 ac.Id = algorithmClass.Id; 120 134 ac.Name = algorithmClass.Name; … … 122 136 123 137 //add new AlgorithmClass 124 sc.AddAlgorithmClass(ac);138 asc.AddAlgorithmClass(ac); 125 139 126 140 //redirect to the home page … … 148 162 149 163 //get certificated service client 150 OKBService.OKBServiceClientsc = CertificateValidator();164 AdministrationServiceClient asc = CertificateValidator(); 151 165 152 166 //the viewmodel contains data for the view 153 167 var viewModel = new AlgorithmClassViewModel { 154 AlgorithmClass = sc.GetAlgorithmClass(id)168 AlgorithmClass = asc.GetAlgorithmClass(id) 155 169 }; 156 170 … … 169 183 170 184 //get certificated service client 171 OKBService.OKBServiceClientsc = CertificateValidator();185 AdministrationServiceClient asc = CertificateValidator(); 172 186 173 187 //get AlgorithmClass object from DB 174 var algorithmClass = sc.GetAlgorithmClass(id);188 var algorithmClass = asc.GetAlgorithmClass(id); 175 189 176 190 try { … … 178 192 UpdateModel(algorithmClass, "AlgorithmClass"); 179 193 180 AlgorithmClass ac = new HLWebPluginHost.OKBService.AlgorithmClass();194 AlgorithmClass ac = new AlgorithmClass(); 181 195 ac.Id = algorithmClass.Id; 182 196 ac.Name = algorithmClass.Name; 183 197 ac.Description = algorithmClass.Description; 184 198 185 sc.UpdateAlgorithmClass(ac);199 asc.UpdateAlgorithmClass(ac); 186 200 187 201 return RedirectToAction("Index"); … … 207 221 208 222 //get certificated service client 209 OKBService.OKBServiceClientsc = CertificateValidator();223 AdministrationServiceClient asc = CertificateValidator(); 210 224 211 225 //the viewmodel contains data for the view 212 226 var viewModel = new AlgorithmClassViewModel { 213 AlgorithmClass = sc.GetAlgorithmClass(id)227 AlgorithmClass = asc.GetAlgorithmClass(id) 214 228 }; 215 229 … … 228 242 229 243 //get certificated service client 230 OKBService.OKBServiceClientsc = CertificateValidator();244 AdministrationServiceClient asc = CertificateValidator(); 231 245 232 246 //load object from db 233 var algorithmClass = sc.GetAlgorithmClass(id);247 var algorithmClass = asc.GetAlgorithmClass(id); 234 248 235 249 try { 236 250 //delete object 237 sc.DeleteAlgorithmClass(id);251 asc.DeleteAlgorithmClass(id); 238 252 239 253 return RedirectToAction("Index");
Note: See TracChangeset
for help on using the changeset viewer.