/// <summary> /// Creates the folder. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <returns></returns> public static CalendarFolder CreateFolder(CalendarFolder parent, string name) { if (parent == null) { throw new ArgumentNullException("parent"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } using (TransactionScope tran = DataContext.Current.BeginTransaction()) { // Create Detached Folder CalendarFolder newRoot = new CalendarFolder(); newRoot.Title = name; newRoot.ProjectId = parent.ProjectId; newRoot.Owner = parent.Owner; newRoot.Save(); // Append to TreeNode node = parent.GetTreeService().AppendChild(newRoot); parent.Save(); tran.Commit(); return(newRoot); } }
/// <summary> /// Creates the root. /// </summary> /// <param name="title">The title.</param> /// <param name="projectId">The project id.</param> /// <param name="ownerId">The owner id.</param> /// <returns></returns> private static CalendarFolder CreateRootNode(string title, int?projectId, int?ownerId) { if (title == null) { throw new ArgumentNullException("title"); } using (TransactionScope tran = DataContext.Current.BeginTransaction()) { // Step 1. Create List Folder CalendarFolder newRoot = new CalendarFolder(); newRoot.Title = title; newRoot.ProjectId = projectId; newRoot.Owner = ownerId; newRoot.Save(); // Step 2. Assign Root TreeNode retVal = TreeManager.AppendRootNode(Calendar.GetAssignedMetaClass(), newRoot); tran.Commit(); return(newRoot); } }
/// <summary> /// Creates the root. /// </summary> /// <param name="title">The title.</param> /// <param name="projectId">The project id.</param> /// <param name="ownerId">The owner id.</param> /// <returns></returns> private static CalendarFolder CreateRootNode(string title, int? projectId, int? ownerId) { if (title == null) throw new ArgumentNullException("title"); using (TransactionScope tran = DataContext.Current.BeginTransaction()) { // Step 1. Create List Folder CalendarFolder newRoot = new CalendarFolder(); newRoot.Title = title; newRoot.ProjectId = projectId; newRoot.Owner = ownerId; newRoot.Save(); // Step 2. Assign Root TreeNode retVal = TreeManager.AppendRootNode(Calendar.GetAssignedMetaClass(), newRoot); tran.Commit(); return newRoot; } }
/// <summary> /// Creates the folder. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <returns></returns> public static CalendarFolder CreateFolder(CalendarFolder parent, string name) { if (parent == null) throw new ArgumentNullException("parent"); if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); using (TransactionScope tran = DataContext.Current.BeginTransaction()) { // Create Detached Folder CalendarFolder newRoot = new CalendarFolder(); newRoot.Title = name; newRoot.ProjectId = parent.ProjectId; newRoot.Owner = parent.Owner; newRoot.Save(); // Append to TreeNode node = parent.GetTreeService().AppendChild(newRoot); parent.Save(); tran.Commit(); return newRoot; } }