Esempio n. 1
0
        /**
        * Create a new roadmap
        **/
        public bool CreateRoadMap(string name, string description, string userid )
        {
            mDatabase.connect();
            bool toReturn = false;

            if (mDatabase.executewrite("INSERT INTO [dbo].[RoadMap] ( Name, Description, Timestamp, UserID ) VALUES ( '" + name + "', '" +  description + "', GETDATE(), '" + userid + "')"))
            {
                //create a new timeline
                RoadMap map = new RoadMap(name);
                map.CreateTimeLine();

                toReturn = true;
            }
            mDatabase.close();

            return toReturn;
        }
Esempio n. 2
0
        /**
        * Delete a roadmap
        **/
        public bool DeleteRoadMap(string name, string description, string userid)
        {
            mDatabase.connect();
            bool toReturn = false;

            if (mDatabase.executewrite("DELETE FROM [dbo].[RoadMap] WHERE Name = '" + name + "')"))
            {
                //create a new timeline
                RoadMap map = new RoadMap(name);
                map.DeleteTimeLine();

                toReturn = true;
            }
            mDatabase.close();

            return toReturn;
        }
Esempio n. 3
0
        /**
        * Creates a list of all the roadmaps
        */
        public List<RoadMap> GetAllMaps()
        {
            mDatabase.connect();
            mReader = mDatabase.executeread("SELECT Name TimelineID FROM [dbo].[RoadMap]");

            List<RoadMap> Maps = new List<RoadMap>();

            while (mReader.Read())
            {
                //create a new roadmap object and add to list
                RoadMap map = new RoadMap(mReader.GetString(0));
                Maps.Add(map);
            }

            mDatabase.close();
            //return list of roadmaps
            return Maps;
        }
Esempio n. 4
0
        /**
        * Fetches the roadmaps of a single user
        */
        public List<RoadMap> GetUserMaps(string username)
        {
            mDatabase.connect();
            mReader = mDatabase.executeread("SELECT Name FROM [dbo].[RoadMap] WHERE UserID = '" + username + "'");

            List<RoadMap> maps = new List<RoadMap>();

            while (mReader.Read())
            {
                //create a new roadmap object and add to list
                RoadMap map = new RoadMap(mReader.GetString(0));
                maps.Add(map);
            }

            mDatabase.close();
            //return list of roadmaps
            return maps;
        }