public bool checkIfUserPassedOtherUser(string username1, string username2) { User tempUser = new User(); int userID1 = tempUser.getUserID(username1); int userID2 = tempUser.getUserID(username2); PassedList tempList = new PassedList(); try { string passedProfiles1 = tempList.getPasses(userID1).List; int[] passedUserIDs1 = Array.ConvertAll(passedProfiles1.Split('|'), int.Parse); if (passedUserIDs1.Contains(userID2)) { return(true); } else { return(false); } } catch (NullReferenceException) { return(false); } }
public int addPassToDB(int userID, int passedUserID) { int result = 0; DBConnect objDB = new DBConnect(); SqlCommand objCmd = new SqlCommand(); objCmd.CommandType = CommandType.StoredProcedure; PassedList tempPasses = new PassedList(); string passList; User tempUser = new User(); //int passedUserID = tempUser.getUserID(passedProfile); try { passList = tempPasses.getPasses(userID).List; passList += "|" + passedUserID + "|"; objCmd.CommandText = "TP_ModifyPasses"; objCmd.Parameters.AddWithValue("@passed", passList); objCmd.Parameters.AddWithValue("@passedBy", userID); result = objDB.DoUpdateUsingCmdObj(objCmd); } catch (NullReferenceException) { //list of passed list is empty, so add the first pass passList = passedUserID + "|"; objCmd.CommandText = "TP_AddPass"; objCmd.Parameters.AddWithValue("@passed", passList); objCmd.Parameters.AddWithValue("@passedBy", userID); result = objDB.DoUpdateUsingCmdObj(objCmd); } return(result); }