public WHidden GetUserHideSettings(string username, string password, int userId) { Contract.Requires(!String.IsNullOrEmpty(username)); Contract.Requires(!String.IsNullOrEmpty(password)); SocialTFSEntities db = new SocialTFSEntities(); User user = CheckCredentials(db, username, password); if (user == null) return null; WHidden result = new WHidden(); foreach (Hidden item in db.Hidden.Where(h => h.fk_user == user.pk_id && h.fk_friend == userId)) if (item.timeline == HiddenType.Suggestions.ToString()) result.Suggestions = true; else if (item.timeline == HiddenType.Dynamic.ToString()) result.Dynamic = true; else if (item.timeline == HiddenType.Interactive.ToString()) result.Interactive = true; return result; }
public WHidden GetUserHideSettings(string username, string password, int userId) { Contract.Requires(!String.IsNullOrEmpty(username)); Contract.Requires(!String.IsNullOrEmpty(password)); ConnectorDataContext db = new ConnectorDataContext(); User user = CheckCredentials(db, username, password); if (user == null) return null; WHidden result = new WHidden(); Stopwatch w = Stopwatch.StartNew(); List<Hidden> hide = db.Hiddens.Where(h => h.user == user.id && h.friend == userId).ToList(); w.Stop(); ILog log = LogManager.GetLogger("QueryLogger"); log.Info(" Elapsed time: " + w.Elapsed + ", user id: " + user.id + ", friend's id: " + userId + ", select all hidden friends of an user and set the visibility according to the timeline"); foreach (Hidden item in hide) if (item.timeline == HiddenType.Suggestions.ToString()) result.Suggestions = true; else if (item.timeline == HiddenType.Dynamic.ToString()) result.Dynamic = true; else if (item.timeline == HiddenType.Interactive.ToString()) result.Interactive = true; return result; }