Ejemplo n.º 1
0
 public AccessDbImporter()
 {
     _dbContext = new NtxfcDbContext();
     LoadSourceData();
     ImportUsers();
     ImportAircraft();
     ImportSchedule();
     ImportInstructors();
     ImportReviews();
     ImportSquawks();
     ImportCheckouts();
 }
Ejemplo n.º 2
0
        public string SaveForumSession(string username, string host, string useragent, string forwardedfor)
        {
            int forumUserId = 0;

            using (NtxfcDbContext db = new NtxfcDbContext())
            {
                Login login = db.Logins.FirstOrDefault(x => x.Username == username);
                if (login != null)
                    forumUserId = login.ForumUserId;
            }

            if (forumUserId != 0)
            {
                Session session = new Session();
                session.sessionhash = Guid.NewGuid().ToString("N");
                session.userid = forumUserId;
                session.host = host;
                session.idhash = CalculateMD5Hash(String.Concat(useragent, GetSubIP(GetRealIP(host, forwardedfor))));
                TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
                session.lastactivity = Convert.ToInt32(ts.TotalSeconds);
                session.location = "/login.php";
                session.useragent = useragent;
                session.loggedin = 1;
                session.apiaccesstoken = string.Empty;

                using (ExternalDbContext db = new ExternalDbContext())
                {
                    db.Sessions.Add(session);
                    db.SaveChanges();
                }

                return session.sessionhash;
            }

            return string.Empty;
        }
Ejemplo n.º 3
0
        public void UpdateForumSession(string username, string sessionhash, int loggedin)
        {
            int forumUserId = 0;

            using (NtxfcDbContext db = new NtxfcDbContext())
            {
                Login login = db.Logins.FirstOrDefault(x => x.Username == username);
                if (login != null)
                    forumUserId = login.ForumUserId;
            }

            if (forumUserId != 0)
            {
                using (ExternalDbContext db = new ExternalDbContext())
                {
                    var session = db.Sessions.FirstOrDefault(x => x.sessionhash == sessionhash);
                    if (session != null)
                    {
                        session.loggedin = loggedin;
                        session.userid = forumUserId;
                        db.Sessions.Attach(session);
                        db.Entry(session).Property(u => u.loggedin).IsModified = true;
                        db.Entry(session).Property(u => u.userid).IsModified = true;
                        db.SaveChanges();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public bool IsExistingEmail(string email)
        {
            using (NtxfcDbContext db = new NtxfcDbContext())
            {
                var login = db.Logins.FirstOrDefault(x => x.Email == email);

                if (login != null)
                {
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 5
0
        public bool IsExistingUsername(string username)
        {
            using (NtxfcDbContext db = new NtxfcDbContext())
            {
                var login = db.Logins.FirstOrDefault(x => x.Username == username);

                if (login != null)
                {
                    return true;
                }
            }

            return false;
        }