private static void HeadsetConnectedOK(object sender, string headsetId)
        {
            Console.WriteLine("HeadsetConnectedOK " + headsetId);

            // CreateSession
            _sessionCreator.Create(_cortexToken, headsetId);
        }
Beispiel #2
0
        static void Main()
        {
            var app = new ApplicationService();

            var training = new TrainingCreator(app);
            var location = new LocationCreator(app);
            var trainer  = new TrainerCreator(app);
            var company  = new CompanyCreator(app);
            var student  = new StudentCreator(app);
            var contact  = new ContactCreator(app, company);
            var session  = new SessionCreator(app, training, trainer, location, student, company);

            var reader    = new MsAccessReader("c:\\temp\\Database1.mdb");
            var lineCount = 1;

            foreach (DataRow row in reader.GetRows("Formation"))
            {
                Console.Write($"Traitement de la ligne {lineCount++}\r");
                training.Create(row["Formation"].ToString());
                location.Create(row["Lieu"].ToString());
                trainer.Create(row["Formateur"].ToString());
                company.Create(row["Societe"].ToString(), row["Adresse"].ToString(), row["CP"].ToString(), row["Ville"].ToString());
                student.Create(row["Stagiaire"].ToString());
                contact.Create(row["Contact"].ToString(), row["Email"].ToString(), row["Telephone"].ToString(), row["Societe"].ToString());
                session.Create(DateTime.Parse(row["DateFormation"].ToString()), int.Parse(row["NbJour"].ToString()), row["Formation"].ToString(), row["Formateur"].ToString(), row["Lieu"].ToString(), row["Stagiaire"].ToString(), row["Societe"].ToString());
            }

            /*    DisableAll("Formations", training.GetAll(), id => app.Command<DisableTraining>().Execute(id));
             *  DisableAll("Lieux", location.GetAll(), id => app.Command<DisableLocation>().Execute(id));
             *  DisableAll("Formateur", trainer.GetAll(), id => app.Command<DisableTrainer>().Execute(id));*/

            Console.WriteLine("\r\nImport terminé !");
            Console.ReadKey();
        }
Beispiel #3
0
 private static void HeadsetConnectedOK(object sender, string headsetId)
 {
     Console.WriteLine("HeadsetConnectedOK " + headsetId);
     // Wait a moment before creating session
     System.Threading.Thread.Sleep(1500);
     // CreateSession
     _sessionCreator.Create(_cortexToken, headsetId, true);
 }
