Exemplo n.º 1
0
 /// <summary>
 /// Constructor that creates a user-object from name and securityLevel.
 /// </summary>
 /// <param name="userId">User's id</param>
 /// <param name="name">User's name</param>
 /// <param name="securityLevel">SecurityLevel-object</param>
 public User(int userId, string name, SecurityLevel securityLevel)
 {
     this._id = userId;
     this.name = name;
     this.securityLevelInformation = securityLevel;
     this.securityLevel = securityLevel.SecurityLevelReal;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor that creates a user-object from name, securityLevel and
 /// nickname information.
 /// </summary>
 /// <param name="name">User's name</param>
 /// <param name="securityLevel">SecurityLevel-object</param>
 /// <param name="nickName">User's nickname</param>
 public User(string name, SecurityLevel securityLevel, string nickName)
 {
     this.name = name;
     this.securityLevelInformation = securityLevel;
     this.nickName      = nickName;
     this.securityLevel = securityLevel.SecurityLevelReal;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor that creates a user-object from name and securityLevel.
 /// </summary>
 /// <param name="userId">User's id</param>
 /// <param name="name">User's name</param>
 /// <param name="securityLevel">SecurityLevel-object</param>
 public User(int userId, string name, SecurityLevel securityLevel)
 {
     this._id  = userId;
     this.name = name;
     this.securityLevelInformation = securityLevel;
     this.securityLevel            = securityLevel.SecurityLevelReal;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor that creates a user-object from name and securityLevel.
 /// </summary>
 /// <param name="name">User's name</param>
 /// <param name="securityLevel">SecurityLevel-object</param>
 public User(string name, SecurityLevel securityLevel)
 {
     this.name = name;
     this.securityLevelInformation = securityLevel;
     this.securityLevel = securityLevel.SecurityLevelReal;
 }
        public SecurityLevel GetSecurityLevelByID(int securityLevelID)
        {
            SecurityLevel securityLevel = new SecurityLevel();
            securityLevel.SecurityLevelReal = 0;
            securityLevel.SecurityLevelID = 0;
            securityLevel.SecurityLevelDescription = "";

            // We need some objects
            System.Configuration.AppSettingsReader settingsReader = new System.Configuration.AppSettingsReader();
            string configDirectory = settingsReader.GetValue("XmlConfigDirectory", typeof(string)).ToString();

            // We read the required information from the xml-file
            System.Data.DataSet dataSet = new System.Data.DataSet();
            dataSet.ReadXml(configDirectory + settingsReader.GetValue("SecuritylevelsConfigXml", typeof(string)).ToString());

            // Cycle through the dataset and set object's information
            foreach (System.Data.DataRow dr in dataSet.Tables[0].Rows)
            {
                if (Int32.Parse(dr["securitylevel_id"].ToString()) == securityLevelID)
                {
                    securityLevel.SecurityLevelID = securityLevelID;
                    securityLevel.SecurityLevelDescription = dr["name"].ToString();
                    securityLevel.SecurityLevelReal = Int32.Parse(dr["level"].ToString());
                    break;
                }
            }
            return securityLevel;
        }