protected CmsFile(Guid fileTypeID) { this.fileTypeID = fileTypeID; this.state = CmsState.Unsaved; this.version = 1; this.id = Guid.NewGuid(); this.fileID = id; dateCreated = DateTime.Now; dateModified = dateCreated; this.revisionSourceID = SqlGuid.Null; }
public void Unpublish() { if (this.State == CmsState.Unsaved) { throw new ApplicationException("Can not unpublish Unsaved file."); } else { this.state = CmsState.Unpublished; this.dateModified = DateTime.Now; this.Update(); LogAuditEvent(this, "Unpublished", "Unpublished"); if (!this.revisionSourceID.IsNull) { CmsFile revisionSource = CmsFile.FindByID(this.revisionSourceID.Value); if (revisionSource != null) { revisionSource.Publish(); } } } }
public void Restore() { //TODO: reconnect revision history? this.state = CmsState.Unpublished; this.dateModified = DateTime.Now; this.Update(); LogAuditEvent(this, "Restored", "Restored"); }
public void Publish() { if (this.State == CmsState.Unsaved) { throw new ApplicationException("Can not publish Unsaved file."); } else { this.state = CmsState.Published; this.dateModified = DateTime.Now; if (this.publishStart.IsNull) { this.publishStart = DateTime.Now; } UpdatePublishingSchedule(); this.Update(); LogAuditEvent(this, "Published", "Published"); } }
public virtual void InsertVersion() { //TODO: sweep archive old versions? //this.Update(); //Create new revision this.revisionSourceID = this.ID; this.id = Guid.NewGuid(); this.version += 1; this.state = CmsState.Unpublished; this.dateCreated = DateTime.Now; this.dateModified = DateTime.Now; DataStore ds = DataStoreServices.GetDataStore("Xenosynth"); ds.Insert(this); LogEntry.LogEvent(LogEntry.LogEventType.Audit, LogEntry.LogSource.File, this.FileID, "Versioned", string.Format("Versioned {0} '{1}' to {2}.", this.FileType.Name, this.FileName, this.Version)); //copy attributes IList attrs = CmsFileAttribute.FindByFileID(this.revisionSourceID.Value); foreach (CmsFileAttribute a in attrs) { a.CopyTo(id); } }
public virtual void Insert() { DataStore ds = DataStoreServices.GetDataStore("Xenosynth"); ds.SetContext(this); this.RefreshFullPath(); this.state = CmsState.Unpublished; this.dateModified = DateTime.Now; MembershipUser user = Membership.GetUser(); this.ownerID = (Guid)user.ProviderUserKey; ds.Insert(this); LogAuditEvent(this, "Created", "Created"); }
public virtual void Delete() { this.state = CmsState.Deleted; this.dateModified = DateTime.Now; this.Update(); LogAuditEvent(this, "Deleted", "Deleted"); }
public void Archive() { if (this.state == CmsState.Published) { this.publishEnd = DateTime.Now; } this.state = CmsState.Archived; this.dateModified = DateTime.Now; this.Update(); LogAuditEvent(this, "Archived", "Archived"); }