/// <summary> /// ルートグループ以外の全グループを取得します。 /// </summary> /// <returns>取得結果</returns> public List <TaskGroupInfo> GetGroupListExcludeRoot() { return(ResourceManager.Instance.taskInfoRoot.TaskGroupList .Where(x => !x.Key.Equals(TaskGroupInfo.GetRootGroup().Key)) .Select(x => x.Value) .ToList()); }
/// <summary> /// 初期化処理 /// </summary> /// <param name="group">編集対象のグループ情報</param> /// <param name="isAddOperation">追加画面かどうか</param> /// <param name="parent">親グループ</param> public void Initialize(TaskGroupInfo group, bool isAddOperation, TaskGroupInfo parent) { this.isAdd = isAddOperation; foreach (var item in ResourceManager.Instance.GetGroupList()) { if (item.ParentGroup == null || item.ParentGroup.Equals(TaskGroupInfo.GetRootGroup().Key)) { // ルートグループのみ対象 this.CmbParentGroup.Items.Add(item); } } // this.CmbParentGroup.Enabled = false; // this.CmbParentGroup.SelectedItem = TaskGroupInfo.GetRootGroup(); if (group != null) { this.target = group; // 自分を削除 if (this.CmbParentGroup.Items.Contains(group)) { this.CmbParentGroup.Items.Remove(group); } if (group.ParentGroup != null) { this.CmbParentGroup.SelectedItem = group.ParentGroup; } this.TxtGroupName.Text = group.Name; } }
/// <summary> /// 管理内のグループおよびタスクに対して指定の処理を実行します。 /// </summary> /// <param name="rootGroup">探索のルートグループ</param> /// <param name="groupAction">グループに対して実行する処理</param> /// <param name="taskAction">タスクに対して実行する処理</param> public void ExecInnerGroupAndTasks(TaskGroupInfo rootGroup, Action <TaskGroupInfo> groupAction, Action <TaskItem> taskAction) { if (rootGroup == null) { return; } foreach (var taskItem in rootGroup.ChildTaskItems) { if (taskAction != null) { taskAction(taskItem); } } foreach (var childGroup in rootGroup.ChildGroups) { var group = instance.taskInfoRoot.TaskGroupList[childGroup]; this.ExecInnerGroupAndTasks(group, groupAction, taskAction); if (groupAction != null) { groupAction(group); } } }
/// <summary> /// タスクグループ一覧の選択変更時イベント /// </summary> /// <param name="sender">イベント送信オブジェクト</param> /// <param name="e">イベント引数</param> private void LsvGroupOnSelectedIndexChanged(object sender, EventArgs e) { if (this.LsvGroup.SelectedItems.Count > 0) { var selectedItemIndex = this.LsvGroup.SelectedItems[0].Index; var selected = this.LsvGroup.SelectedItems[0].Tag as KeyInfo; if (selected != null) { if (selected.Equals(TaskGroupInfo.GetRootGroup().Key)) { this.ShowAllTaskListInDgvAllTasks(); } else { var group = ResourceManager.Instance.GetGroupInfo(selected); this.DgvAllTasks.RefleshTaskItems(group.ChildTaskItems.ToList(), group); this.LblDisplayGroup.Text = string.Format("[{0}]", group.Name); } this.isSuspentGroupListView = true; this.LsvGroup.Items[selectedItemIndex].Focused = true; this.LsvGroup.Items[selectedItemIndex].Selected = true; this.isSuspentGroupListView = false; } } }
/// <summary> /// Creates new task group and prepares callback result. /// </summary> /// <param name="nameOfCreatedstagingTaskGroup">Name of staging task group</param> private TaskGroupInfo CreateNewTaskGroup(string nameOfCreatedstagingTaskGroup) { TaskGroupInfo taskGroup = TaskGroupInfoProvider.GetTaskGroupInfo(nameOfCreatedstagingTaskGroup); if (taskGroup != null) { // If task group already exists, return that task group return(taskGroup); } if (ValidationHelper.IsCodeName(nameOfCreatedstagingTaskGroup)) { taskGroup = new TaskGroupInfo { TaskGroupGuid = Guid.NewGuid(), TaskGroupCodeName = nameOfCreatedstagingTaskGroup.Truncate(TaskGroupInfo.TYPEINFO.MaxCodeNameLength), }; TaskGroupInfoProvider.SetTaskGroupInfo(taskGroup); callbackResult.Add("stagingTaskGroupCreated", true); callbackResult.Add("stagingTaskGroupDisplayName", HTMLHelper.HTMLEncode(taskGroup.TaskGroupCodeName)); } else { ShowMessageInCallback(GetString("staging.IsNotValidTaskGroupName")); } return(taskGroup); }
/// <summary> /// Custom Staging Task generation /// </summary> /// <param name="RelationshipSiteObj"></param> /// <param name="TaskType"></param> private void RelationshipNameSite_CreateStagingTask(RelationshipNameSiteInfo RelationshipSiteObj, TaskTypeEnum TaskType) { List <ServerInfo> ActiveServers = ServerInfo.Provider.Get().WhereEquals("ServerSiteID", SiteContext.CurrentSiteID).WhereEquals("ServerEnabled", true).ToList(); RelationshipNameInfo RelationshipObj = RelationshipNameInfo.Provider.Get(RelationshipSiteObj.RelationshipNameID); // If relationship obj is already gone, then the Site deletion thing is already handled with the deletion of the relationship name. if (RelationshipObj == null) { return; } if (IsCustomAdhocRelationshipName(RelationshipObj) && ActiveServers.Count > 0) { string Data = "<NewDataSet>" + RelationshipObj.ToXML("CMS_RelationshipName", false) + "</NewDataSet>"; string TaskTitle = ""; string TaskTitleEnd = ""; switch (TaskType) { case TaskTypeEnum.AddToSite: TaskTitle = "Add"; TaskTitleEnd = "to"; break; case TaskTypeEnum.RemoveFromSite: TaskTitle = "Remove"; TaskTitleEnd = "from"; break; } StagingTaskInfo SiteTask = new CMS.Synchronization.StagingTaskInfo() { TaskTitle = string.Format("{0} Relationship name '{1}' {2} site", TaskTitle, RelationshipObj.RelationshipDisplayName, TaskTitleEnd), TaskType = TaskType, TaskObjectType = RelationshipNameInfo.OBJECT_TYPE, TaskObjectID = RelationshipObj.RelationshipNameId, TaskData = Data, TaskTime = DateTime.Now, TaskSiteID = SiteContext.CurrentSiteID }; StagingTaskInfo.Provider.Set(SiteTask); foreach (ServerInfo ServerObj in ActiveServers) { // Create synchronization SynchronizationInfo SyncSiteInfo = new SynchronizationInfo() { SynchronizationTaskID = SiteTask.TaskID, SynchronizationServerID = ServerObj.ServerID }; SynchronizationInfo.Provider.Set(SyncSiteInfo); } TaskGroupInfo TaskGroup = TaskGroupInfoProvider.GetUserTaskGroupInfo(MembershipContext.AuthenticatedUser.UserID); if (TaskGroup != null) { TaskGroupTaskInfo.Provider.Add(TaskGroup.TaskGroupID, SiteTask.TaskID); } } }
/// <summary> /// Returns url for currently used staging task group. /// </summary> /// <param name="CurrentStagingTaskGroup">Current task group</param> private static string GetUrlTostagingTaskGroup(TaskGroupInfo CurrentStagingTaskGroup) { return(UrlResolver.ResolveUrl(Service.Resolve <IUILinkProvider>().GetSingleObjectLink(StagingTaskInfo.TYPEINFO.ModuleName, STAGINGTASKGROUP_EDIT_ELEMENT, new ObjectDetailLinkParameters { ObjectIdentifier = CurrentStagingTaskGroup.TaskGroupID, ParentTabName = STAGINGTASKGROUP_PARENT_TABS, AllowNavigationToListing = true, TabName = "TaskGroup" }))); }
/// <summary> /// 全タスクの情報を取得します。 /// </summary> /// <returns>取得けっk</returns> public List <TaskItem> GetAllTaskItems() { var list = new List <TaskItem>(); ResourceManager.Instance.ExecInnerGroupAndTasks( TaskGroupInfo.GetRootGroup(), null, (task) => { list.Add(task); }); return(list); }
/// <summary> /// /タスク一覧の内容を指定のデータでリフレッシュします。 /// </summary> /// <param name="taskItems">表示対象のタスク</param> /// <param name="showingTaskGroup">表示対象のグループ</param> public void RefleshTaskItems(List <TaskItem> taskItems, TaskGroupInfo showingTaskGroup) { this.ClearAllTaskItems(); this.ShowingGroup = showingTaskGroup; foreach (var taskItem in taskItems) { this.AddRow(taskItem); } this.UpdateCellStatus(); }
/// <summary> /// Creates the Staging Task manually /// </summary> /// <param name="RelationshipObj"></param> /// <param name="TaskType"></param> private void RelationshipName_CreateStagingTask(RelationshipNameInfo RelationshipObj, TaskTypeEnum TaskType) { List <ServerInfo> ActiveServers = ServerInfo.Provider.Get().WhereEquals("ServerSiteID", SiteContext.CurrentSiteID).WhereEquals("ServerEnabled", true).ToList(); if (IsCustomAdhocRelationshipName(RelationshipObj) && ActiveServers.Count > 0) { string Data = "<NewDataSet>" + RelationshipObj.ToXML("CMS_RelationshipName", false) + "</NewDataSet>"; string TaskTitle = ""; switch (TaskType) { case TaskTypeEnum.CreateObject: TaskTitle = "Create"; break; case TaskTypeEnum.UpdateObject: TaskTitle = "Update"; break; case TaskTypeEnum.DeleteObject: TaskTitle = "Delete"; break; } StagingTaskInfo Task = new StagingTaskInfo() { TaskTitle = string.Format("{0} Relationship name '{1}'", TaskTitle, RelationshipObj.RelationshipDisplayName), TaskType = TaskType, TaskObjectType = RelationshipNameInfo.OBJECT_TYPE, TaskObjectID = RelationshipObj.RelationshipNameId, TaskData = Data, TaskTime = DateTime.Now }; StagingTaskInfo.Provider.Set(Task); foreach (ServerInfo ServerObj in ActiveServers) { // Create synchronization SynchronizationInfo SyncInfo = new SynchronizationInfo() { SynchronizationTaskID = Task.TaskID, SynchronizationServerID = ServerObj.ServerID }; SynchronizationInfo.Provider.Set(SyncInfo); } TaskGroupInfo TaskGroup = TaskGroupInfoProvider.GetUserTaskGroupInfo(MembershipContext.AuthenticatedUser.UserID); if (TaskGroup != null) { TaskGroupTaskInfo.Provider.Add(TaskGroup.TaskGroupID, Task.TaskID); } } }
internal Node CreateTaskGroup(int parentID, string name) { TaskGroupInfo info = new TaskGroupInfo(); info.Name = name; info.ParentID = parentID; ReAuthenticateIfRequired(); Node node = fCollaborationService.CreateTaskGroup(ref fCollaborationAuthentication, info); UpdateAuthenticationTokens(fCollaborationAuthentication.AuthenticationToken); return(node); }
/// <summary> /// Loads the page. /// </summary> /// <param name="e">Event arguments</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); CheckPermissions(); CurrentMaster.DisplaySiteSelectorPanel = true; // Check enabled servers var isCallback = RequestHelper.IsCallback(); if (!isCallback && !ServerInfoProvider.IsEnabledServer(SiteContext.CurrentSiteID)) { ShowInformation(GetString("ObjectStaging.NoEnabledServer")); HideUI(); return; } InitServerSelector(); mCurrentTaskGroup = TaskGroupInfoProvider.GetTaskGroupInfo(UIContext.ObjectID); // Register script for pendingCallbacks repair ScriptHelper.FixPendingCallbacks(Page); if (!isCallback) { CheckPermissions(); PrepareDisabledModuleInfo(); if (!ucDisabledModule.Check()) { HideUI(); return; } ScriptHelper.RegisterDialogScript(this); // Setup title if (!ControlsHelper.CausedPostBack(btnSyncSelected, btnSyncAll)) { plcContent.Visible = true; InitButtons(); InitUniGrid(); TaskGroupSelectorEnabled = false; pnlLog.Visible = false; } } }
/// <summary> /// Handles the click on edit link and redirects user to correct task group. /// </summary> /// <param name="callbackData">Data sent from browser in key-value pair format</param> private void PrepareLinkForRedirect(Dictionary <string, string> callbackData) { CurrentStagingTaskGroup = TaskGroupInfoProvider.GetTaskGroupInfo(GetRaisedCallbackTaskGroupID(callbackData)); callbackResult.Add("redirect", true); if (CurrentStagingTaskGroup != null) { callbackResult.Add("stagingTaskGroupUrl", GetUrlTostagingTaskGroup(CurrentStagingTaskGroup)); } else { // There is no such task group or (none) is selected so we will redirect to staging application callbackResult.Add("stagingTaskGroupUrl", UrlResolver.ResolveUrl(Service.Resolve <IUILinkProvider>().GetSingleObjectLink(StagingTaskInfo.TYPEINFO.ModuleName, STAGING_APPLICATION))); } }
/// <summary> /// 確定ボタン押下時イベント /// </summary> /// <param name="sender">イベント送信オブジェクト</param> /// <param name="e">イベント引数</param> private void BtnKakutei_Click(object sender, EventArgs e) { this.CmbParentGroup.BackColor = Color.White; this.TxtGroupName.BackColor = Color.White; var canUpdate = true; TaskGroupInfo parent; if (string.IsNullOrEmpty(this.CmbParentGroup.Text)) { // トップの親 parent = TaskGroupInfo.GetRootGroup(); } else { var selected = this.CmbParentGroup.SelectedItem as TaskGroupInfo; if (selected == null) { this.CmbParentGroup.BackColor = Color.Red; canUpdate = false; parent = null; } else { parent = selected; } } if (string.IsNullOrEmpty(this.TxtGroupName.Text)) { this.TxtGroupName.BackColor = Color.Red; canUpdate = false; } if (canUpdate) { if (this.isAdd) { ResourceManager.Instance.AddTaskGroup(this.TxtGroupName.Text, parent); } else { ResourceManager.Instance.EditTaskGroup(this.target, this.TxtGroupName.Text, parent); } this.CloseWindow(SubWindowResult.Submit); } }
/// <summary> /// グループ削除ボタン押下時イベント /// </summary> /// <param name="sender">イベント送信オブジェクト</param> /// <param name="e">イベント引数</param> private void BtnRemoveGroup_Click(object sender, EventArgs e) { if (this.LsvGroup.SelectedItems.Count > 0) { var selected = this.LsvGroup.SelectedItems[0].Tag as KeyInfo; if (selected != null) { var item = ResourceManager.Instance.GetGroupInfo(selected); if (!selected.Equals(TaskGroupInfo.GetRootGroup().Key) && !selected.Equals(TaskGroupInfo.GetDefaultGroup().Key)) { ResourceManager.Instance.RemoveTaskGroup(item); this.RefleshTaskGroupIchiran(); } } } }
/// <summary> /// 初期化処理 /// </summary> /// <param name="groupInfo">親グループ情報</param> /// <param name="taskItem">タスク情報</param> /// <returns>結果</returns> public bool Initialize(TaskGroupInfo groupInfo, TaskItem taskItem) { var list = ResourceManager.Instance.GetGroupListExcludeRoot().ToArray(); foreach (var item in list) { this.CmbGroup.Items.Add(item); } if (taskItem.Group == null) { if (groupInfo != null) { // 新規の場合は、表示中グループにする taskItem.Group = groupInfo.Key; } else { // 親の指定が無い場合は、未分類グループ taskItem.Group = TaskGroupInfo.GetDefaultGroup().Key; } } this.CmbGroup.SelectedItem = ResourceManager.Instance.GetGroupInfo(taskItem.Group); this.TxtTitle.Text = taskItem.Title; this.DtpLimit.Value = taskItem.DateTimeLimit; this.TxtMemo.Text = taskItem.Memo; this.CmbAttachFiles.DisplayMember = "DisplayName"; foreach (var info in taskItem.AttachFile) { this.CmbAttachFiles.Items.Add(info); } this.btnOpenDirAttachedFiles.Enabled = false; if (taskItem.AttachFile.Any()) { this.btnOpenDirAttachedFiles.Enabled = true; } this.target = taskItem; return(true); }
/// <summary> /// タスクグループ一覧を再描画します。 /// </summary> private void RefleshTaskGroupIchiran() { if (this.isSuspentGroupListView) { return; } this.LsvGroup.BeginUpdate(); this.LsvGroup.Items.Clear(); { // 全タスク表示用の項目 var lvItem = this.LsvGroup.Items.Add("全てのタスク"); var allTaskList = ResourceManager.Instance.GetAllTaskItems(); lvItem.SubItems.Add(string.Format("{0:D}件", allTaskList.Count)); lvItem.Tag = TaskGroupInfo.GetRootGroup().Key; } // グループ表示 var topTasks = ResourceManager.Instance.GetRootGroups(); foreach (var taskGroupInfo in topTasks) { var taskName = taskGroupInfo.Name; var taskNum = taskGroupInfo.ChildTaskItems.Count; var lvItem = this.LsvGroup.Items.Add(taskName); lvItem.SubItems.Add(string.Format("{0:D}件", taskNum)); lvItem.Tag = taskGroupInfo.Key; foreach (var childGroup in taskGroupInfo.ChildGroups) { var group = ResourceManager.Instance.GetGroupInfo(childGroup); var childTaskName = group.Name; var childTaskNum = group.ChildTaskItems.Count; var childLvItem = this.LsvGroup.Items.Add(" |-- " + childTaskName); childLvItem.SubItems.Add(string.Format("{0:D}件", childTaskNum)); childLvItem.Tag = childGroup; } } this.LsvGroup.EndUpdate(); }
/// <summary> /// グループリネームボタン押下時イベント /// </summary> /// <param name="sender">イベント送信オブジェクト</param> /// <param name="e">イベント引数</param> private async void BtnReNameGroup_Click(object sender, EventArgs e) { if (this.LsvGroup.SelectedItems.Count > 0) { var selected = this.LsvGroup.SelectedItems[0].Tag as KeyInfo; if (selected != null) { var item = ResourceManager.Instance.GetGroupInfo(selected); if (!selected.Equals(TaskGroupInfo.GetRootGroup().Key) && !selected.Equals(TaskGroupInfo.GetDefaultGroup().Key)) { var win = new TaskGroupEditForm(); win.Initialize(item, false, ResourceManager.Instance.GetGroupInfo(item.ParentGroup)); var ret = await win.ShowWindow(this); this.RefleshTaskGroupIchiran(); } } } }
/// <summary> /// ルートのグループ情報を取得します。 /// </summary> /// <returns>取得けっk</returns> public List <TaskGroupInfo> GetRootGroups() { var result = new List <TaskGroupInfo>(); foreach (var item in instance.taskInfoRoot.TaskGroupList) { var key = item.Key; var value = item.Value; if (value.ParentGroup != null) { if (value.ParentGroup.Equals(TaskGroupInfo.GetRootGroup().Key)) { result.Add(value); } } } return(result); }
/// <summary> /// グループ追加ボタン押下時イベント /// </summary> /// <param name="sender">イベント送信オブジェクト</param> /// <param name="e">イベント引数</param> private async void BtnAddGroup_Click(object sender, EventArgs e) { var parent = TaskGroupInfo.GetRootGroup(); if (this.LsvGroup.SelectedItems.Count > 0) { var selected = this.LsvGroup.SelectedItems[0].Tag as KeyInfo; if (selected != null) { var item = ResourceManager.Instance.GetGroupInfo(selected); parent = item; } } var win = new TaskGroupEditForm(); win.Initialize(null, true, parent); var ret = await win.ShowWindow(this); this.RefleshTaskGroupIchiran(); }
/// <summary> /// Callback from client. Callback result data are prepared to be sent back to the client. /// </summary> /// <param name="eventArgument">Event arguments in JSON, like which control raised callback, and another data</param> public void RaiseCallbackEvent(string eventArgument) { try { Dictionary <string, string> callbackData = GetCallbackData(eventArgument); // User has changed the task group if (GetRaisedCallbackControlID(callbackData).Equals(UniSelectorClientID, StringComparison.InvariantCultureIgnoreCase)) { // If given task group does not exists on the server anymore null is set, and return that selector is inconsistent CurrentStagingTaskGroup = TaskGroupInfoProvider.GetTaskGroupInfo(GetRaisedCallbackTaskGroupID(callbackData)); if ((CurrentStagingTaskGroup == null) && (GetRaisedCallbackTaskGroupID(callbackData) != 0)) { // Task group is selected that no longer exists on server ShowMessageInCallback(GetString("stagingTaskGroup.SelectorInconsistent")); } } // User clicked the edit link, we have to check if task group still exists else if (GetRaisedCallbackControlID(callbackData).Equals(lnkEditTaskGroup.ClientID, StringComparison.InvariantCultureIgnoreCase)) { PrepareLinkForRedirect(callbackData); return; } else { // User created new task group CurrentStagingTaskGroup = CreateNewTaskGroup(callbackData["Name"]); } // Return ID of staging task group to client, to change selector and menu text callbackResult.Add("stagingTaskGroupID", CurrentStagingTaskGroup == null ? UniSelector.US_NONE_RECORD : CurrentStagingTaskGroup.TaskGroupID); TaskGroupInfoProvider.SetTaskGroupForUser(CurrentStagingTaskGroup == null ? UniSelector.US_NONE_RECORD : CurrentStagingTaskGroup.TaskGroupID, CMSActionContext.CurrentUser.UserID); } catch (Exception ex) { ShowMessageInCallback(GetString("stagingTaskGroupMenu.ExceptionMesasge") + " " + ex.Message); EventLogProvider.LogException("StagingTaskGroupMenu", "TASKGROUP", ex); } }
/// <summary> /// 更新ボタン押下時処理 /// </summary> /// <param name="sender">イベント送信オブジェクト</param> /// <param name="e">イベント引数</param> private void BtnUpdate_Click(object sender, EventArgs e) { var canUpdate = true; this.TxtTitle.BackColor = Color.White; this.DtpLimit.BackColor = Color.White; this.CmbAttachFiles.BackColor = Color.White; var msgBuilder = new MessageBuilder(); if (string.IsNullOrEmpty(this.TxtTitle.Text)) { msgBuilder.Add(MessageKind.Error, "タイトルを入力してください"); this.TxtTitle.BackColor = Color.Red; canUpdate = false; } if (string.IsNullOrEmpty(this.DtpLimit.Text)) { msgBuilder.Add(MessageKind.Error, "期限を入力してください"); this.DtpLimit.BackColor = Color.Red; canUpdate = false; } if (!canUpdate) { var errMsg = msgBuilder.CreateMessage(); MessageBox.Show(errMsg); return; } if (!this.target.Group.Equals(this.CmbGroup.SelectedItem)) { // グループ管理の差し替え var prevParent = ResourceManager.Instance.GetGroupInfo(this.target.Group); if (prevParent != null) { if (prevParent.ChildTaskItems.Contains(this.target)) { prevParent.ChildTaskItems.Remove(this.target); } } if (string.IsNullOrEmpty(this.CmbGroup.Text) || this.CmbGroup.SelectedItem == null) { this.target.Group = TaskGroupInfo.GetDefaultGroup().Key; } else { this.target.Group = ((TaskGroupInfo)this.CmbGroup.SelectedItem).Key; } var parent = ResourceManager.Instance.GetGroupInfo(this.target.Group); parent.ChildTaskItems.Add(this.target); } this.target.Title = this.TxtTitle.Text; this.target.DateTimeLimit = this.DtpLimit.Value; this.target.Memo = this.TxtMemo.Text; // 添付ファイルの取得 { // 削除ファイルの処理 var destattachList = new List <AttachedFileInfo>(); destattachList.AddRange(this.target.AttachFile); foreach (var info in this.attachFileDeleteList) { var path = info.FilePath; if (File.Exists(path)) { File.Delete(path); } if (destattachList.Contains(info)) { destattachList.Remove(info); } } // 追加ファイルの処理 foreach (var info in this.attachFileAddList) { destattachList.Add(info); File.Copy(info.OrgFilePath, info.FilePath, true); } this.target.AttachFile.Clear(); this.target.AttachFile.AddRange(destattachList); } this.CloseWindow(SubWindowResult.Submit); }
/// <summary> /// 初期化処理 /// </summary> /// <returns>実行結果</returns> public bool Initialize() { this.taskInfoRoot = new TaskInfoRoot(); KeyInfo.Initialize(); var path = Utils.GetFullPath(TaskListSavePath); if (File.Exists(path)) { var text = File.ReadAllText(path); var jsonObj = JsonConvert.DeserializeObject <TaskInfoRoot>(text); instance.taskInfoRoot = jsonObj; var rootGroupKey = TaskGroupInfo.GetRootGroup().Key; if (instance.taskInfoRoot.TaskGroupListJsonObj.Any(x => x.Key.Equals(rootGroupKey))) { var item = instance.taskInfoRoot.TaskGroupListJsonObj.First(x => x.Key.Equals(rootGroupKey)); TaskGroupInfo.OverriteRootGroup(item); } var defaultGroupKey = TaskGroupInfo.GetDefaultGroup().Key; if (instance.taskInfoRoot.TaskGroupListJsonObj.Any(x => x.Key.Equals(defaultGroupKey))) { var item = instance.taskInfoRoot.TaskGroupListJsonObj.First(x => x.Key.Equals(defaultGroupKey)); TaskGroupInfo.OverriteDefaultGroup(item); } // 全グループに対してキーの再生成 foreach (var taskGroupInfo in instance.taskInfoRoot.TaskGroupListJsonObj) { if (!KeyInfo.IsCreatedKeyGroup(taskGroupInfo.Key)) { var keyGroup = KeyInfo.CreateKeyInfoGroup(); taskGroupInfo.ChildGroups.Clear(); var filetered = instance.taskInfoRoot.TaskGroupListJsonObj.Where(x => x.ParentGroup != null && x.ParentGroup.Equals(taskGroupInfo.Key)).ToList(); if (filetered.Any()) { foreach (var groupInfo in filetered) { if (!KeyInfo.IsCreatedKeyGroup(groupInfo.Key)) { var keyGroupChildGroup = KeyInfo.CreateKeyInfoGroup(); groupInfo.Key = keyGroupChildGroup; } groupInfo.ParentGroup = keyGroup; taskGroupInfo.ChildGroups.Add(groupInfo.Key); } } taskGroupInfo.Key = keyGroup; } foreach (var childTaskItem in taskGroupInfo.ChildTaskItems) { if (!KeyInfo.IsCreatedKeyTask(taskGroupInfo.Key, childTaskItem.Key)) { var keyGroup = KeyInfo.CreateKeyInfoTask(taskGroupInfo.Key); childTaskItem.Key = keyGroup; } childTaskItem.Group = taskGroupInfo.Key; } if (!instance.taskInfoRoot.TaskGroupList.ContainsKey(taskGroupInfo.Key)) { instance.taskInfoRoot.TaskGroupList.Add(taskGroupInfo.Key, taskGroupInfo); } } } else { instance.taskInfoRoot.AddTaskGroup(TaskGroupInfo.GetRootGroup(), null); instance.taskInfoRoot.AddTaskGroup(TaskGroupInfo.GetDefaultGroup(), TaskGroupInfo.GetRootGroup()); } return(true); }
/// <summary> /// グループ情報を削除します。 /// </summary> /// <param name="taskGroupInfo">削除対象のグループ情報</param> public void RemoveTaskGroup(TaskGroupInfo taskGroupInfo) { instance.taskInfoRoot.RemoveTaskGroup(taskGroupInfo); }
/// <summary> /// グループ情報を編集します。 /// </summary> /// <param name="original">元のグループ情報</param> /// <param name="editName">編集先名称</param> /// <param name="editParent">編集先親グループ</param> /// <returns>編集結果</returns> public TaskGroupInfo EditTaskGroup(TaskGroupInfo original, string editName = null, TaskGroupInfo editParent = null) { return(instance.taskInfoRoot.EditTaskGroup(original, editName, editParent)); }
/// <summary> /// Creates new task group and prepares callback result. /// </summary> /// <param name="nameOfCreatedstagingTaskGroup">Name of staging task group</param> private TaskGroupInfo CreateNewTaskGroup(string nameOfCreatedstagingTaskGroup) { TaskGroupInfo taskGroup = TaskGroupInfoProvider.GetTaskGroupInfo(nameOfCreatedstagingTaskGroup); if (taskGroup != null) { // If task group already exists, return that task group return taskGroup; } if (ValidationHelper.IsCodeName(nameOfCreatedstagingTaskGroup)) { taskGroup = new TaskGroupInfo { TaskGroupGuid = Guid.NewGuid(), TaskGroupCodeName = nameOfCreatedstagingTaskGroup.Truncate(TaskGroupInfo.TYPEINFO.MaxCodeNameLength), }; TaskGroupInfoProvider.SetTaskGroupInfo(taskGroup); callbackResult.Add("stagingTaskGroupCreated", true); callbackResult.Add("stagingTaskGroupDisplayName", HTMLHelper.HTMLEncode(taskGroup.TaskGroupCodeName)); } else { ShowMessageInCallback(GetString("staging.IsNotValidTaskGroupName")); } return taskGroup; }
/// <summary> /// グループを追加します。 /// </summary> /// <param name="name">グループ名称</param> /// <param name="parent">親グループ</param> /// <returns>追加結果</returns> public TaskGroupInfo AddTaskGroup(string name, TaskGroupInfo parent) { return(instance.taskInfoRoot.AddTaskGroup(name, parent)); }
/// <summary> /// Returns url for currently used staging task group. /// </summary> /// <param name="CurrentStagingTaskGroup">Current task group</param> private static string GetUrlTostagingTaskGroup(TaskGroupInfo CurrentStagingTaskGroup) { return URLHelper.ResolveUrl(Service<IUILinkProvider>.Entry().GetSingleObjectLink(StagingTaskInfo.TYPEINFO.ModuleName, STAGINGTASKGROUP_EDIT_ELEMENT, new ObjectDetailLinkParameters { ObjectIdentifier = CurrentStagingTaskGroup.TaskGroupID, ParentTabName = STAGINGTASKGROUP_PARENT_TABS, AllowNavigationToListing = true, TabName = "TaskGroup" })); }