예제 #1
0
        internal override void CommandOperation()
        {
            if (AttributeTypeGuid == Guid.Empty)
            {
                AttributeTypeGuid = Guid.NewGuid();
            }

            AttributeType  a  = new AttributeType(Project, AttributeTypeGuid);
            ProjectVersion pv = Project.TranslateComponent <ProjectVersion>(ProjectVersionGuid);

            a.SetProjectVersion(pv);
            a.BaseType      = BaseTypeGuid != Guid.Empty ? Project.TranslateComponent <AttributeType>(BaseTypeGuid) : null;
            a.Name          = Name;
            a.IsSealed      = IsSealed;
            a.XSDDefinition = XSDDefinition;
            if (PSMSchemaGuid != Guid.Empty)
            {
                PSMSchema psmSchema = Project.TranslateComponent <PSMSchema>(PSMSchemaGuid);
                a.Schema = psmSchema;
                psmSchema.PSMSchemaDefinedTypes.Add(a);
            }
            else
            {
                pv.PIMAttributeTypes.Add(a);
            }

            Report = new CommandReport("'{0}' created. ");
        }
예제 #2
0
        internal override CommandBase.OperationResult UndoOperation()
        {
            AttributeType  t = new AttributeType(Project, AttributeTypeGuid);
            ProjectVersion projectVersion = Controller.Project.TranslateComponent <ProjectVersion>(oldProjectVersionGuid);

            t.SetProjectVersion(projectVersion);
            t.XSDDefinition = oldXSD;
            t.BaseType      = Project.TranslateComponent <AttributeType>(oldBaseType);
            t.Name          = oldName;
            t.IsSealed      = oldIsSealed;
            if (oldSchema != Guid.Empty)
            {
                PSMSchema psmSchema = Project.TranslateComponent <PSMSchema>(OwnerPSMSchemaGuid);
                t.Schema = psmSchema;
                psmSchema.PSMSchemaDefinedTypes.Add(t);
            }
            else
            {
                projectVersion.PIMAttributeTypes.Add(t);
            }
            return(OperationResult.OK);
        }