Example #1
0
        public void Visit(CreateTableCommand command)
        {
            var tableCreator = _app.BusinessObjects.GetBusinessObject <UserTablesMD>(BoObjectTypes.oUserTables);

            try {
                tableCreator.TableName        = command.Name;
                tableCreator.TableDescription = command.Description;
                tableCreator.TableType        = command.TableType;
                var created = tableCreator.Add();
                if (created != 0)
                {
                    string error = _app.BusinessObjects.GetLastErrorDescription();
                    throw new B1CoreException(string.Format("Error: {0} - tabela: {1}", error, command.Name));
                }
            }
            finally {
                _app.BusinessObjects.ReleaseObject(tableCreator);
            }
            foreach (var columnCommand in command.TableCommands)
            {
                Visit(columnCommand);
            }
            foreach (var indexCommand in command.IndexCommands.Values)
            {
                Visit(indexCommand);
            }
            //Mostra a mensagem antes de criar o User Object, pois este é um comando bonus e pode ser
            //criado separadamente
            _app.SetStatusBarSucess(string.Format("Tabela {0} criada com sucesso.", command.Name));

            if (command.HasObject)
            {
                Visit(command.ObjectCommand);
            }
        }
        public SchemaBuilder CreateMasterLines(string name, string description, Action <CreateTableCommand> table)
        {
            var createTable = new CreateTableCommand(name, description);

            createTable.WithType(BoUTBTableType.bott_MasterDataLines);
            table(createTable);
            Run(createTable);
            return(this);
        }
        public SchemaBuilder CreateDocument(string name, string description, Action <CreateTableCommand> table)
        {
            var createTable = new CreateTableCommand(name, description);

            createTable.WithType(BoUTBTableType.bott_Document);
            table(createTable);
            Run(createTable);
            return(this);
        }
        public SchemaBuilder CreateTable(string name, string description, Action <CreateTableCommand> table = null)
        {
            var createTable = new CreateTableCommand(name, description);

            if (table != null)
            {
                table(createTable);
            }
            Run(createTable);
            return(this);
        }
 protected void Run(CreateTableCommand command)
 {
     _interpreter.Visit(command);
 }