Ejemplo n.º 1
0
        public SchemaBuilder AlterObject(string name, Action <AlterObjectCommand> userObject = null)
        {
            var userObjectCommand = new AlterObjectCommand(name);

            if (userObject != null)
            {
                userObject(userObjectCommand);
            }
            Run(userObjectCommand);
            return(this);
        }
Ejemplo n.º 2
0
        public void Visit(AlterObjectCommand command)
        {
            var objectCreator = _app.BusinessObjects.GetBusinessObject <UserObjectsMD>(BoObjectTypes.oUserObjectsMD);

            try
            {
                if (!objectCreator.GetByKey(command.Name))
                {
                    throw new B1CoreException("Object not found.");
                }

                foreach (var name in command.ChildTables)
                {
                    objectCreator.ChildTables.TableName = name;
                    objectCreator.ChildTables.Add();
                }

                foreach (var field in command.FindFields)
                {
                    objectCreator.FindColumns.ColumnAlias = field.Key;
                    if (!string.IsNullOrEmpty(field.Value))
                    {
                        objectCreator.FindColumns.ColumnDescription = field.Value;
                    }
                    objectCreator.FindColumns.Add();
                }

                var created = objectCreator.Update();
                if (created != 0)
                {
                    string error = _app.BusinessObjects.GetLastErrorDescription();
                    throw new B1CoreException(string.Format("Error: {0} - alterar objeto: {1}", error, command.Name));
                }
                _app.SetStatusBarSucess(string.Format("Objeto de usuário {0} alterado com sucesso.", command.Name));
            }
            finally
            {
                _app.BusinessObjects.ReleaseObject(objectCreator);
            }
        }
Ejemplo n.º 3
0
 protected void Run(AlterObjectCommand command)
 {
     _interpreter.Visit(command);
 }