private void Validate(XObjectType assetType) { if (string.IsNullOrEmpty(assetType.Name)) { throw new LogicalException("Name must be defined", "Name"); } //if (string.IsNullOrEmpty(assetType.Pluralization)) { throw new LogicalException("Pluralization must be defined.", "Pluralization"); } if ((assetType.ParentId.HasValue) && (assetType.ParentId.Value.CompareTo(assetType.Id) == 0)) { throw new LogicalException("ParentId cannot be itself."); } if (assetType.CreatedBy == Guid.Empty) { throw new LogicalException("CreatedBy must be defined", "CreatedBy"); } //if (!XUserManager.Instance.ValidId(assetType.CreatedBy)) //{ // throw new LogicalException("Invalid user id", "CreatedBy"); //} //if ((assetType.Id.CompareTo(Constants.AssetTypeIds.User) == 0) && (assetType.Deleted.HasValue || assetType.DeletedBy.HasValue)) //{ // throw new LogicalException("Cannot delete AssetType=User"); //} }
protected AuthoritySet Verification(UserType userType , XObjectType targetType = XObjectType.None, int targetId = 0) { if (Command.CurrentUser == null) { throw new Exception("Need Login."); } else if ((int)userType > (int)Command.CurrentUser.UserType) { throw new Exception("No Authority User Type."); } else if (Command.CurrentUser.UserType != UserType.ItAdministrator && targetType != 0 && targetId != 0) { XObject target = new XObject((int)targetType, targetId); return(Command.AuthorityManager .GetAuthorityInfo(Command.CurrentUser, target)); } else { return(new AuthoritySet { AuthorityType = AuthorityType.None, AuthorityValue = AuthorityValue.NotSet }); } }
public XObjectContentRecord(XObjectType type, StreamToken stream, TransformationMatrix appliedTransformation, RenderingIntent defaultRenderingIntent) { Type = type; Stream = stream ?? throw new ArgumentNullException(nameof(stream)); AppliedTransformation = appliedTransformation; DefaultRenderingIntent = defaultRenderingIntent; }
public bool Save(XObjectType objectType, Guid userId) { this.Validate(objectType); return(this.bizLayer.Save(objectType, userId)); // && (this.CreateGeneratedObjects(assetType))); }
public IXObjectType Get(Guid id) { XObjectType assetType = null; using (SqlDataReader rdr = base.OpenDataReader(StoredProcs.AssetType_Get, new List <SqlParameter>() { new SqlParameter("@Id", id) })) { if ((rdr == null) || (!rdr.HasRows)) { return(null); } assetType = new XObjectType(); assetType.Id = id; rdr.Read(); int name = rdr.GetOrdinal("Name"); int parentId = rdr.GetOrdinal("ParentId"); int allowAssets = rdr.GetOrdinal("AllowAssets"); int isSystem = rdr.GetOrdinal("IsSystem"); int plural = rdr.GetOrdinal("Pluralization"); int defLabel = rdr.GetOrdinal("DefinitionLabel"); int defLabelP = rdr.GetOrdinal("DefinitionLabelPlural"); int insLabel = rdr.GetOrdinal("InstanceLabel"); int insLabelP = rdr.GetOrdinal("InstanceLabelPlural"); int created = rdr.GetOrdinal("Created"); int createdBy = rdr.GetOrdinal("CreatedBy"); int lastModified = rdr.GetOrdinal("LastModified"); int lastModifiedBy = rdr.GetOrdinal("LastModifiedBy"); int deleted = rdr.GetOrdinal("Deleted"); int deletedBy = rdr.GetOrdinal("DeletedBy"); assetType.Name = rdr.GetString(name); if (!rdr.IsDBNull(parentId)) { assetType.ParentId = rdr.GetGuid(parentId); } if (!rdr.IsDBNull(allowAssets)) { assetType.AllowAssets = (bool)rdr.GetValue(allowAssets); } if (!rdr.IsDBNull(isSystem)) { assetType.IsSystem = (bool)rdr.GetValue(isSystem); } if (!rdr.IsDBNull(plural)) { assetType.Plural = rdr.GetString(plural); } if (!rdr.IsDBNull(defLabel)) { assetType.DefinitionLabel = rdr.GetString(defLabel); } if (!rdr.IsDBNull(defLabelP)) { assetType.DefinitionLabel = rdr.GetString(defLabelP); } if (!rdr.IsDBNull(insLabel)) { assetType.InstanceLabel = rdr.GetString(insLabel); } if (!rdr.IsDBNull(insLabelP)) { assetType.InstanceLabel = rdr.GetString(insLabelP); } assetType.Created = rdr.GetDateTime(created); assetType.CreatedBy = rdr.GetGuid(createdBy); if (!rdr.IsDBNull(lastModified)) { assetType.LastModified = rdr.GetDateTime(lastModified); } if (!rdr.IsDBNull(lastModifiedBy)) { assetType.LastModifiedBy = rdr.GetGuid(lastModifiedBy); } if (!rdr.IsDBNull(deleted)) { assetType.Deleted = rdr.GetDateTime(deleted); } if (!rdr.IsDBNull(deletedBy)) { assetType.DeletedBy = rdr.GetGuid(deletedBy); } //foreach (var relation in new AssetTypePropertyRelationDal().GetByAssetTypeId(id)) { assetType.Properties.Add(relation); } //assetType.Properties.IsDirty = false; //assetType.Properties.IsNew = false; assetType.IsNew = false; assetType.IsDirty = false; } return(assetType); }
public static extern bool IsHXCGUI(IntPtr hXCGUI, XObjectType nType);
public static extern void AddType(IntPtr hXCGUI, XObjectType nType);
public static extern IntPtr TemplateLoad(XObjectType nType, [MarshalAs(UnmanagedType.LPWStr)] string pFileName);