public string ResolveName(ObjectType objectType, int objectId)
        {
            switch (objectType)
            {
            case ObjectType.Table:
                return(Tables.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.Form:
                return(Forms.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.Report:
                return(Reports.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.Dataport:
                return(Dataports.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.Codeunit:
                return(Codeunits.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.XmlPort:
                return(XmlPorts.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.MenuSuite:
                return(MenuSuites.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.Page:
                return(Pages.FirstOrDefault(o => o.ID == objectId)?.Name);

            case ObjectType.Query:
                return(Queries.FirstOrDefault(o => o.ID == objectId)?.Name);
            }
            return(null);
        }
Example #2
0
 public static void Write(this Dataports dataports, CSideWriter writer)
 {
     foreach (var dataport in dataports.OrderBy(f => f.ID))
     {
         dataport.Write(writer);
     }
 }
        public void Clear()
        {
            Tables.Clear();
#if NAV2009
            Forms.Clear();
            Dataports.Clear();
#endif
            Pages.Clear();
            Reports.Clear();
            XmlPorts.Clear();
            Codeunits.Clear();
            Queries.Clear();
            MenuSuites.Clear();
        }
        public Application(params Object[] objects)
        {
            Tables = new Tables(this, objects.OfType <Table.Table>());
#if NAV2009
            Forms     = new Forms(this, objects.OfType <Form.Form>());
            Dataports = new Dataports(this, objects.OfType <Dataport.Dataport>());
#endif
            Pages      = new Pages(this, objects.OfType <Page.Page>());
            Reports    = new Reports(this, objects.OfType <Report.Report>());
            XmlPorts   = new XmlPorts(this, objects.OfType <XmlPort.XmlPort>());
            Codeunits  = new Codeunits(this, objects.OfType <Codeunit.Codeunit>());
            Queries    = new Queries(this, objects.OfType <Query.Query>());
            MenuSuites = new MenuSuites(this, objects.OfType <MenuSuite.MenuSuite>());
            CodeStyle  = new ApplicationCodeStyle();
        }