public override bool Parse(XElement xml) { if (xml == null) { return(false); } int id = 0; string email = string.Empty; string name = string.Empty; string lastname = string.Empty; string nickname = string.Empty; bool active = false; DateTime created = DateTime.MinValue; DateTime loginFirst = DateTime.MinValue; DateTime loginLast = DateTime.MinValue; long pictureID = 0; bool hasValidMail = false; int points = 0; UserRole role = UserRole.Normal; int personalGroupID = 0; int defaultGroupID = 0; xml.ParseNode("ID", ref id, false); xml.ParseNode("EMail", ref email, false); xml.ParseNode("Name", ref name, false); xml.ParseNode("LastName", ref lastname, false); xml.ParseNode("NickName", ref nickname, false); //xml.ParseNode("Active", ref active, false); //xml.ParseNode("AcctCreated", ref created, false); //xml.ParseNode("LoginFirst", ref loginFirst, false); //xml.ParseNode("LoginLast", ref loginLast, false); xml.ParseNode("PictureID", ref pictureID, false); //xml.ParseNode("HasValidMail", ref hasValidMail, false); xml.ParseNode("Points", ref points, false); xml.ParseNode <UserRole>("Role", ref role, false); xml.ParseNode("PersonalGroupID", ref personalGroupID, false); xml.ParseNode("DefaultGroupID", ref defaultGroupID, false); UserPreferences prefs = new UserPreferences(xml.GetNode("pref", false)); Init(id, email, name, lastname, nickname, active, created, loginFirst, loginLast, prefs, pictureID, hasValidMail, points, role, personalGroupID, defaultGroupID); return(true); }
/// <summary> /// This is the complete init method for this class. /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object. /// </summary> /// <param name="id"></param> /// <param name="email"></param> /// <param name="name"></param> /// <param name="lastname"></param> /// <param name="nickname"></param> /// <param name="active"></param> /// <param name="created"></param> /// <param name="loginFirst"></param> /// <param name="loginLast"></param> /// <param name="preferences"></param> /// <param name="pictureID"></param> /// <param name="hasValidMail"></param> /// <param name="points"></param> /// <param name="role"></param> /// <param name="personalGroupID"></param> /// <param name="defaultGroupID"></param> protected void Init(int id, string email, string name, string lastname, string nickname, bool active, DateTime created, DateTime loginFirst, DateTime loginLast, UserPreferences preferences, long pictureID, bool hasValidMail, int points, UserRole role, int personalGroupID, int defaultGroupID) { ID = id; EMail = email; Name = name; LastName = lastname; NickName = nickname; Active = active; AcctCreated = created; LoginFirst = loginFirst; LoginLast = loginLast; Preferences = preferences; PictureID = pictureID; HasValidMail = hasValidMail; Points = points; Role = role; PersonalGroupID = personalGroupID; DefaultGroupID = defaultGroupID; }
public override bool Parse(XElement xml) { if (xml == null) return false; int id = 0; string email = string.Empty; string name = string.Empty; string lastname = string.Empty; string nickname = string.Empty; bool active = false; DateTime created = DateTime.MinValue; DateTime loginFirst = DateTime.MinValue; DateTime loginLast = DateTime.MinValue; long pictureID = 0; bool hasValidMail = false; int points = 0; UserRole role = UserRole.Normal; int personalGroupID = 0; int defaultGroupID = 0; xml.ParseNode("ID", ref id, false); xml.ParseNode("EMail", ref email, false); xml.ParseNode("Name", ref name, false); xml.ParseNode("LastName", ref lastname, false); xml.ParseNode("NickName", ref nickname, false); //xml.ParseNode("Active", ref active, false); //xml.ParseNode("AcctCreated", ref created, false); //xml.ParseNode("LoginFirst", ref loginFirst, false); //xml.ParseNode("LoginLast", ref loginLast, false); xml.ParseNode("PictureID", ref pictureID, false); //xml.ParseNode("HasValidMail", ref hasValidMail, false); xml.ParseNode("Points", ref points, false); xml.ParseNode<UserRole>("Role", ref role, false); xml.ParseNode("PersonalGroupID", ref personalGroupID, false); xml.ParseNode("DefaultGroupID", ref defaultGroupID, false); UserPreferences prefs = new UserPreferences(xml.GetNode("pref", false)); Init(id, email, name, lastname, nickname, active, created, loginFirst, loginLast, prefs, pictureID, hasValidMail, points, role, personalGroupID, defaultGroupID); return true; }
/// <summary> /// This is the complete init method for this class. /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object. /// </summary> /// <param name="id"></param> /// <param name="email"></param> /// <param name="name"></param> /// <param name="lastname"></param> /// <param name="nickname"></param> /// <param name="active"></param> /// <param name="created"></param> /// <param name="loginFirst"></param> /// <param name="loginLast"></param> /// <param name="preferences"></param> /// <param name="pictureID"></param> /// <param name="hasValidMail"></param> /// <param name="points"></param> /// <param name="role"></param> /// <param name="personalGroupID"></param> /// <param name="defaultGroupID"></param> protected void Init(int id, string email, string name, string lastname, string nickname, bool active, DateTime created, DateTime loginFirst, DateTime loginLast, UserPreferences preferences, long pictureID, bool hasValidMail, int points, UserRole role, int personalGroupID, int defaultGroupID) { ID = id; EMail = email; Name = name; LastName = lastname; NickName = nickname; Active = active; AcctCreated = created; LoginFirst = loginFirst; LoginLast = loginLast; Preferences = preferences; PictureID = pictureID; HasValidMail = hasValidMail; Points = points; Role = role; PersonalGroupID = personalGroupID; DefaultGroupID = defaultGroupID; }