/// <summary> /// Create the topic and the relative root message. /// </summary> /// <param name="category"></param> /// <param name="owner"></param> /// <param name="title"></param> /// <param name="body"></param> /// <param name="attachment">Use null if you don't have any attachment</param> /// <param name="topic">Returns the topic created</param> /// <param name="rootMessage">Returns the message created</param> public static void CreateTopic(Category category, string owner, string title, string body, Attachment.FileInfo attachment, out Topic topic, out Message rootMessage, string groups) { Provider.CreateTopic(category, owner, title, body, attachment, out topic, out rootMessage, groups); }
/// <summary> /// Create the topic and the relative root message. /// </summary> /// <param name="category"></param> /// <param name="owner"></param> /// <param name="title"></param> /// <param name="body"></param> /// <param name="attachment">Use null if you don't have any attachment</param> /// <param name="topic">Returns the topic created</param> /// <param name="rootMessage">Returns the message created</param> public override void CreateTopic(Category category, string owner, string title, string body, Attachment.FileInfo attachment, out Topic topic, out Message rootMessage, string groups) { //Check attachment if (attachment != null) { Attachment.FileHelper.CheckFile(attachment, category.AttachExtensions, category.AttachMaxSize); } using (TransactionScope transaction = new TransactionScope(mConfiguration)) { CategoryDataStore forumStore = new CategoryDataStore(transaction); forumStore.Attach(category); //Insert topic TopicDataStore topicStore = new TopicDataStore(transaction); topic = new Topic(category, owner, title); topic.Groups = groups; topicStore.Insert(topic); //Insert root message MessageDataStore messageStore = new MessageDataStore(transaction); rootMessage = new Message(topic, null, owner, title, body, attachment); messageStore.Insert(rootMessage); transaction.Commit(); } }
/// <summary> /// Create the topic and the relative root message. /// </summary> /// <param name="category"></param> /// <param name="owner"></param> /// <param name="title"></param> /// <param name="body"></param> /// <param name="attachment">Use null if you don't have any attachment</param> /// <param name="topic">Returns the topic created</param> /// <param name="rootMessage">Returns the message created</param> public static void CreateTopic(Category category, string owner, string title, string body, Attachment.FileInfo attachment, string groups) { Topic tp; Message msg; CreateTopic(category, owner, title, body, attachment, out tp, out msg, groups); }
/// <summary> /// /// </summary> /// <param name="pTopic"></param> /// <param name="pIdParentMessage">Null for the first message</param> /// <param name="pOwner"></param> /// <param name="pTitle"></param> /// <param name="pBody"></param> /// <param name="pAttachment"></param> public Message(Topic pTopic, string pIdParentMessage, string pOwner, string pTitle, string pBody, Attachment.FileInfo pAttachment) { Topic = pTopic; Owner = pOwner; Title = pTitle; Body = pBody; IdParentMessage = pIdParentMessage; Attachment = pAttachment; }
public override Item CreateItem(Category category, string owner, string title, string description, string url, string urlName, DateTime newsDate, bool acknowledge, bool approve, string groups, Attachment.FileInfo attachment, DateTime?expiry, ItemApprovalStatus approvalStatus) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ItemDataStore dataStore = new ItemDataStore(transaction); Item item = new Item(category, owner, title, description, url, urlName, newsDate, expiry, approvalStatus); item.Tag = acknowledge.ToString() + ":" + approve.ToString(); item.Groups = groups; item.Attachment = attachment; dataStore.Insert(item); transaction.Commit(); return(item); } }
public abstract Item CreateItem(Category category, string owner, string title, string description, string url, string urlName, DateTime newsDate, bool acknowledge, bool approve, string groups, Attachment.FileInfo attachment, DateTime?expiry, ItemApprovalStatus approvalStatus);
/// <summary> /// /// </summary> /// <param name="topic"></param> /// <param name="idParentMessage"></param> /// <param name="owner"></param> /// <param name="title"></param> /// <param name="body"></param> /// <param name="attachment">Use null if you don't have any attachment</param> /// <returns></returns> public abstract Message CreateMessage(Topic topic, string idParentMessage, string owner, string title, string body, Attachment.FileInfo attachment);
/// <summary> /// Create the topic and the relative root message. /// </summary> /// <param name="category"></param> /// <param name="owner"></param> /// <param name="title"></param> /// <param name="body"></param> /// <param name="attachment">Use null if you don't have any attachment</param> /// <param name="topic">Returns the topic created</param> /// <param name="rootMessage">Returns the message created</param> public abstract void CreateTopic(Category category, string owner, string title, string body, Attachment.FileInfo attachment, out Topic topic, out Message rootMessage, string groups);
/// <summary> /// /// </summary> /// <param name="topic"></param> /// <param name="idParentMessage"></param> /// <param name="owner"></param> /// <param name="title"></param> /// <param name="body"></param> /// <param name="attachment">Use null if you don't have any attachment</param> /// <returns></returns> public static Message CreateMessage(Topic topic, string idParentMessage, string owner, string title, string body, Attachment.FileInfo attachment) { return(Provider.CreateMessage(topic, idParentMessage, owner, title, body, attachment)); }
public override Message CreateMessage(Topic topic, string idParentMessage, string owner, string title, string body, Attachment.FileInfo attachment) { //Check attachment if (attachment != null) { Attachment.FileHelper.CheckFile(attachment, topic.Category.AttachExtensions, topic.Category.AttachMaxSize); } using (TransactionScope transaction = new TransactionScope(mConfiguration)) { TopicDataStore topicStore = new TopicDataStore(transaction); topicStore.Attach(topic); MessageDataStore messageStore = new MessageDataStore(transaction); Message parentMessage = messageStore.FindByKey(idParentMessage); if (parentMessage == null) { throw new MessageNotFoundException(idParentMessage); } Message newMessage = new Message(topic, idParentMessage, owner, title, body, attachment); messageStore.Insert(newMessage); transaction.Commit(); //Notify user for answer NotifyUserReply(parentMessage, newMessage); return(newMessage); } }
public static Item CreateItem(Category category, string owner, string title, string description, string url, string urlName, DateTime newsDate, bool acknowledge, bool approve, string groups, Attachment.FileInfo attachment, DateTime?expiry, ItemApprovalStatus approvalStatus) { return(Provider.CreateItem(category, owner, title, description, url, urlName, newsDate, acknowledge, approve, groups, attachment, expiry, approvalStatus)); }