Beispiel #4
0
        public void Logout(HttpSession session, HttpResponse response)
        {
            this.Context.Logins.FirstOrDefault(l => l.SessionId == session.Id && l.IsActive == true).IsActive = false;
            this.Context.SaveChanges();
            var newSession    = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", newSession.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
        public void Logout(HttpSession session, HttpResponse response)
        {
            data.Logins.GetAll().FirstOrDefault(s => s.SessionId == session.Id).IsActive = false;
            data.SaveChanges();

            var newSession    = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", newSession.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #6
0
        public void DeleteUserSession(Login login, string sessionId, HttpResponse response)
        {
            login.IsActive = false;
            this.context.SaveChanges();

            HttpSession session       = SessionCreator.Create();
            Cookie      sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
        public void Logout(HttpResponse response, string sessionId)
        {
            Session sessionEntity = this.dbContext.Sessions.FirstOrDefault(s => s.SessionId == sessionId);

            sessionEntity.IsActive = false;
            this.dbContext.SaveChanges();

            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #8
0
        public static void Logout(HttpResponse response, HttpSession sesion)
        {
            Login login = Context.Logins.FirstOrDefault(login1 => login1.SessionId == sesion.Id && login1.IsActive);

            login.IsActive = false;
            Context.SaveChanges();

            var newSession    = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", newSession.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
        public static void LogoutUser(HttpResponse response, string sessionId)
        {
            Login login = dbContext.Logins.FirstOrDefault(l => l.IsActive && l.SessionId == sessionId);

            login.IsActive = false;
            dbContext.SaveChanges();

            HttpSession session       = SessionCreator.Create();
            Cookie      sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
        public static void Logout(string sessionId, HttpResponse response)
        {
            var login = Data.Data.Context.Logins
                        .FirstOrDefault(x => x.sessionId == sessionId && x.IsActive);

            login.IsActive = false;
            Data.Data.Context.SaveChanges();
            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #11
0
        public void LogoutUser(string sessionId, HttpResponse response)
        {
            var login = this.Context.Logins.FirstOrDefault(l => l.SessionId == sessionId);

            login.IsActive = false;
            this.Context.SaveChanges();

            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #12
0
        public static void Logout(HttpResponse response, string sessionId)
        {
            ViewBag.Bag["username"] = null;
            Login currentLogin = Data.Data.Context.Logins.FirstOrDefault(login => login.SessionId == sessionId && login.IsActive);

            currentLogin.IsActive = false;
            Data.Data.Context.SaveChanges();
            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #13
0
        internal void Logout(HttpResponse response, string sessionId)
        {
            Login currentLogin = this.context.Logins.FirstOrDefault(s => s.SessionId == sessionId);

            currentLogin.IsActive = false;
            this.context.SaveChanges();

            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #14
0
        public void Logout(HttpResponse response, string sessionId)
        {
            var currentSession = Data.Data.Contex.Sessions.FirstOrDefault(x => x.SessionId == sessionId);

            currentSession.IsActive = false;
            Data.Data.Contex.SaveChanges();

            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #15
0
        public IActionResult Logout(HttpSession session, HttpResponse response)
        {
            if (this.authenticationManager.IsAuthenticated(session))
            {
                this.usersService.LogoutUser(session.Id);
                var newSession    = SessionCreator.Create();
                var sessionCookie = new Cookie("sessionId", newSession.Id + "; HttpOnly; path=/");
                response.Header.Cookies["sessionId"] = sessionCookie;
            }

            this.Redirect(response, "/home/index");
            return(null);
        }
        public static void Logout(HttpResponse response, string sessionId)
        {
            var firstOrDefault = Data.Data.Context.Logins.FirstOrDefault(login =>
                                                                         login.SessionId == sessionId &&
                                                                         login.isActive);

            firstOrDefault.isActive = false;
            Data.Data.Context.SaveChanges();
            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #17
0
        private HttpResponse RouteRequest()
        {
            var routes = this.Routes
                         .Where(x => Regex.Match(Request.Url, x.UrlRegex).Success)
                         .ToList();

            if (!routes.Any())
            {
                return(HttpResponseBuilder.NotFound());
            }

            var route = routes.FirstOrDefault(x => x.Method == Request.Method);

            if (route == null)
            {
                return new HttpResponse()
                       {
                           StatusCode = ResponseStatusCode.MethodNotAllowed
                       }
            }
            ;

            // trigger the route handler...
            try
            {
                HttpResponse response;

                if (!Request.Header.Cookies.Contains("sessionId") || this.Request.Session == null)
                {
                    var session       = SessionCreator.Create();
                    var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");
                    this.Request.Session = session;
                    response             = route.Callable(this.Request);
                    response.Header.AddCookie(sessionCookie);
                }
                else
                {
                    response = route.Callable(this.Request);
                }

                return(response);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                return(HttpResponseBuilder.InternalServerError());
            }
        }
    }
        public void Logout(HttpResponse response, string sessionId)
        {
            Session sessionEntity = this.unitOfWork.Sessions.FindAll(s => s.SessionId == sessionId).FirstOrDefault();

            if (sessionEntity != null)
            {
                sessionEntity.IsActive = false;
            }
            this.unitOfWork.Save();

            var session       = SessionCreator.Create();
            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
Beispiel #19
0
        public void Logout(HttpResponse response, string sessionId)
        {
            var desiredUser = this.data.Logins.Query().FirstOrDefault(l => l.SessionId == sessionId && l.IsActive);

            if (desiredUser != null)
            {
                desiredUser.IsActive = false;
            }

            this.data.SaveChanges();

            var session = SessionCreator.Create();

            var sessionCookie = new Cookie("sessionId", session.Id + "; HttpOnly; path=/");

            response.Header.AddCookie(sessionCookie);
        }
        public void ChangeBrowserSession(HttpResponse response)
        {
            var newSession = SessionCreator.Create().Id + "; HttpOnly; path=/";

            response.Header.Cookies.Add(new Cookie("sessionId", newSession));
        }