public UserPrivacySettings retrievePrivacySettings(int userID) { DBConnect objDB = new DBConnect(); SqlCommand objCmd = new SqlCommand(); objCmd.CommandType = CommandType.StoredProcedure; objCmd.CommandText = "TP_GetPrivacySettings"; objCmd.Parameters.AddWithValue("@userID", userID); DataSet privacyDS = objDB.GetDataSetUsingCmdObj(objCmd); UserPrivacySettings privacySettings = new UserPrivacySettings(); if (privacyDS.Tables[0].Rows.Count == 1) { DataTable privacyDT = privacyDS.Tables[0]; privacySettings.ProfilePic = privacyDT.Rows[0]["ProfilePic"].ToString(); privacySettings.FirstName = privacyDT.Rows[0]["FirstName"].ToString(); privacySettings.LastName = privacyDT.Rows[0]["LastName"].ToString(); privacySettings.Title = privacyDT.Rows[0]["Title"].ToString(); privacySettings.Age = privacyDT.Rows[0]["Age"].ToString(); privacySettings.Height = privacyDT.Rows[0]["Height"].ToString(); privacySettings.Weight = privacyDT.Rows[0]["Weight"].ToString(); privacySettings.Occupation = privacyDT.Rows[0]["Occupation"].ToString(); privacySettings.Commitment = privacyDT.Rows[0]["Commitment"].ToString(); privacySettings.HaveKids = privacyDT.Rows[0]["HaveKids"].ToString(); privacySettings.WantKids = privacyDT.Rows[0]["WantKids"].ToString(); privacySettings.Interests = privacyDT.Rows[0]["Interests"].ToString(); privacySettings.Description = privacyDT.Rows[0]["Description"].ToString(); privacySettings.Gender = privacyDT.Rows[0]["Gender"].ToString(); } return(privacySettings); }
public bool modifyPrivacySettings(UserPrivacySettings privacySettings, int userID) { if (privacySettings != null) { int result = 0; DBConnect objDB = new DBConnect(); SqlCommand objCmd = new SqlCommand(); objCmd.CommandType = CommandType.StoredProcedure; objCmd.CommandText = "TP_ModifyPrivacySettings"; objCmd.Parameters.AddWithValue("@profilePic", privacySettings.ProfilePic); objCmd.Parameters.AddWithValue("@firstName", privacySettings.FirstName); objCmd.Parameters.AddWithValue("@lastName", privacySettings.LastName); objCmd.Parameters.AddWithValue("@title", privacySettings.Title); objCmd.Parameters.AddWithValue("@age", privacySettings.Age); objCmd.Parameters.AddWithValue("@height", privacySettings.Height); objCmd.Parameters.AddWithValue("@weight", privacySettings.Weight); objCmd.Parameters.AddWithValue("@occupation", privacySettings.Occupation); objCmd.Parameters.AddWithValue("@commitment", privacySettings.Commitment); objCmd.Parameters.AddWithValue("@haveKids", privacySettings.HaveKids); objCmd.Parameters.AddWithValue("@wantKids", privacySettings.WantKids); objCmd.Parameters.AddWithValue("@interests", privacySettings.Interests); objCmd.Parameters.AddWithValue("@description", privacySettings.Description); objCmd.Parameters.AddWithValue("@gender", privacySettings.Gender); objCmd.Parameters.AddWithValue("@userID", userID); result += objDB.DoUpdateUsingCmdObj(objCmd); if (result == 1) { return(true); } else { return(false); } } else { return(false); } }