Пример #1
0
 public static void ClearUnused()
 {
     if (_lastClearTime < DateTime.Now.AddMinutes(-15))
     {
         _lastClearTime = DateTime.Now;
         UserContextService.ClearUnused();
     }
 }
Пример #2
0
 public HolidayApprovalWorkflow(
     ILoggerFactory loggerFactory,
     UserContextService userContextService
     )
 {
     this._logger             = loggerFactory.CreateLogger <HolidayApprovalWorkflow>();
     this._userContextService = userContextService;
 }
Пример #3
0
 public HolidayService(
     DomainContext context,
     IWorkflowEngine workflowEngine,
     UserContextService userContext
     )
 {
     this._context        = context;
     this._workflowEngine = workflowEngine;
     this._userContext    = userContext;
 }
Пример #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSession();
            UserContextService.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>());
            app.UseMvc();
        }
Пример #5
0
        public User FindOrCreate()
        {
            var userInfo = UserContextService.GetUserInfo();
            var user     = _userRepository.Get(userInfo.Id);

            if (user != null)
            {
                return(user);
            }

            _userRepository.UseTransaction(() =>
            {
                user = new User(userInfo.Id, userInfo.DisplayName);

                _userRepository.Add(user);
                _userRepository.SaveChanges(); // TODO: should not do this here
            });
            return(user);
        }
Пример #6
0
 public static void GroupMembersAbandon(Guid groupId)
 {
     UserContextService.GroupMembersAbandon(groupId);
 }
Пример #7
0
 public static void Abandon(Guid userId)
 {
     UserContextService.Abandon(userId);
 }
Пример #8
0
        public static void Abandon()
        {
            var key = HttpContext.Current.User.Identity.Name;

            UserContextService.Abandon(key);
        }