public void FromXml(XElement element, IFromXmlContext ctx) { DisplayName = element.Attribute("DisplayName").Value; Query = ctx.GetQuery(element.Attribute("Query").Value); EntityType = element.Attribute("EntityType")?.Let(a => ctx.GetType(a.Value)); HideQuickLink = element.Attribute("HideQuickLink")?.Let(a => bool.Parse(a.Value)) ?? false; Owner = element.Attribute("Owner")?.Let(a => Lite.Parse(a.Value)) !; Filters.Synchronize(element.Element("Filters")?.Elements().ToList(), (f, x) => f.FromXml(x, ctx)); Columns.Synchronize(element.Element("Columns")?.Elements().ToList(), (c, x) => c.FromXml(x, ctx)); Parameters.Synchronize(element.Element("Parameters")?.Elements().ToList(), (p, x) => p.FromXml(x, ctx)); ChartScript = ctx.ChartScript(element.Attribute("ChartScript").Value); ParseData(ctx.GetQueryDescription(Query)); }
public void FromXml(XElement element, IFromXmlContext ctx) { Query = ctx.GetQuery(element.Attribute("Query").Value); DisplayName = element.Attribute("DisplayName").Value; EntityType = element.Attribute("EntityType")?.Let(a => ctx.GetType(a.Value)); HideQuickLink = element.Attribute("HideQuickLink")?.Let(a => bool.Parse(a.Value)) ?? false; Owner = element.Attribute("Owner")?.Let(a => Lite.Parse(a.Value)) !; AppendFilters = element.Attribute("AppendFilters")?.Let(a => a.Value == true.ToString()) ?? false; ElementsPerPage = element.Attribute("ElementsPerPage")?.Let(a => int.Parse(a.Value)); PaginationMode = element.Attribute("PaginationMode")?.Let(a => a.Value.ToEnum <PaginationMode>()); ColumnsMode = element.Attribute("ColumnsMode").Value.ToEnum <ColumnOptionsMode>(); Filters.Synchronize(element.Element("Filters")?.Elements().ToList(), (f, x) => f.FromXml(x, ctx)); Columns.Synchronize(element.Element("Columns")?.Elements().ToList(), (c, x) => c.FromXml(x, ctx)); Orders.Synchronize(element.Element("Orders")?.Elements().ToList(), (o, x) => o.FromXml(x, ctx)); ParseData(ctx.GetQueryDescription(Query)); }
public void FromXml(XElement element, IFromXmlContext ctx) { Guid = Guid.Parse(element.Attribute("Guid").Value); Name = element.Attribute("Name").Value; DisableAuthorization = element.Attribute("DisableAuthorization")?.Let(a => bool.Parse(a.Value)) ?? false; Query = ctx.GetQuery(element.Attribute("Query").Value); EditableMessage = bool.Parse(element.Attribute("EditableMessage").Value); Model = element.Attribute("Model")?.Let(at => ctx.GetEmailModel(at.Value)); SendDifferentMessages = bool.Parse(element.Attribute("SendDifferentMessages").Value); MasterTemplate = element.Attribute("MasterTemplate")?.Let(a => (Lite <EmailMasterTemplateEntity>)ctx.GetEntity(Guid.Parse(a.Value)).ToLite()); SendDifferentMessages = bool.Parse(element.Attribute("GroupResults").Value); Filters.Synchronize(element.Element("Filters")?.Elements().ToList(), (f, x) => f.FromXml(x, ctx)); Orders.Synchronize(element.Element("Orders")?.Elements().ToList(), (o, x) => o.FromXml(x, ctx)); IsBodyHtml = bool.Parse(element.Attribute("IsBodyHtml").Value); From = element.Element("From")?.Let(from => new EmailTemplateContactEmbedded { DisplayName = from.Attribute("DisplayName")?.Value, EmailAddress = from.Attribute("EmailAddress")?.Value, Token = from.Attribute("Token")?.Let(t => new QueryTokenEmbedded(t.Value)), }); Recipients = element.Element("Recipients").Elements("Recipient").Select(rep => new EmailTemplateRecipientEmbedded { DisplayName = rep.Attribute("DisplayName").Value, EmailAddress = rep.Attribute("EmailAddress").Value, Kind = rep.Attribute("Kind").Value.ToEnum <EmailRecipientKind>(), Token = rep.Attribute("Token")?.Let(a => new QueryTokenEmbedded(a.Value)) }).ToMList(); Messages = element.Element("Messages").Elements("Message").Select(elem => new EmailTemplateMessageEmbedded(ctx.GetCultureInfoEntity(elem.Attribute("CultureInfo").Value)) { Subject = elem.Attribute("Subject").Value, Text = elem.Value }).ToMList(); Applicable = element.Element("Applicable")?.Let(app => new TemplateApplicableEval { Script = app.Value }); ParseData(ctx.GetQueryDescription(Query)); }
public void FromXml(XElement element, IFromXmlContext ctx) { Guid = Guid.Parse(element.Attribute("Guid").Value); Name = element.Attribute("Name").Value; DisableAuthorization = element.Attribute("DisableAuthorization")?.Let(a => bool.Parse(a.Value)) ?? false; Query = ctx.GetQuery(element.Attribute("Query").Value); EditableMessage = bool.Parse(element.Attribute("EditableMessage").Value); Model = ctx.GetEmailModel(element.Attribute("SystemEmail").Value); SendDifferentMessages = bool.Parse(element.Attribute("SendDifferentMessages").Value); MasterTemplate = Lite.ParsePrimaryKey <EmailMasterTemplateEntity>(element.Attribute("MasterTemplate").Value); IsBodyHtml = bool.Parse(element.Attribute("IsBodyHtml").Value); From = element.Element("From")?.Let(from => new EmailTemplateContactEmbedded { DisplayName = from.Attribute("DisplayName").Value, EmailAddress = from.Attribute("EmailAddress").Value, Token = from.Attribute("Token")?.Let(t => new QueryTokenEmbedded(t.Value)), }); Recipients = element.Element("Recipients").Elements("Recipient").Select(rep => new EmailTemplateRecipientEmbedded { DisplayName = rep.Attribute("DisplayName").Value, EmailAddress = rep.Attribute("EmailAddress").Value, Kind = rep.Attribute("Kind").Value.ToEnum <EmailRecipientKind>(), Token = rep.Attribute("Token") != null ? new QueryTokenEmbedded(rep.Attribute("Token").Value) : null }).ToMList(); Messages = element.Element("Messages").Elements("Message").Select(elem => new EmailTemplateMessageEmbedded(ctx.GetCultureInfoEntity(elem.Attribute("CultureInfo").Value)) { Subject = elem.Attribute("Subject").Value, Text = elem.Value }).ToMList(); Applicable = element.Element("Applicable")?.Let(app => new TemplateApplicableEval { Script = app.Value }); ParseData(ctx.GetQueryDescription(Query)); }
public void FromXml(XElement element, IFromXmlContext ctx) { DisplayName = element.Attribute("DisplayName").Value; Query = ctx.GetQuery(element.Attribute("Query").Value); EntityType = element.Attribute("EntityType")?.Let(a => ctx.GetType(a.Value)); Owner = element.Attribute("Owner")?.Let(a => Lite.Parse(a.Value)); ChartScript = ctx.ChartScript(element.Attribute("ChartScript").Value); GroupResults = bool.Parse(element.Attribute("GroupResults").Value); Filters.Synchronize((element.Element("Filters")?.Elements()).EmptyIfNull().ToList(), (f, x) => f.FromXml(x, ctx)); Columns.Synchronize((element.Element("Columns")?.Elements()).EmptyIfNull().ToList(), (c, x) => c.FromXml(x, ctx)); Orders.Synchronize((element.Element("Orders")?.Elements()).EmptyIfNull().ToList(), (o, x) => o.FromXml(x, ctx)); Parameters.Synchronize((element.Element("Parameters")?.Elements()).EmptyIfNull().ToList(), (p, x) => p.FromXml(x, ctx)); ParseData(ctx.GetQueryDescription(Query)); }
public void FromXml(XElement element, IFromXmlContext ctx) { Query = ctx.GetQuery(element.Attribute("Query").Value); DisplayName = element.Attribute("DisplayName").Value; EntityType = element.Attribute("EntityType")?.Let(a => ctx.GetType(a.Value)); Owner = element.Attribute("Owner")?.Let(a => Lite.Parse(a.Value)); WithoutFilters = element.Attribute("WithoutFilters")?.Let(a => a.Value == true.ToString()) ?? false; ElementsPerPage = element.Attribute("ElementsPerPage")?.Let(a => int.Parse(a.Value)); PaginationMode = element.Attribute("PaginationMode")?.Let(a => a.Value.ToEnum<PaginationMode>()); ColumnsMode = element.Attribute("ColumnsMode").Value.ToEnum<ColumnOptionsMode>(); Filters.Synchronize(element.Element("Filters")?.Elements().EmptyIfNull().ToList(), (f, x) => f.FromXml(x, ctx)); Columns.Synchronize(element.Element("Columns")?.Elements().EmptyIfNull().ToList(), (c, x) => c.FromXml(x, ctx)); Orders.Synchronize(element.Element("Orders")?.Elements().EmptyIfNull().ToList(), (o, x) => o.FromXml(x, ctx)); ParseData(ctx.GetQueryDescription(Query)); }