internal T NewDocument <T>(IDocumentHolder holder) where T : Document, new() { var note = Container.NewTransientInstance <T>(); note.CreatingHolder = holder; return(note); }
private IQueryable <DocumentHolderLink> LinksForHolder(IDocumentHolder holder) { string holderType = this.PolymorphicNavigator.GetType(holder); int holderId = holder.Id; return(Container.Instances <DocumentHolderLink>().Where(x => x.AssociatedRoleObjectId == holderId && x.AssociatedRoleObjectType == holderType)); }
public HtmlDocumentViewFactory(IOutputWriter writer, IServiceLocator services) { _writer = writer; Type modelType = typeof(T).FindParameterTypeTo(typeof(IFubuPage <>)); _proxy = typeof(FubuPageProxy <,>).CloseAndBuildAs <IDocumentHolder <T> >(typeof(T), modelType); _proxy.ServiceLocator = services; }
public IDocument AddExternalDocument(IDocumentHolder holder, IExternalDocument content) { var doc = NewDocument <ExternalDocument>(holder); doc.Content = content; doc.Text = "External Doc"; Container.Persist(ref doc); return(doc); }
public IDocument AddFileAttachment(IDocumentHolder holder, FileAttachment file, [Optionally] string description) { var doc = NewDocument <DocumentWithFileAttachment>(holder); doc.Text = description; doc.AttContent = file.GetResourceAsByteArray(); doc.AttName = file.Name; doc.AttMime = file.MimeType; Container.Persist(ref doc); return(doc); }
public IQueryable <IDocument> FindDocuments(IDocumentHolder holder, [Optionally] DocumentType?type, [Optionally] DateTime?addedAfter, [Optionally] DateTime?addedBefore, [Optionally] IUser addedByUser, [Optionally] string textSearch) { var docs = DocumentsMatching(type, addedAfter, addedBefore, addedByUser, textSearch); var links = LinksForHolder(holder); return(JoinLinksAndDocs(links, docs).OrderByDescending(x => x.LastModified)); }
public IDocument AddNote(IDocumentHolder holder) { var notes = Container.Instances <Note>().Where(x => x.Status == NoteStatus.Active); var links = LinksForHolder(holder); var existing = JoinLinksAndDocs(links, notes).FirstOrDefault(); if (existing != null) { return(existing); } else { return(NewDocument <Note>(holder)); } }
public IEmail CreateEmail( IEmailAddressProvider recipient, string fromEmailAddress, string subject, [MultiLine(NumberOfLines = 5)] string body, [Optionally] IDocumentHolder associateAsDocumentWith) { var msg = new MailMessage(fromEmailAddress, recipient.DefaultEmailAddress().ToString(), subject, body); var email = EmailService.SendAndSaveEmail(msg); if (associateAsDocumentWith != null) { DocumentService.AddExternalDocument(associateAsDocumentWith, email); } return(email); }
private void Include(Collection<string> tempHolder, IDocumentHolder holder, string query) { XmlNodeList nodes = holder.ExecuteSelectNodes(query); foreach (XmlNode node in nodes) { tempHolder.Add(node.Value); } }
public MSBuildReader(string configurationFile) { configurationDir = configurationFile.Substring(0, configurationFile.LastIndexOf('/')); using (Stream stream = File.Open(configurationFile, FileMode.Open)) { project = new DocumentHolder(stream, msBuildPrefix, msBuildNamespace); } string overlayFile = string.Format("{0}.overlay", configurationFile); try { using (Stream stream = File.Open(overlayFile, FileMode.Open)) { overlay = new DocumentHolder(stream, sccBuildPrefix, sccBuildNamespace); } } catch (FileNotFoundException) { overlay = new NullDocumentHolder(); } }
public IDocument AddNewDocument(IDocumentHolder holder, DocumentType type) { throw new NotImplementedException(); }
public IQueryable <IDocument> RecentDocuments(IDocumentHolder holder) { var links = LinksForHolder(holder); return(JoinLinksAndDocs(links, AllDocs()).OrderByDescending(x => x.LastModified)); }
public void CopyTo(IDocumentHolder holder) { throw new NotImplementedException(); }
public void RemoveHolder(IDocumentHolder value) { PolymorphicNavigator.RemoveLink <DocumentHolderLink, IDocumentHolder, Document>(value, this); }
public void AddHolder(IDocumentHolder value) { PolymorphicNavigator.AddLink <DocumentHolderLink, IDocumentHolder, Document>(value, this); }