Esempio n. 1
0
 public static bool SetProgress(String UserName, char Letter)
 {
     SQLiteDatabase db = new SQLiteDatabase();
     Dictionary<String, String> data = new Dictionary<string, string>();
     data.Add("TrainingProgress", Char.ToString(Letter));
     return db.Update("User", data, String.Format("UserName = '******'", UserName));
 }
Esempio n. 2
0
        public static char GetProgress(String UserName)
        {
            //gets a useres training progress from the database
            SQLiteDatabase db = new SQLiteDatabase();
            DataTable rawUserData = new DataTable();

            String cmd = String.Format("SELECT * from User WHERE UserName = '******'", UserName);
            rawUserData = db.GetDataTable(cmd);

            char retVal = char.Parse(rawUserData.Rows[0]["TrainingProgress"].ToString());
            return retVal;
        }
Esempio n. 3
0
        public static String GetName(String UserName)
        {
            //gets a users first and last name from the database
            SQLiteDatabase db = new SQLiteDatabase();
            DataTable rawUserData = new DataTable();

            String cmd = String.Format("SELECT * from User WHERE UserName = '******'", UserName);
            rawUserData = db.GetDataTable(cmd);

            String retVal = rawUserData.Rows[0]["FirstName"].ToString() + " " + rawUserData.Rows[0]["LastName"].ToString();
            return retVal;
        }
Esempio n. 4
0
        public static void AddSign(SignInfo sign)
        {
            //adds a users calibrated sign data to the database
            SQLiteDatabase db = new SQLiteDatabase();
            Dictionary<String,String> data = new Dictionary<string,string>();

            data.Add("Letter", sign.Letter.ToString());
            data.Add("UserName", sign.UserName);
            data.Add("Area", sign.Area.ToString());
            data.Add("AreaPercentage", sign.Percentage.ToString());
            data.Add("ClosestPoint", sign.ClosestPoint.ToString());
            data.Add("NumFingers", sign.NumFingers.ToString());

            db.Insert("Sign",data);
        }
Esempio n. 5
0
        public static List<String> GetUserNames()
        {
            //function that returns all user names in the database
            List<String> retVal = new List<String>();
            SQLiteDatabase db = new SQLiteDatabase();
            DataTable rawUserData = new DataTable();

            String cmd = String.Format("SELECT * from User");
            rawUserData = db.GetDataTable(cmd);

            foreach (DataRow r in rawUserData.Rows)
            {
                retVal.Add(r["UserName"].ToString());
            }
            return retVal;
        }
Esempio n. 6
0
        public static bool AddProfile(String UserName, String FirstName, String LastName)
        {
            //adds a new user profile to the database
            if (GetUserNames().Contains(UserName))
                return false;

            SQLiteDatabase db = new SQLiteDatabase();
            Dictionary<String, String> data = new Dictionary<string, string>();

            data.Add("UserName", UserName);
            data.Add("FirstName", FirstName);
            data.Add("LastName", LastName);
            data.Add("TrainingProgress", "A");

            db.Insert("User", data);
            return true;
        }
Esempio n. 7
0
        public static IList<SignInfo> GetSignInfo(String UserName, char Letter)
        {
            //gets all of the calibrated and uncalibrated info to match a sign
            IList<SignInfo> signs = new List<SignInfo>();
            SQLiteDatabase db = new SQLiteDatabase();
            DataTable rawSigns = new DataTable();

            String cmd = String.Format("SELECT AreaPercentage, NumFingers, ClosestPoint, Area from Sign where UserName = '******' and Sign.Letter = '{1}'", UserName, Letter);
            rawSigns = db.GetDataTable(cmd);
            foreach (DataRow r in rawSigns.Rows)
            {
                double Percentage = Double.Parse(r["AreaPercentage"].ToString());
                int NumFingers = Int32.Parse(r["NumFingers"].ToString());
                double ClosestPoint = Double.Parse(r["ClosestPoint"].ToString());
                double Area = Double.Parse(r["Area"].ToString());
                signs.Add(new SignInfo(Letter, UserName, Percentage, NumFingers, ClosestPoint, Area));
            }
            return signs;
        }
Esempio n. 8
0
 public static void DeleteProfile(String UserName)
 {
     SQLiteDatabase db = new SQLiteDatabase();
     db.Delete("Sign", String.Format("UserName = '******'", UserName));
     db.Delete("User", String.Format("UserName = '******'", UserName));
 }