/// <summary> /// Initialize our fields with the data within this task /// </summary> /// <param name="TaskInfo"></param> public void Initialize(MOG_TaskInfo TaskInfo) { // Make sure we have a valid task if (TaskInfo != null) { // Save the original mOriginalTaskInfo = TaskInfo.Clone(); // Set our task member var mTaskInfo = TaskInfo; // Populate the priorities PopulatePriority(); // Populate the assigned to PopulateAssignTo(); // Set the name this.TaskName = mTaskInfo.GetName(); this.TaskPercentage = mTaskInfo.GetPercentComplete(); this.TaskPriority = mTaskInfo.GetPriority(); this.TaskAssignedTo = mTaskInfo.GetAssignedTo(); this.TaskComments = mTaskInfo.GetComment(); GetAssignedAssets(); // this.TaskAssignedAsset = mTaskInfo.GetAsset(); // Set the due date if (mTaskInfo.GetDueDate() != null) { MOG_Time time = new MOG_Time(mTaskInfo.GetDueDate()); TaskDueDateTimePicker.Value = time.ToDateTime(); } // Set our importance rating TaskImportanceTextBox.Text = mTaskInfo.GetImportanceRating().ToString(); } else { // Clear out our data this.TaskName = ""; this.TaskPriority = ""; this.TaskAssignedTo = ""; this.TaskPercentage = -1; this.TaskComments = ""; // // TaskPriorityComboBox.Enabled = false; // TaskUsersComboBox.Enabled = false; // TaskDueDateTimePicker.Enabled = false; } }
public bool GetTasksFromBox(string box, string section, Color textColor, System.Windows.Forms.ListView listViewToFill) { MOG_Ini contents = new MOG_Ini(); // Get a handle to the inbox\contents.info FileInfo file = new FileInfo(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\Contents.info")); // If the .info file exists, open it if (file.Exists) { // Load the file contents.Load(file.FullName); // Find the items in the INBOX section if (contents.SectionExist(section)) { for (int i = 0; i < contents.CountKeys(section); i++) { ListViewItem node = new ListViewItem(); String assetName = contents.GetKeyNameByIndex(section, i); // Set the due date MOG_Time t = new MOG_Time(); t.SetTimeStamp(contents.GetString(assetName, "DUEDATE")); DateTime dueDate = t.ToDateTime(); node.Text = (contents.GetString(assetName, "TITLE")); // Name node.SubItems.Add(dueDate.ToString()); node.SubItems.Add(contents.GetString(assetName, "TIME")); node.SubItems.Add(contents.GetString(assetName, "CREATOR")); node.SubItems.Add(contents.GetString(assetName, "PRIORITY")); node.SubItems.Add(contents.GetString(assetName, "STATUS")); node.SubItems.Add(contents.GetString(assetName, "ASSET")); node.SubItems.Add(String.Concat(file.DirectoryName, "\\", assetName)); // Fullname node.SubItems.Add(box); // Current box node.ForeColor = textColor; node.ImageIndex = 0; //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName)); listViewToFill.Items.Add(node); } } contents.Close(); } return(true); }
public void RefreshBox(MOG_Filename add, MOG_Filename del, MOG_Command command) { Color textColorAdd = Color.Black; Color textColorDel = Color.Black; // Dont add if we dont have a valid box if (add.GetBoxName().Length == 0 && del.GetBoxName().Length == 0) { return; } ListView currentViewAdd = mParent.IsolateListView(add.GetBoxName(), add.GetType(), add.GetUserName(), ref textColorAdd); ListView currentViewDel = mParent.IsolateListView(del.GetBoxName(), del.GetType(), del.GetUserName(), ref textColorDel); if (currentViewAdd == currentViewDel) { // Check to see if this item already exists? int index = mParent.ListViewItemFindItem(add.GetFilename(), currentViewAdd); if (index != -1) { currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.STATUS].Text = command.GetDescription(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.FULLNAME].Text = add.GetFullFilename(); currentViewAdd.Items[index].ForeColor = textColorAdd; for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++) { currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd; } } } else { if (currentViewDel != null) { int index = mParent.ListViewItemFindItem(del.GetFilename(), currentViewDel); if (index != -1) { currentViewDel.Items[index].Remove(); } } if (currentViewAdd != null) { // Check to see if this item already exists? int index = mParent.ListViewItemFindItem(add.GetFilename(), currentViewAdd); if (index != -1) { currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.STATUS].Text = command.GetDescription(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.FULLNAME].Text = add.GetFullFilename(); currentViewAdd.Items[index].ForeColor = textColorAdd; for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++) { currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd; } } else { MOG_ControllerTask assetController = new MOG_ControllerTask(mParent.mMog); if (!assetController.Open(add.GetFullFilename())) { return; } ListViewItem item = new ListViewItem(); item.Text = assetController.GetTitle(); MOG_Time t = new MOG_Time(); t.SetTimeStamp(assetController.GetDueDate()); item.SubItems.Add(t.ToDateTime().ToString()); item.SubItems.Add(assetController.GetFileInfo().LastWriteTime.ToString()); item.SubItems.Add(assetController.GetCreator()); item.SubItems.Add(assetController.GetPriority()); item.SubItems.Add(assetController.GetStatus()); item.SubItems.Add(assetController.GetAsset()); item.SubItems.Add(assetController.GetAssetFilename().GetFullFilename()); item.SubItems.Add(assetController.GetAssetFilename().GetBoxName()); item.ForeColor = Color.Black; for (int x = 0; x < item.SubItems.Count; x++) { item.SubItems[x].ForeColor = textColorAdd; } item.ImageIndex = 0; //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName)); currentViewAdd.Items.Add(item); assetController.Close(); } } } // Update the tab RefreshTab(command); }