public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("role"); writer.WriteElementString("rolename", RoleName); writer.WriteElementString("description", Description); writer.WriteElementString("billingfrequency", BillingFrequency); writer.WriteElementString("billingperiod", BillingPeriod.ToString()); writer.WriteElementString("servicefee", ServiceFee.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("trialfrequency", TrialFrequency); writer.WriteElementString("trialperiod", TrialPeriod.ToString()); writer.WriteElementString("trialfee", TrialFee.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("ispublic", IsPublic.ToString().ToLowerInvariant()); writer.WriteElementString("autoassignment", AutoAssignment.ToString().ToLowerInvariant()); writer.WriteElementString("rsvpcode", RSVPCode); writer.WriteElementString("iconfile", IconFile); switch (RoleType) { case RoleType.Administrator: writer.WriteElementString("roletype", "adminrole"); break; case RoleType.RegisteredUser: writer.WriteElementString("roletype", "registeredrole"); break; case RoleType.Subscriber: writer.WriteElementString("roletype", "subscriberrole"); break; case RoleType.None: writer.WriteElementString("roletype", "none"); break; } writer.WriteEndElement(); }
/// ----------------------------------------------------------------------------- /// <summary> /// Writes a RoleInfo to an XmlWriter /// </summary> /// <param name="writer">The XmlWriter to use</param> /// ----------------------------------------------------------------------------- public void WriteXml(XmlWriter writer) { //Write start of main elemenst writer.WriteStartElement("role"); //write out properties writer.WriteElementString("rolename", RoleName); writer.WriteElementString("description", Description); writer.WriteElementString("billingfrequency", BillingFrequency); writer.WriteElementString("billingperiod", BillingPeriod.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("servicefee", ServiceFee.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("trialfrequency", TrialFrequency); writer.WriteElementString("trialperiod", TrialPeriod.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("trialfee", TrialFee.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("ispublic", IsPublic.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); writer.WriteElementString("autoassignment", AutoAssignment.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); writer.WriteElementString("rsvpcode", RSVPCode); writer.WriteElementString("iconfile", IconFile); writer.WriteElementString("issystemrole", IsSystemRole.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); switch (RoleType) { case RoleType.Administrator: writer.WriteElementString("roletype", "adminrole"); break; case RoleType.RegisteredUser: writer.WriteElementString("roletype", "registeredrole"); break; case RoleType.Subscriber: writer.WriteElementString("roletype", "subscriberrole"); break; case RoleType.UnverifiedUser: writer.WriteElementString("roletype", "unverifiedrole"); break; case RoleType.None: writer.WriteElementString("roletype", "none"); break; } switch (SecurityMode) { case SecurityMode.SecurityRole: writer.WriteElementString("securitymode", "securityrole"); break; case SecurityMode.SocialGroup: writer.WriteElementString("securitymode", "socialgroup"); break; case SecurityMode.Both: writer.WriteElementString("securitymode", "both"); break; } switch (Status) { case RoleStatus.Pending: writer.WriteElementString("status", "pending"); break; case RoleStatus.Disabled: writer.WriteElementString("status", "disabled"); break; case RoleStatus.Approved: writer.WriteElementString("status", "approved"); break; } //Write end of main element writer.WriteEndElement(); }