Esempio n. 1
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     PartnerResourceRule = new ResourceRule <Olma.Partner>(context.Request.Id, rule).IgnoreQueryFilter();
 }
Esempio n. 2
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     AddressResourceRule = new ResourceRule <Olma.Address>(context.Request.Id, rule);
 }
Esempio n. 3
0
 public RepositoryBase(ContextModel context, DbContextTransaction transaction)
 {
     mContext     = context;
     mTransaction = transaction;
 }
Esempio n. 4
0
 public ClientesController(ContextModel context)
 {
     _context = context;
 }
        /// <summary>
        /// Render the document
        /// </summary>
        /// <param name="document"></param>
        /// <param name="wdDoc"></param>
        /// <param name="context"></param>
        /// <param name="formatProvider"></param>
        public static void Render(this Document document, WordprocessingDocument wdDoc, ContextModel context, bool addPageBreak, IFormatProvider formatProvider)
        {
            foreach (var pageItem in document.Pages)
            {
                if (pageItem is ForEachPage)
                {
                    // render page
                    ((ForEachPage)pageItem).Render(document, wdDoc.MainDocumentPart.Document.Body, context, wdDoc.MainDocumentPart, formatProvider);
                }
                else if (pageItem is Page)
                {
                    var page = (Page)pageItem;

                    // doc inherit margin from page
                    if (document.Margin == null && page.Margin != null)
                    {
                        document.Margin = page.Margin;
                    }
                    // page inherit margin from doc
                    else if (document.Margin != null && page.Margin == null)
                    {
                        page.Margin = document.Margin;
                    }

                    // render page
                    page.Render(document, wdDoc.MainDocumentPart.Document.Body, context, wdDoc.MainDocumentPart, formatProvider);
                }
            }
            //Replace Last page break
            if (!addPageBreak &&
                wdDoc.MainDocumentPart.Document.Body.LastChild != null &&
                wdDoc.MainDocumentPart.Document.Body.LastChild is DocumentFormat.OpenXml.Wordprocessing.Paragraph &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild != null &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild is DocumentFormat.OpenXml.Wordprocessing.ParagraphProperties &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild.FirstChild != null &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild.FirstChild is DocumentFormat.OpenXml.Wordprocessing.SectionProperties)
            {
                DocumentFormat.OpenXml.Wordprocessing.Paragraph lastChild = (DocumentFormat.OpenXml.Wordprocessing.Paragraph)wdDoc.MainDocumentPart.Document.Body.LastChild;
                wdDoc.MainDocumentPart.Document.Body.RemoveChild(lastChild);
            }
        }
 public CategorySetController(ICategorySetModel categorySet, ILoggerManager logger, IOptions <Sheev.Common.Models.MongoDbSetting> mongoDbSettings, IOptions <Sheev.Common.Models.ApiUrlSetting> apiSettings)
 {
     _context     = new Models.ContextModel(mongoDbSettings, apiSettings, logger);
     _categorySet = categorySet;
 }
Esempio n. 7
0
 public BlacklistTermsRule(MainRule.ContextModel context, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(context, this);
     ParentRule = parentRule;
 }
