pdf - 395 K - Ecole des mines de Nantes
pdf - 395 K - Ecole des mines de Nantes
pdf - 395 K - Ecole des mines de Nantes
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
namespace Architecture.Profiles{using System;using System.Data;using System.Data.SqlClient;using System.Diagnostics;/// /// Defines a User Profile. Such a Profile stores information on theLinks/// that provi<strong><strong>de</strong>s</strong> indicators of the relevancy of the traversal of theLinks/// based on the user's navigation history. In addition, a UserProfile can/// have references to SUPs that suit to the user./// [Serializable]public class UP : IProfile{// Data tablesprivate static readonly string TABLE_NAME = "UP";private static readonly string UP_SUP_TABLE_NAME = "UP_SUP";private static DataTable table, upSupTable;// SqlDataAdaptersprivate static SqlDataAdapter adapter, upSupAdapter;// Column namesprivate static readonly string USER_ID = "userId";private static readonly string LAST_USE = "lastUse";// In UP_SUPprivate static readonly string UP_COL = "UP";private static readonly string SUP_COL = "SUP";// Relationsprivate static DataRelation ToNo<strong><strong>de</strong>s</strong>, ToSUPs;public static void Cleanup(SqlConnection connection){SUP.Cleanup(connection);UPNo<strong>de</strong>.Cleanup(connection);DataUtilities.CleanupTable(connection, TABLE_NAME);// Clear all Tables in DataSetDataSet dataSet = Data.DataSet;foreach (DataTable dt in dataSet.Tables)dt.Rows.Clear();}/// /// Creates new UP data./// /// internal static UP CreateUP(UserId user) {return CreateUP(user, new string[] {});}internal static UP CreateUP(UserId user, string[] supNames){Debug.Assert(user != null && supNames != null);if (Data.Rows.Find(user.IPAddress) != null)throw new Exception("UP for user " + user + "exists already");DataRow row = Data.NewRow();row[USER_ID] = user.IPAddress;row[LAST_USE] = DateTime.Now;MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 113