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) { DisplayName = element.Attribute("DisplayName") !.Value; EntityType = element.Attribute("EntityType")?.Let(a => ctx.GetTypeLite(a.Value)); Owner = element.Attribute("Owner")?.Let(a => Lite.Parse <Entity>(a.Value)); HideDisplayName = element.Attribute("HideDisplayName")?.Let(a => bool.Parse(a.Value)) ?? false; DashboardPriority = element.Attribute("DashboardPriority")?.Let(a => int.Parse(a.Value)); EmbeddedInEntity = element.Attribute("EmbeddedInEntity")?.Let(a => a.Value.ToEnum <DashboardEmbedededInEntity>()); CombineSimilarRows = element.Attribute("CombineSimilarRows")?.Let(a => bool.Parse(a.Value)) ?? false; CacheQueryConfiguration = CacheQueryConfiguration.CreateOrAssignEmbedded(element.Element(nameof(CacheQueryConfiguration)), (cqc, elem) => cqc.FromXml(elem)); Parts.Synchronize(element.Element("Parts") !.Elements().ToList(), (pp, x) => pp.FromXml(x, ctx)); TokenEquivalencesGroups.Synchronize(element.Element(nameof(TokenEquivalencesGroups))?.Elements().ToList() ?? new List <XElement>(), (teg, x) => teg.FromXml(x, ctx)); ParseData(q => ctx.GetQueryDescription(q)); }
public void FromXml(XElement element, IFromXmlContext ctx) { Query = ctx.TryGetQuery(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().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) { Query = ctx.GetQuery(element.Attribute("Query") !.Value); DisplayName = element.Attribute("DisplayName") !.Value; EntityType = element.Attribute("EntityType")?.Let(a => ctx.GetType(a.Value).ToLite()); Owner = element.Attribute("Owner")?.Let(a => Lite.Parse(a.Value)) !; HideQuickLink = element.Attribute("HideQuickLink")?.Let(a => bool.Parse(a.Value)) ?? false; IncludeDefaultFilters = element.Attribute("IncludeDefaultFilters")?.Let(a => bool.Parse(a.Value)); AppendFilters = element.Attribute("AppendFilters")?.Let(a => bool.Parse(a.Value)) ?? false; GroupResults = element.Attribute("GroupResults")?.Let(a => bool.Parse(a.Value)) ?? 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 = 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.GetTypeLite(a.Value)); HideQuickLink = element.Attribute("HideQuickLink")?.Let(a => bool.Parse(a.Value)) ?? false; Owner = element.Attribute("Owner")?.Let(a => Lite.Parse(a.Value)) !; ChartScript = ctx.ChartScript(element.Attribute("ChartScript") !.Value); MaxRows = element.Attribute("MaxRows")?.Let(at => at.Value.ToInt()); 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)); var paramsXml = (element.Element("Parameters")?.Elements()).EmptyIfNull().ToDictionary(a => a.Attribute("Name") !.Value); Parameters.ForEach(p => { var pxml = paramsXml.TryGetC(p.Name); if (pxml != null) { p.FromXml(pxml, ctx); } }); 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)); }