public RoadMap(string name ) { mName = name; mDatabase.connect(); mReader = mDatabase.executeread("SELECT Timestamp, Description, UserID FROM [dbo].[Roadmap] WHERE Name = '" + name + "'"); mReader.Read(); mTimeStamp = mReader.GetDateTime(0); mDescription = mReader.GetString(1); string UID = mReader.GetString(2); mDatabase.close(); mDatabase.connect(); mReader = mDatabase.executeread("SELECT Name, Email, Password FROM [dbo].[User] WHERE ID = '" + UID + "'"); mReader.Read(); mUser = new User(mReader.GetString(0), UID, mReader.GetString(1), mReader.GetString(2)); mDatabase.close(); mTimeline = new TimeLine(mName); //Get the StrategyPoints mDatabase.connect(); mReader = mDatabase.executeread("SELECT Name, Description FROM [dbo].[StrategyPoint] WHERE RoadmapName = '" + name + "'"); while (mReader.Read()) { StrategyPoint sp = new StrategyPoint(mReader.GetString(0), mReader.GetString(1)); mStrategyPoints.Add(sp); } mDatabase.close(); }
/** * Get all the information for a user **/ public User GetUser( string username ) { mDatabase.connect(); mReader = mDatabase.executeread("SELECT Name, Email, Password FROM [dbo].[User] WHERE ID = '" + username + "'" ); mReader.Read(); User user = new User(mReader.GetString(0).ToString(), username, mReader.GetString(1).ToString(), mReader.GetString(2).ToString()); mDatabase.close(); return user; }
/** * Create a new user **/ public bool CreateUser( User newuser ) { mDatabase.connect(); bool toReturn = false; if (mDatabase.executewrite("INSERT INTO [dbo].[User] ( Name, ID, Email, Password ) VALUES (" + "'" + newuser.GetName() + "'" + ',' + "'" + newuser.GetUserName() + "'" + ',' + "'" + newuser.GetEmail() + "'" + ',' + "'" + newuser.GetPassword() + "')")) { toReturn = true; } mDatabase.close(); return toReturn; }