Example #1
0
        public void updateProfilePic(string profilePicPath)
        {
            if (profilePicPath == "")
            {
                return;
            }
            else
            {
                ProfilePicConverter PPC = new ProfilePicConverter();

                SQLiteConnection Con = new SQLiteConnection(sqlCon);
                Con.Open();
                SQLiteCommand SqlCmd = new SQLiteCommand("UPDATE profiles " +
                                                         "SET profilePicture = @profilePicture " +
                                                         "WHERE profileID = @profileID", Con);


                SqlCmd.Parameters.Add("@profilePicture", DbType.Binary, PPC.imageToByteArray(profilePicPath).Length);
                SqlCmd.Parameters.AddWithValue("@profilePicture", PPC.imageToByteArray(profilePicPath));
                SqlCmd.Parameters.AddWithValue("@profileID", profileID);

                SqlCmd.ExecuteNonQuery();
                Con.Close();
            }
        }
Example #2
0
        public void createProfile()
        {
            ProfilePicConverter PPC = new ProfilePicConverter();
            SQLiteConnection    Con = new SQLiteConnection(sqlCon);

            Con.Open();

            SQLiteCommand SqlCmd = new SQLiteCommand(
                "INSERT INTO Profiles([firstName], [lastName], [gender], [birthdate], [shortDesc], [profilePicture], [userID]) " +
                "VALUES(@firstName, @lastName, @gender, @birthdate, @shortDesc, @profilePicture, @userID)", Con);

            SqlCmd.Parameters.AddWithValue("@firstName", firstName);
            SqlCmd.Parameters.AddWithValue("@lastName", lastName);
            SqlCmd.Parameters.AddWithValue("@gender", gender);
            SqlCmd.Parameters.AddWithValue("@birthdate", birthdate);
            SqlCmd.Parameters.AddWithValue("@shortDesc", shortDesc);
            SqlCmd.Parameters.Add("@profilePicture", DbType.Binary, PPC.imageToByteArray(profilePicPath).Length);
            SqlCmd.Parameters.AddWithValue("@profilePicture", PPC.imageToByteArray(profilePicPath));
            SqlCmd.Parameters.AddWithValue("@userID", profileFKInsert());

            SqlCmd.ExecuteNonQuery();
            Con.Close();
        }