public IDictionary <string, object> AsKeyValuePairs() { return(new Dictionary <string, object> { ["Date Earned"] = DateEarned.HasValue() ? DateEarned.YMDString() : null, ["Flight ID"] = FlightID.ToString(CultureInfo.InvariantCulture), ["Checkride Type"] = CheckrideType.ToString(), ["Privilege"] = Privilege, ["License Kind"] = LicenseKind.ToString(), ["Level"] = Level.ToString() }); }
internal static XmlDocument CreateDocument(Guid id, string name, DateTime expirationDate, IDictionary <string, string> attributes, LicenseKind licenseKind) { var doc = new XmlDocument(); var license = doc.CreateElement(LicensingSR.License); doc.AppendChild(license); var idAttr = doc.CreateAttribute(LicensingSR.LicenseId); license.Attributes.Append(idAttr); idAttr.Value = id.ToString(); var expirDateAttr = doc.CreateAttribute(LicensingSR.LicenseExpiration); license.Attributes.Append(expirDateAttr); expirDateAttr.Value = expirationDate.ToString("yyyy-MM-ddTHH:mm:ss.fffffff", CultureInfo.InvariantCulture); var licenseAttr = doc.CreateAttribute(LicensingSR.LicenseKind); license.Attributes.Append(licenseAttr); licenseAttr.Value = licenseKind.ToString(); var nameEl = doc.CreateElement(LicensingSR.LicenseName); license.AppendChild(nameEl); nameEl.InnerText = name; foreach (var attribute in attributes) { var attrib = doc.CreateAttribute(attribute.Key); attrib.Value = attribute.Value; license.Attributes.Append(attrib); } return(doc); }
internal static XmlDocument CreateDocument(Guid id, string name, DateTime expirationDate, IDictionary<string, string> attributes, LicenseKind licenseKind) { var doc = new XmlDocument(); var license = doc.CreateElement(LicensingSR.License); doc.AppendChild(license); var idAttr = doc.CreateAttribute(LicensingSR.LicenseId); license.Attributes.Append(idAttr); idAttr.Value = id.ToString(); var expirDateAttr = doc.CreateAttribute(LicensingSR.LicenseExpiration); license.Attributes.Append(expirDateAttr); expirDateAttr.Value = expirationDate.ToString("yyyy-MM-ddTHH:mm:ss.fffffff", CultureInfo.InvariantCulture); var licenseAttr = doc.CreateAttribute(LicensingSR.LicenseKind); license.Attributes.Append(licenseAttr); licenseAttr.Value = licenseKind.ToString(); var nameEl = doc.CreateElement(LicensingSR.LicenseName); license.AppendChild(nameEl); nameEl.InnerText = name; foreach(var attribute in attributes) { var attrib = doc.CreateAttribute(attribute.Key); attrib.Value = attribute.Value; license.Attributes.Append(attrib); } return doc; }