Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/11/13 10:15:52 (11 years ago)
Author:
fschoepp
Message:

#1888:

  • Janitor is now working as expected in Windows Azure
  • Added basic support for experiments (draggable experiments)
  • Added methods to save/read experiments from TableStorage
  • The job status can now be retrieved by using the GetTasks/GetTaskData methods
  • Added a class to convert JSON-objects to Algorithm instances
  • Web page: Added experiment button to navigation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/AdminController.cs

    r8958 r9215  
    1313using System.Web.Security;
    1414using HeuristicLab.Services.Optimization.ControllerService.Model;
     15using HeuristicLab.Services.Optimization.Web.Helpers;
    1516
    1617namespace HeuristicLab.Services.Optimization.Web.Controllers
     
    1920    public class AdminController : Controller
    2021    {
    21       public delegate T ControllerServiceDelegate<T>(IControllerService service);
    22       public delegate void ControllerServiceDelegate(IControllerService service);
    23 
    24       public T withControllerService<T>(ControllerServiceDelegate<T> del) {
    25         using (var cf = new ChannelFactory<IControllerService>(OptimizationController.DEFAULT_CONTROLLER_ENDPOINT)) {
    26           var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
    27           credentialBehaviour.UserName.UserName = Membership.GetUser().UserName;
    28           credentialBehaviour.UserName.Password = Session["pw"] as string;
    29           var controllerProxy = cf.CreateChannel();
    30           return del(controllerProxy);
     22      private ControllerServiceHelper ControllerService {
     23          get {
     24            var helper = new ControllerServiceHelper(Session["pw"] as string);
     25            if (!helper.Valid) {
     26              Response.Redirect("/Account/Logon");
     27            }
     28            return helper;
     29          }
    3130        }
    32       }
    33 
    34       public void withControllerService(ControllerServiceDelegate del) {
    35         using (var cf = new ChannelFactory<IControllerService>(OptimizationController.DEFAULT_CONTROLLER_ENDPOINT)) {
    36           var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
    37           credentialBehaviour.UserName.UserName = Membership.GetUser().UserName;
    38           credentialBehaviour.UserName.Password = Session["pw"] as string;
    39           var controllerProxy = cf.CreateChannel();
    40           del(controllerProxy);
    41         }
    42       }
    4331        //
    4432        // GET: /Admin/
     
    4634        public ActionResult Index()
    4735        {
    48           var names = withControllerService<IEnumerable<string>>((service) => {           
     36          var names = ControllerService.withControllerService<IEnumerable<string>>((service) => {           
    4937            User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
    5038            return service.GetOptimizationScenarioNames();
     
    6856          }
    6957
    70           var ok = withControllerService<bool>((service) => {
     58          var ok = ControllerService.withControllerService<bool>((service) => {
    7159            OptimizationModel model = new OptimizationModel();
    7260            User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
     
    7866
    7967        public ActionResult DeleteScenario(string id) {
    80           withControllerService<bool>((service) => {           
     68          ControllerService.withControllerService<bool>((service) => {           
    8169            User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
    8270            return service.DeleteHiveScenario(u, id);
Note: See TracChangeset for help on using the changeset viewer.