Exemplo n.º 1
0
 protected override void Initialize(RequestContext requestContext)
 {
     base.Initialize(requestContext);
     //get user
     ModelStateWrapper = new ModelStateWrapper(this);
     Service           = CreateService();
 }
        public void ReleaseInternalState(IModelState savedInternalState)
        {
            SavedState saveState = (SavedState)savedInternalState;

            saveState.time     = -1;
            saveState.timestep = -1;
            saveState.state    = null;
        }
        public void RestoreInternalState(IModelState savedInternalState)
        {
            SavedState saveState = (SavedState)savedInternalState;

            state    = saveState.state.Clone();
            timeStep = saveState.timestep;
            t        = saveState.time;
        }
Exemplo n.º 4
0
 public ServiceBase(IModelState modelState)
 {
     ModelState = modelState;
     Repository = CreateRepository();
     if (ModelState != null)
     {
         CurrentUserId = Repository.GetUserId(ModelState.Username);
     }
 }
Exemplo n.º 5
0
        public bool ValidateEvent(Event newEvent, IModelState modelState)
        {
            if (newEvent.Comments.Trim().Length == 0)
            {
                modelState.AddModelError("Comments", "Comments are undefined.");
            }

            return(modelState.IsValid);
        }
Exemplo n.º 6
0
        public Model(IModelState modelState)
        {
            Execution = new ModelExecution()
            {
                HandleTimeout            = TimeoutHandle,
                HandleUnhandledException = HandleError
            };

            ModelState = modelState;
        }
Exemplo n.º 7
0
        public ServiceBase(TRepo repository, IModelState modelState)
        {
            Repository = repository;
            ModelState = modelState;

            if (ModelState != null)
            {
                CurrentUserId = Repository.GetUserId(ModelState.Username);
            }
        }
Exemplo n.º 8
0
        public Model(IDisplayService displayService, IApplicationInsights applicationInsights, IErrorHandlingService errorHandlingService, IModelState modelState)
        {
            _displayService       = displayService;
            _errorHandlingService = errorHandlingService;
            _applicationInsights  = applicationInsights;

            ModelState = modelState;
            Execution  = new ModelExecution()
            {
                HandleTimeout            = TimeoutHandle,
                HandleUnhandledException = HandleError
            };
        }
Exemplo n.º 9
0
        public void SetNextModelState(IModelState modelState)
        {
            switch (modelState.ModelMode)
            {
            case ModelMode.Standard:
                modelState.SetState(ModelMode.DeadEndFilled);
                break;

            case ModelMode.DeadEndFilled:
                modelState.SetState(ModelMode.Standard);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 10
0
Arquivo: Model.cs Projeto: exrin/Exrin
        public Model(IExrinContainer exrinContainer, IModelState modelState)
        {
            if (exrinContainer == null)
                throw new ArgumentNullException(nameof(IExrinContainer));

            _displayService = exrinContainer.DisplayService;
            _errorHandlingService = exrinContainer.ErrorHandlingService;
            _applicationInsights = exrinContainer.ApplicationInsights;

            ModelState = modelState;
            Execution = new ModelExecution()
            {
                HandleTimeout = TimeoutHandle,
                HandleUnhandledException = HandleError
            };
        }
Exemplo n.º 11
0
        public Model(IExrinContainer exrinContainer, IModelState modelState)
        {
            if (exrinContainer == null)
            {
                throw new ArgumentNullException(nameof(IExrinContainer));
            }

            _displayService       = exrinContainer.DisplayService;
            _errorHandlingService = exrinContainer.ErrorHandlingService;
            _applicationInsights  = exrinContainer.ApplicationInsights;

            ModelState = modelState;
            Execution  = new ModelExecution()
            {
                HandleTimeout            = TimeoutHandle,
                HandleUnhandledException = HandleError
            };
        }
Exemplo n.º 12
0
 public ControllerContext(HttpContext httpContext, RouteEntity routeEntity) : base(httpContext, routeEntity)
 {
     //RouteData = httpContext.RouteData;
     ModelState = httpContext.Service.GetService <IModelState>();
 }
Exemplo n.º 13
0
 public WebContentService(IModelState modelState) : base(modelState)
 {
 }
Exemplo n.º 14
0
 public BaseModel(IExrinContainer exrinContainer, IModelState modelState)
     : base(exrinContainer, modelState)
 {
 }
Exemplo n.º 15
0
        public Proxel getProxelByState(IModelState s)
        {
            Proxel proxel;

            return((proxels.TryGetValue(s, out proxel)) ? proxel : null);
        }
Exemplo n.º 16
0
 public Proxel(IModelState s, double p)
 {
     State = s;
     P     = p;
 }
Exemplo n.º 17
0
 public ModelStateNode(IModelNode transformedNode, IModelState entityModelState)
 {
     TransformedNode  = transformedNode;
     EntityModelState = entityModelState;
 }
Exemplo n.º 18
0
 public void ReleaseInternalState(IModelState savedInternalState)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 19
0
        public static void AddError <TEntity>(this IModelState errors, Expression <Func <TEntity, object> > selector, string errorMessage)
        {
            var propertyName = selector.GetInputName();

            errors.AddError(propertyName, errorMessage);
        }
Exemplo n.º 20
0
 public BookingService(IModelState modelState)
     : base(modelState)
 {
 }