Esempio n. 8
0
 // TODO: Load correct model here
 public CSCC(ContextModel <CsccContextInfo> model)
 {
     _model = model;
 }
        private FactRuleCollection UiSettingsRules()
        {
            return(new FactRuleCollection
            {
                (Version1 v, OpenSettings_SettingModel model) =>
                {
                    return new OpenSettings_SettingValueError(model.Value.ValueError
                                                              ?? new SettingValueError
                    {
                        ErrorMessage = "Invalid setting value. Make sure you set the value correctly",
                        SettingFullCode = model.Value.Setting.FullCode,
                    });
                },
                (Version1 v, OpenSettings_SettingModel model) =>
                {
                    return new OpenSettings_SettingModel_Setting(model.Value.ToSetting());
                },
                (Version1 v, OpenSettings_SettingModel model) =>
                {
                    return new OpenSettings_SettingModel_SettingType(model.Value.SettingType);
                },
                (Version1 v, OpenSettings_SettingModel_Setting setting, OpenSettings_SettingValueError settingValueError, OpenSettings_SettingModel_SettingType type) =>
                {
                    var errors = new List <string>();

                    try
                    {
                        GetAdapter <SettingsAdapter>().ValidateSetting(setting, type);
                    }
                    catch (GetcuReoneException)
                    {
                        errors.Add(settingValueError.Value.ErrorMessage);
                    }
                    catch
                    {
                        throw;
                    }

                    return new OpenSettings_SettingModel_ValidationErrors(errors);
                },
                (Version1 v) =>
                {
                    return new OpenSettings_Context(
                        GetAdapter <SettingsAdapter>().GetContext(true));
                },
                (Version1 v) =>
                {
                    return new OpenSettings_SettingTypes(
                        GetAdapter <SettingsAdapter>().GetSettingTypes());
                },
                (Version1 v, OpenSettings_Context context, OpenSettings_SettingTypes settingTypes, OpenSettings_SettingValueErrors settingValueErrors, OpenSettings_ViewModel viewModel) =>
                {
                    return new OpenSettings_NamespaceModels(
                        GetFacade <UiSettingFacade>().GetNamespaceModels(context, settingTypes.Value, settingValueErrors, viewModel.Value));
                },
                (Version1 v, OpenSettings_Context context, OpenSettings_NamespaceModels namespaces, OpenSettings_ViewModel viewModel) =>
                {
                    var result = new ContextModel
                    {
                        Context = context,
                        Namespaces = new ObservableCollection <NamespaceModel>(namespaces),
                    };

                    viewModel.Value.BindModel(result);
                    return new OpenSettings_ContextModel(result);
                },
                (Version1 v, OpenSettings_NamespaceModels namespaces) =>
                {
                    return new OpenSettings_SettingModels(
                        namespaces.Value.SelectMany(item => item.Settings).ToList());
                },
                (Version1 v, OpenSettings_SettingModels settings) =>
                {
                    return new OpenSettings_Settings_Changed(
                        settings.Value
                        .Where(setting => !setting.Value.EqualsOrdinal(setting.Setting.Value))
                        .Select(UiSettingsHelper.ToSetting)
                        .ToList());
                }
            });
        }
Esempio n. 10
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     ExpressCodeAuthorizationRule = new ResourceAuthorizationRule <Olma.ExpressCode, CanCancelExpressCodeRequirement, DivisionPermissionResource>(context.Parent, rule);
 }
        public void Save(ContextModel model)
        {
            Dependencies.FileWriter.WriteFile(model.Class);

            //Dependencies.FileWriter.WriteFile(model.Interface);
        }
Esempio n. 12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        public void insertContext(ref Graph g, ContextModel ctx )
        {
            g = new Graph();
            g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#"));

            IUriNode sujeito = g.CreateUriNode("onto:" + student.Matricula);
            INode rdfType = g.CreateUriNode("onto:Context");

            IUriNode objeto = g.CreateUriNode(new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#" + ctx));

            Triple triple = new Triple(sujeito, rdfType, objeto);
            g.Assert(triple);
        }
Esempio n. 13
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     TransportValid = new TransportValidRule(context, rule);
 }
Esempio n. 14
0
 public MainRule(TransportOfferingBidCreateRequest transportOfferingBidCreateRequest)
 {
     // Create Context
     Context = new ContextModel(transportOfferingBidCreateRequest, this);
 }
Esempio n. 15
0
 public MainRule(CustomerCreateRequest request, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(request, this);
     ParentRule = parentRule;
 }
