protected override void Create() { var element = new AxReport { Name = ElementName }; MetaService.CreateReport(element, Model); }
public static void Create(UtilElementType type, string name) { if (Project == null) { throw new InvalidOperationException("No project selected."); } _name = name; switch (type) { case UtilElementType.DisplayTool: var existsDisplayTool = LocalUtils.MetaService.GetMenuItemDisplayNames().Contains(name); if (!existsDisplayTool) { var displayMenu = new AxMenuItemDisplay { Name = name }; LocalUtils.MetaService.CreateMenuItemDisplay(displayMenu, Model); AddAotElement <AxMenuItemDisplay>(); } break; case UtilElementType.OutputTool: var existsOutputTool = LocalUtils.MetaService.GetMenuItemDisplayNames().Contains(name); if (!existsOutputTool) { var outputMenu = new AxMenuItemOutput { Name = name }; LocalUtils.MetaService.CreateMenuItemOutput(outputMenu, Model); AddAotElement <AxMenuItemOutput>(); } break; case UtilElementType.ActionTool: var existsActionTool = LocalUtils.MetaService.GetMenuItemDisplayNames().Contains(name); if (!existsActionTool) { var actionMenu = new AxMenuItemAction { Name = name }; LocalUtils.MetaService.CreateMenuItemAction(actionMenu, Model); AddAotElement <AxMenuItemAction>(); } break; case UtilElementType.Query: var existsQuery = LocalUtils.MetaService.GetQueryNames().Contains(name); if (!existsQuery) { var query = new AxQuerySimple { Name = name }; LocalUtils.MetaService.CreateQuery(query, Model); AddAotElement <AxQuerySimple>(); } break; case UtilElementType.Enum: var Enum = LocalUtils.MetaService.GetEnumNames().Contains(name); if (!Enum) { var edtEnum = new AxEnum { Name = name }; LocalUtils.MetaService.CreateEnum(edtEnum, Model); AddAotElement <AxEnum>(); } break; case UtilElementType.ExtendedType: break; case UtilElementType.Table: var existsTable = LocalUtils.MetaService.GetTableNames().Contains(name); if (!existsTable) { var table = new AxTable { Name = name }; LocalUtils.MetaService.CreateTable(table, Model); AddAotElement <AxTable>(); } break; case UtilElementType.Class: var existsClass = LocalUtils.MetaService.GetClassNames().Contains(name); if (!existsClass) { var axClass = new AxClass { Name = name }; LocalUtils.MetaService.CreateClass(axClass, Model); AddAotElement <AxClass>(); } break; case UtilElementType.SSRSReport: var existsSsrsReport = LocalUtils.MetaService.GetReportNames().Contains(name); if (!existsSsrsReport) { var srsReport = new AxReport { Name = name }; LocalUtils.MetaService.CreateReport(srsReport, Model); AddAotElement <AxReport>(); } break; case UtilElementType.Form: var existsForm = LocalUtils.MetaService.GetFormNames().Contains(name); if (!existsForm) { var axForm = new AxForm { Name = name }; LocalUtils.MetaService.CreateForm(axForm, Model); AddAotElement <AxForm>(); } break; case UtilElementType.Menu: var existsMenu = LocalUtils.MetaService.GetMenuNames().Contains(name); if (!existsMenu) { var axMenu = new AxMenu { Name = name }; LocalUtils.MetaService.CreateMenu(axMenu, Model); AddAotElement <AxMenu>(); } break; case UtilElementType.SecDuty: var existsSecDuty = LocalUtils.MetaService.GetSecurityDutyNames().Contains(name); if (!existsSecDuty) { var axDuty = new AxSecurityDuty { Name = name }; LocalUtils.MetaService.CreateSecurityDuty(axDuty, Model); AddAotElement <AxSecurityDuty>(); } break; case UtilElementType.SecPolicy: var existsSecPolicy = LocalUtils.MetaService.GetSecurityPolicyNames().Contains(name); if (!existsSecPolicy) { var axPolicy = new AxSecurityPolicy { Name = name }; LocalUtils.MetaService.CreateSecurityPolicy(axPolicy, Model); AddAotElement <AxSecurityPolicy>(); } break; case UtilElementType.SecPrivilege: var existsSecPrivilege = LocalUtils.MetaService.GetSecurityPrivilegeNames().Contains(name); if (!existsSecPrivilege) { var privilege = new AxSecurityPrivilege { Name = name }; LocalUtils.MetaService.CreateSecurityPrivilege(privilege, Model); AddAotElement <AxSecurityPrivilege>(); } break; case UtilElementType.SecRole: var existsSecRole = LocalUtils.MetaService.GetSecurityRoleNames().Contains(name); if (!existsSecRole) { var role = new AxSecurityRole { Name = name }; LocalUtils.MetaService.CreateSecurityRole(role, Model); AddAotElement <AxSecurityRole>(); } break; default: throw new Exception("Element not supported"); } }