Пример #1
0
        public bool TryLogin( Session session )
        {
            User queriedUser;
              var watch = new Stopwatch();
              watch.Start();
              using ( var db = new TestModel( _dbConn.GetConnection() ) )
              {
            queriedUser = db.Users.FirstOrDefault( o => o.UserName == session.User.UserName );
              }
              Debug.WriteLine( "TryLogin: "******"ms" );

              //Set password if found and verify it
              string hashedPassword;
              if ( queriedUser != null )
            hashedPassword = queriedUser.Password;
              else
            return false;

              var returnMe = session.User.Password == hashedPassword;

              //If verified set session User to returned user
              if ( returnMe )
            session.User = queriedUser;

              return returnMe;
        }
        public MainWindow()
        {
            InitializeComponent();
              DataContext = this;
              var bindings = new Bindings();
              LoadKernel( bindings );
              _session = new Session.Session();
              _sessionLogic = new SessionLogic( _dbConn );

              flagHandler = new ObservableHandler<IDbConn>( _dbConn );
              flagHandler.Add( "HasDummyRan", OnDbConnHasDummyRanChanged );
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
            var bindings = new Bindings();

            LoadKernel(bindings);
            _session      = new Session.Session();
            _sessionLogic = new SessionLogic(_dbConn);

            flagHandler = new ObservableHandler <IDbConn>(_dbConn);
            flagHandler.Add("HasDummyRan", OnDbConnHasDummyRanChanged);
        }
Пример #4
0
 public void ChangePassword( Session session )
 {
     var curUser = session.User;
       curUser.Password = curUser.Password;
       curUser.PasswordResetFlag = false;
       var watch = new Stopwatch();
       watch.Start();
       using ( var db = new TestModel( _dbConn.GetConnection() ) )
       {
     db.Users.AddOrUpdate( curUser );
     db.SaveChanges();
       }
       Debug.WriteLine( "ChangePassword: "******"ms" );
 }
Пример #5
0
        // Todo: need to refactor code to return list of profiles and display them accordingly
        /// <summary>
        /// Query Loads the most recent Profile
        /// </summary>
        /// <param name="session"></param>
        public void LoadProfile( Session session )
        {
            var watch = new Stopwatch();
              watch.Start();
              UserProfile queriedUserProfile;
              using ( var db = new TestModel( _dbConn.GetConnection() ) )
              {
            queriedUserProfile = db.UserProfiles
              .AsNoTracking()
              .OrderByDescending( o => o.DateModified )
              .Include( o => o.Scenario )
              .Include( o => o.Project )
              .Include( o => o.CanvasLayout
            .Select( op => op.Windows
            .Select( opq => opq.Canvas ) ) )
              .FirstOrDefault( o => o.User.Id == session.User.Id );
              }
              Debug.WriteLine( "LoadProfile: " + watch.ElapsedMilliseconds + "ms" );
              if ( queriedUserProfile == null )
            return;

              session.UserProfile = queriedUserProfile;
        }
Пример #6
0
 public void SaveUserProfile( Session session )
 {
     throw new System.NotImplementedException();
 }