Esempio n. 16
0
 public List <int> GetMachinePanels(ContextModel context)
 {
     return(GetMachinePanels(context.ActualMachine.MachineModelId));
 }
        /// <summary>
        /// Add styles for table of contents levels
        /// </summary>
        /// <param name="document"></param>
        /// <param name="tableOfContents"></param>
        /// <param name="context"></param>
        private static void AddToCStyles(MainDocumentPart document, TableOfContents tableOfContents, ContextModel context)
        {
            var stylesPart = document.StyleDefinitionsPart;

            if (tableOfContents.ToCStylesId.Any())
            {
                for (int i = 0; i < tableOfContents.ToCStylesId.Count; i++)
                {
                    Style style = new Style()
                    {
                        StyleId      = string.Concat("toc ", i + 1),
                        StyleBasedOn = tableOfContents.ToCStylesId[i],
                        CustomStyle  = false
                    };
                    style.Render(stylesPart, context);
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Render the document
        /// </summary>
        /// <param name="document"></param>
        /// <param name="wdDoc"></param>
        /// <param name="context"></param>
        /// <param name="formatProvider"></param>
        public static void Render(this Document document, WordprocessingDocument wdDoc, ContextModel context, IFormatProvider formatProvider)
        {
            // add styles in document
            var spart = wdDoc.MainDocumentPart.AddNewPart <StyleDefinitionsPart>();

            spart.Styles = new DocumentFormat.OpenXml.Wordprocessing.Styles();
            foreach (var style in document.Styles)
            {
                style.Render(spart, context);
            }

            foreach (var pageItem in document.Pages)
            {
                if (pageItem is ForEachPage)
                {
                    // render page
                    ((ForEachPage)pageItem).Render(document, wdDoc.MainDocumentPart.Document.Body, context, wdDoc.MainDocumentPart, formatProvider);
                }
                else if (pageItem is Page)
                {
                    var page = (Page)pageItem;

                    // doc inherit margin from page
                    if (document.Margin == null && page.Margin != null)
                    {
                        document.Margin = page.Margin;
                    }
                    // page inherit margin from doc
                    else if (document.Margin != null && page.Margin == null)
                    {
                        page.Margin = document.Margin;
                    }

                    // render page
                    page.Render(document, wdDoc.MainDocumentPart.Document.Body, context, wdDoc.MainDocumentPart, formatProvider);
                }
            }

            //Replace Last page break
            if (wdDoc.MainDocumentPart.Document.Body.LastChild != null &&
                wdDoc.MainDocumentPart.Document.Body.LastChild is DocumentFormat.OpenXml.Wordprocessing.Paragraph &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild != null &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild is DocumentFormat.OpenXml.Wordprocessing.ParagraphProperties &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild.FirstChild != null &&
                wdDoc.MainDocumentPart.Document.Body.LastChild.FirstChild.FirstChild is DocumentFormat.OpenXml.Wordprocessing.SectionProperties)
            {
                DocumentFormat.OpenXml.Wordprocessing.Paragraph         lastChild        = (DocumentFormat.OpenXml.Wordprocessing.Paragraph)wdDoc.MainDocumentPart.Document.Body.LastChild;
                DocumentFormat.OpenXml.Wordprocessing.SectionProperties sectionPropertie = (DocumentFormat.OpenXml.Wordprocessing.SectionProperties)lastChild.FirstChild.FirstChild.Clone();
                wdDoc.MainDocumentPart.Document.Body.ReplaceChild(sectionPropertie, wdDoc.MainDocumentPart.Document.Body.LastChild);
            }

            // footers
            foreach (var footer in document.Footers)
            {
                footer.Render(document, wdDoc.MainDocumentPart, context, formatProvider);
            }
            // headers
            foreach (var header in document.Headers)
            {
                header.Render(document, wdDoc.MainDocumentPart, context, formatProvider);
            }
        }
 /// <summary>
 /// Table of contents render
 /// </summary>
 /// <param name="tableOfContents"></param>
 /// <param name="documentPart"></param>
 /// <param name="context"></param>
 public static void Render(this TableOfContents tableOfContents, OpenXmlPart documentPart, ContextModel context)
 {
     AddToC(documentPart as MainDocumentPart, tableOfContents);
     AddToCStyles(documentPart as MainDocumentPart, tableOfContents, context);
 }
        /// <summary>
        /// Render a table element
        /// </summary>
        /// <param name="uniformGrid"></param>
        /// <param name="parent"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public static DocumentFormat.OpenXml.Wordprocessing.Table Render(this UniformGrid uniformGrid, Document document, OpenXmlElement parent, ContextModel context, OpenXmlPart documentPart, IFormatProvider formatProvider)
        {
            context.ReplaceItem(uniformGrid, formatProvider);

            if (!string.IsNullOrEmpty(uniformGrid.DataSourceKey) && context.ExistItem <DataSourceModel>(uniformGrid.DataSourceKey))
            {
                var datasource = context.GetItem <DataSourceModel>(uniformGrid.DataSourceKey);

                if (datasource != null && datasource.Items.Count > 0)
                {
                    var createdTable = TableExtensions.CreateTable(document, uniformGrid, context, documentPart, formatProvider);
                    var wordTable    = createdTable.Item1;
                    var tableLook    = createdTable.Item2;

                    // Before rows :
                    TableExtensions.ManageBeforeAfterRows(document, uniformGrid, uniformGrid.BeforeRows, wordTable, context, documentPart, formatProvider);

                    // Table of cells :
                    List <List <ContextModel> > rowsContentContexts = new List <List <ContextModel> >();

                    int i            = 0;
                    var lastCellsRow = new List <ContextModel>();

                    // add content rows
                    foreach (var item in datasource.Items)
                    {
                        if (i > 0 && i % uniformGrid.ColsWidth.Length == 0)
                        {
                            // end of line :
                            rowsContentContexts.Add(lastCellsRow);
                            lastCellsRow = new List <ContextModel>();
                        }
                        lastCellsRow.Add(item);

                        i++;
                    }

                    if (i % uniformGrid.ColsWidth.Length == 0)
                    {
                        rowsContentContexts.Add(lastCellsRow);
                    }

                    if (datasource.Items.Count % uniformGrid.ColsWidth.Length > 0)
                    {
                        var acountAddNullItems = uniformGrid.ColsWidth.Length - (datasource.Items.Count % uniformGrid.ColsWidth.Length);
                        if (acountAddNullItems > 0)
                        {
                            for (int j = 0; j < acountAddNullItems; j++)
                            {
                                lastCellsRow.Add(new ContextModel());
                            }
                            rowsContentContexts.Add(lastCellsRow);
                        }
                    }

                    // Now we create all row :
                    i = 0;
                    foreach (var rowContentContext in rowsContentContexts)
                    {
                        var row = new Row
                        {
                            CantSplit = uniformGrid.CantSplitRows,
                        };
                        row.InheritFromParent(uniformGrid);

                        wordTable.AppendChild(row.Render(document, wordTable, context, rowContentContext, uniformGrid.CellModel, documentPart, false, (i % 2 == 1), formatProvider));

                        i++;
                    }

                    // After rows :
                    TableExtensions.ManageBeforeAfterRows(document, uniformGrid, uniformGrid.AfterRows, wordTable, context, documentPart, formatProvider);

                    TableExtensions.ManageFooterRow(document, uniformGrid, wordTable, tableLook, context, documentPart, formatProvider);

                    parent.AppendChild(wordTable);
                    return(wordTable);
                }
            }

            return(null);
        }
 public ExpressCodeSearchQueryRule(ExpressCodesSearchRequest request, IRule parentRule)
 {
     // Create Context
     Context    = new ContextModel(request, this);
     ParentRule = parentRule;
 }
Esempio n. 22
0
 public PetsController(ContextModel context)
 {
     _context = context;
 }
        internal static OpenXmlElement Render(this BaseElement element, Document document, OpenXmlElement parent, ContextModel context, OpenXmlPart documentPart, IFormatProvider formatProvider)
        {
            context.ReplaceItem(element, formatProvider);

            OpenXmlElement createdElement = null;

            if (element.Show)
            {
                createdElement = element.RenderItem(document, parent, context, documentPart, formatProvider);
            }
            return(createdElement);
        }
Esempio n. 24
0
 public RulesBundle(ContextModel context, IRule rule)
 {
 }
        private static OpenXmlElement RenderItem(this BaseElement element, Document document, OpenXmlElement parent, ContextModel context, OpenXmlPart documentPart, IFormatProvider formatProvider)
        {
            OpenXmlElement createdElement = null;

            // Keep this statement order, because of the UniformGrid inherits from Table
            if (element is ForEach)
            {
                (element as ForEach).Render(document, parent, context, documentPart, formatProvider);
            }
            else if (element is Label)
            {
                createdElement = (element as Label).Render(parent, context, documentPart, formatProvider);
            }
            else if (element is BookmarkStart)
            {
                createdElement = (element as BookmarkStart).Render(parent, context, formatProvider);
            }
            else if (element is BookmarkEnd)
            {
                createdElement = (element as BookmarkEnd).Render(parent, context, formatProvider);
            }
            else if (element is Hyperlink)
            {
                createdElement = (element as Hyperlink).Render(parent, context, documentPart, formatProvider);
            }
            else if (element is Paragraph)
            {
                createdElement = (element as Paragraph).Render(parent, context, formatProvider);
            }
            else if (element is Image)
            {
                createdElement = (element as Image).Render(parent, context, documentPart);
            }
            else if (element is UniformGrid)
            {
                createdElement = (element as UniformGrid).Render(document, parent, context, documentPart, formatProvider);
            }
            else if (element is Table)
            {
                createdElement = (element as Table).Render(document, parent, context, documentPart, formatProvider);
            }
            else if (element is TableOfContents)
            {
                (element as TableOfContents).Render(documentPart, context);
            }
            else if (element is BarModel)
            {
                (element as BarModel).Render(parent, context, documentPart, formatProvider);
            }
            else if (element is HtmlContent)
            {
                (element as HtmlContent).Render(parent, context, documentPart, formatProvider);
            }

            if (element.ChildElements != null && element.ChildElements.Count > 0)
            {
                for (int i = 0; i < element.ChildElements.Count; i++)
                {
                    var e = element.ChildElements[i];

                    if (e is TemplateModel)
                    {
                        var elements = (e as TemplateModel).ExtractTemplateItems(document);
                        if (i == element.ChildElements.Count - 1)
                        {
                            element.ChildElements.AddRange(elements);
                        }
                        else
                        {
                            element.ChildElements.InsertRange(i + 1, elements);
                        }
                    }
                    else
                    {
                        e.InheritFromParent(element);
                        e.Render(document, createdElement ?? parent, context, documentPart, formatProvider);
                    }
                }
            }

            return(createdElement);
        }
Esempio n. 26
0
        public CodeOutput GenerateContext()
        {
            if (!CanWriteContext())
            {
                return(null);
            }

            var indexes = new List <string>();

            foreach (var table in _tables)
            {
                var columns = table.Table.Columns
                              .Where(x => !x.Hidden && !string.IsNullOrEmpty(x.Config))
                              .OrderBy(x => x.Ordinal)
                              .ToList();

                indexes.AddRange(columns
                                 .Select(_generator.IndexModelBuilder)
                                 .Where(x => !string.IsNullOrEmpty(x)));
            }

            var isEfCore3 = Settings.TemplateType == TemplateType.EfCore3;

            var data = new ContextModel
            {
                DbContextClassModifiers = Settings.DbContextClassModifiers,
                DbContextName           = Settings.DbContextName,
                DbContextBaseClass      = Settings.DbContextBaseClass,
                AddParameterlessConstructorToDbContext = Settings.AddParameterlessConstructorToDbContext,
                HasDefaultConstructorArgument          = !string.IsNullOrEmpty(Settings.DefaultConstructorArgument),
                DefaultConstructorArgument             = Settings.DefaultConstructorArgument,
                ConfigurationClassName  = Settings.ConfigurationClassName,
                ConnectionString        = Settings.ConnectionString,
                contextInterface        = string.IsNullOrWhiteSpace(Settings.DbContextInterfaceName) ? "" : ", " + Settings.DbContextInterfaceName,
                setInitializer          = string.Format("<{0}>(null);", Settings.DbContextName),
                DbContextClassIsPartial = Settings.DbContextClassIsPartial(),
                SqlCe          = Settings.DatabaseType == DatabaseType.SqlCe,
                tables         = _tables,
                hasTables      = _hasTables,
                indexes        = indexes,
                hasIndexes     = indexes.Any(),
                storedProcs    = _storedProcs,
                hasStoredProcs = _hasStoredProcs,
                tableValuedFunctionComplexTypes    = _tableValuedFunctionComplexTypes,
                hasTableValuedFunctionComplexTypes = _hasTableValuedFunctionComplexTypes,
                AdditionalContextInterfaceItems    = Settings.AdditionalContextInterfaceItems.Where(x => !string.IsNullOrEmpty(x)).ToList(),
                addSaveChanges                  = !Settings.UseInheritedBaseInterfaceFunctions,
                tableValuedFunctions            = _tableValuedFunctions,
                scalarValuedFunctions           = _scalarValuedFunctions,
                hasTableValuedFunctions         = _hasTableValuedFunctions && _filter.IncludeTableValuedFunctions,
                hasScalarValuedFunctions        = _hasScalarValuedFunctions && _filter.IncludeScalarValuedFunctions,
                IncludeObjectContextConstructor = !Settings.DbContextBaseClass.Contains("IdentityDbContext"),
                QueryString                       = isEfCore3 ? "Set"           : "Query",
                FromSql                           = isEfCore3 ? "FromSqlRaw"    : "FromSql",
                ExecuteSqlCommand                 = isEfCore3 ? "ExecuteSqlRaw" : "ExecuteSqlCommand",
                StoredProcModelBuilderCommand     = isEfCore3 ? "Entity"        : "Query",
                StoredProcModelBuilderPostCommand = isEfCore3 ? ".HasNoKey()"   : string.Empty
            };

            var co = new CodeOutput(Settings.DbContextName + Settings.FileExtension, "Database context", GlobalUsings);

            co.AddUsings(Template.DatabaseContextUsings(data));
            co.AddCode(Template.Transform(Template.DatabaseContext(), data));

            return(co);
        }
Esempio n. 27
0
 public MainRule(OrderSearchRequest request)
 {
     // Create Context
     Context = new ContextModel(request, this);
 }
Esempio n. 28
0
 public MainRule(AddressesDeleteRequest request, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(request, this);
     ParentRule = parentRule;
 }
Esempio n. 29
0
 public SysRoleService()
 {
     this.sysFunctionWebAPIBLL.ContextInfo = this.ContextInfo;
 }
Esempio n. 30
0
        /// <summary>
        /// Render a bookmarkStart element.
        /// </summary>
        /// <param name="hyperlink"></param>
        /// <param name="parent"></param>
        /// <param name="context"></param>
        /// <param name="documentPart"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        public static OpenXmlElement Render(this BookmarkStart bookmarkStart, OpenXmlElement parent, ContextModel context, IFormatProvider formatProvider)
        {
            context.ReplaceItem(bookmarkStart, formatProvider);

            if (bookmarkStart.Show)
            {
                DocumentFormat.OpenXml.Wordprocessing.BookmarkStart bookmarkStartElement = new DocumentFormat.OpenXml.Wordprocessing.BookmarkStart()
                {
                    Id   = bookmarkStart.Id,
                    Name = bookmarkStart.Name
                };

                parent.Append(bookmarkStartElement);

                return(bookmarkStartElement);
            }

            return(null);
        }
Esempio n. 31
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     QueryBid   = new QueryBidRule(context, rule);
     Required   = new ValidOperatorRule <ContextModel>(context, (c) => c.Bid != null, null, rule);
     StateValid = new StateValidRule(context, rule);
 }