コード例 #1
0
        private static volatile Dictionary<String, Individual> _users; // = new Dictionary<string, Individual>();

        #endregion Fields

        #region Constructors

        private UserLoad()
        {
            //if (_users != null) return;
            _users = new Dictionary<string, Individual>();
            Environment.CurrentDirectory = HttpContext.Current.Server.MapPath("/");
            XmlTextReader  xmlFile = new XmlTextReader (_filePath);

             xmlFile.Read();
             while (xmlFile.Read())
             {
                 xmlFile.MoveToElement();
                 if (xmlFile.NodeType == XmlNodeType.Element && xmlFile.Name.Equals("user")){
                     Individual user = new Individual();
                     user.IndividualId = Int16.Parse(xmlFile.GetAttribute("IndividualId"));
                     user.FullName = xmlFile.GetAttribute("FullName").Trim();
                     user.UserName = xmlFile.GetAttribute("UserName").Trim();
                     user.Password = xmlFile.GetAttribute("Password").Trim();
                     user.Email = xmlFile.GetAttribute("Email").Trim();
                     user.PhotoName = xmlFile.GetAttribute("PhotoName").Trim();
                     user.SecurityAnswer = xmlFile.GetAttribute("SecurityAnswer").Trim();
                     user.SecurityQuestion = xmlFile.GetAttribute("SecurityQuestion").Trim();

                     foreach (string s in xmlFile.GetAttribute("Roles").Split(','))
                     {
                         user.addRole(s.Trim());
                     }
                     _users.Add(user.UserName, user);
                 }

             }
             xmlFile.Close();
        }
コード例 #2
0
 public IndividualRepoModel(Individual user)
 {
     _individualUserName = user.UserName;
     _individualFullName = user.FullName;
     _individualID = user.IndividualId;
 }