public void refreshTaskList()
        {
            if (cboRole.SelectedIndex == -1)
            {
                lstAllTask.IsEnabled = false;
                return;
            }
            //Example of All Task created for the event
            //Throw in All Task Here
            List<Task> IndividualTask = new List<Task>();
            TasksHelper client = new TasksHelper();
            List<Task> AllTask = client.GetTasksByEvent(user.UserID, event_.EventID).ToList<Task>();

            lstAllTask.IsEnabled = true;
            IndividualTask = client.GetTaskByRole(event_.EventID, int.Parse(cboRole.SelectedValue.ToString())).ToList<Task>();

            client.Close();

            lstAllTask.ItemsSource = clsTaskAllocate.GetTaskNotAssigned(AllTask, IndividualTask);

            lstAssignedTask.ItemsSource = clsTaskAllocate.GetTaskAssigned(IndividualTask, int.Parse(cboRole.SelectedValue.ToString()));
        }
예제 #2
0
        private void chkIsCompleted_Click(object sender, RoutedEventArgs e)
        {
            if (chkIsCompleted.IsChecked == true)
            {
                if (MessageBox.Show("Are you sure this task is completed? It cannot be undone! ",
                "Confirm task completion...",
                MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {

                    TasksHelper client = new TasksHelper();
                    try
                    {
                        var textRange = new TextRange(txtDesc.Document.ContentStart, txtDesc.Document.ContentEnd);
                        Task task = (Task)lstTask.SelectedItem;

                        TaskAssignment assn = client.GetTaskAssignment(task.TaskID, event_.EventID,
                            int.Parse(cboRole.SelectedValue.ToString()));

                        client.SetTaskCompleted(task, assn.AssignedRoleID, textRange.Text.Trim());

                        MessageBox.Show("Operation Succeeded");
                        chkIsCompleted.IsEnabled = false;
                        txtRemark.IsReadOnly = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("An Error have occured: " + ex.Message, "Error",
                            MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    client.Close();
                }
                else
                {
                    chkIsCompleted.IsChecked = false;
                }
            }
        }
 private void btnAddTask_Click(object sender, RoutedEventArgs e)
 {
     if (txtTaskName.Text.Trim().Length == 0)
     {
         MessageBox.Show("Please enter the task Name", "Invalid input",
             MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return;
     }
     if (dtpDueDate.SelectedDateTime == default(DateTime))
     {
         MessageBox.Show("Please select task's due date", "Invalid input",
          MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return;
     }
     TasksHelper client = new TasksHelper();
     var textRange = new TextRange(txtDesc.Document.ContentStart, txtDesc.Document.ContentEnd);
     try
     {
         client.CreateTask(user, event_.EventID, txtTaskName.Text.Trim(),
             textRange.Text.Trim(), dtpDueDate.SelectedDateTime);
         int currIdx = cboRole.SelectedIndex;
         cboRole.SelectedIndex = -1;
         cboRole.SelectedIndex = currIdx;
         MessageBox.Show("Operation Succeeded");
     }
     catch (Exception ex)
     {
         MessageBox.Show("An Error have occured: " + ex.Message, "Error",
             MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         client.Close();
     }
     LoadTasks();
 }
예제 #4
0
        private void loadTasks()
        {
            TasksHelper client = new TasksHelper();

            lstTask.ItemsSource = client.GetTaskByRole(event_.EventID,
                int.Parse(cboRole.SelectedValue.ToString()));

            client.Close();
            ClearAll();
        }
예제 #5
0
        private void lstTask_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lstTask.SelectedIndex == -1)
            {
                return;
            }
            txtDesc.Document.Blocks.Clear();
            txtRemark.Document.Blocks.Clear();

            Task task = (Task)lstTask.SelectedItem;

            txtTaskName.Text = task.TaskName;
            txtDesc.AppendText(task.TaskDesc);
            dtpDueDate.SelectedDateTime = task.DueDate;

            TasksHelper client = new TasksHelper();

            TaskAssignment assn = client.GetTaskAssignment(task.TaskID, event_.EventID,
                int.Parse(cboRole.SelectedValue.ToString()));

            txtRemark.AppendText(assn.Remarks);
             chkIsCompleted.IsChecked = this.txtRemark.IsReadOnly = assn.IsCompleted;

            chkIsCompleted.IsEnabled = !assn.IsCompleted;

            if (!assn.IsRead)
            {
                client.SetTaskRead(task, int.Parse(cboRole.SelectedValue.ToString()));
            }
            client.Close();
        }
예제 #6
0
 private void loadTasks()
 {
     TasksHelper client = new TasksHelper();
     txtTaskMsg.Text = "There are a total of " + client.GetEventTasks(this.event_.EventID).ToList<Task>().Count() + " task(s)";
     client.Close();
 }
예제 #7
0
        private void loadTasks()
        {
            TasksHelper client = new TasksHelper();
            List<Task> TaskList= client.GetTasksByEvent(user.UserID, event_.EventID).ToList<Task>();
            client.Close();

            if (TaskList.Count > 0)
            {
                lblNoTask.Visibility = Visibility.Collapsed;
                lstTasks.Visibility = Visibility.Visible;
                lstTasks.ItemsSource = TaskList;
            }
            else
            {
                lblNoTask.Visibility = Visibility.Visible;
                lstTasks.Visibility = Visibility.Collapsed;
            }
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     refreshTaskList();
     TasksHelper taskClient = new TasksHelper();
     lstManageTasks.ItemsSource = lstOverviewAllTask.ItemsSource = taskClient.GetTasksByEvent(user.UserID, event_.EventID).ToList<Task>();
     taskClient.Close();
     LoadRoles();
 }
        private void saveAssignment()
        {
            //Use threading to stop system from "Hanging" as it may take a long time to save
            //as a list of objects are sent over via SOAP

            System.Threading.Thread thread = new System.Threading.Thread(
                new System.Threading.ThreadStart(
                delegate()
                {
                    System.Windows.Threading.DispatcherOperation
                    dispatcherOp = this.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(delegate()
                    {
                        try
                        {
                            Mouse.OverrideCursor = Cursors.Wait;
                            MessageBox.Show("Please wait while we process your request...");

                            TasksHelper client = new TasksHelper();
                            try
                            {
                                Task[] taskList = this.lstAssignedTask.ItemsSource.Cast<Task>().ToArray();
                                //MessageBox.Show(taskList[0].TaskName);
                                client.AssignTask(user, event_.EventID, int.Parse(cboRole.SelectedValue.ToString()), taskList);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("An error have occured: " + ex.Message, "Error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                            finally
                            {
                                client.Close();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("An error have occured: " + ex.Message, "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                        }
                    }
                ));

                    dispatcherOp.Completed += new EventHandler(dispatcherOp_Completed);
                }
            ));

            thread.Start();
        }
예제 #10
0
 private void LoadTasks()
 {
     TasksHelper client = new TasksHelper();
     lstManageTasks.ItemsSource = lstOverviewAllTask.ItemsSource = client.GetTasksByEvent(user.UserID, event_.EventID);
     client.Close();
     ClearAll();
 }
예제 #11
0
        private void chkIsCompleted_Click(object sender, RoutedEventArgs e)
        {
            int selectedTaskIdx = lstOverviewAllTask.SelectedIndex;
            Task task = (Task)lstOverviewAllTask.SelectedItem;
            TaskAssignmentState tas = (TaskAssignmentState)lvOverViewRoleView.SelectedItem;
            TasksHelper client = new TasksHelper();

            try
            {
                if (MessageBox.Show("Are you sure you want to change the status of completion? ",
               "Confirm Operation...",
               MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                {
                    chkIsCompleted.IsChecked = tas.TaskAssignment.IsCompleted;
                    return;
                }
                var textRange = new TextRange(txtOverviewRemark.Document.ContentStart, txtOverviewRemark.Document.ContentEnd);

                if (chkIsCompleted.IsChecked == true)
                {
                    client.SetTaskCompleted(task, tas.TaskAssignment.AssignedRoleID, textRange.Text.Trim());
                }
                else
                {
                    client.SetTaskIncomplete(user, task, tas.TaskAssignment.AssignedRoleID, textRange.Text.Trim());
                }

                LoadTasks();
                ClearOverview();
                cboRole.SelectedIndex = -1;
                lstOverviewAllTask.SelectedIndex = selectedTaskIdx;
                MessageBox.Show("Operation Succeeded");

                //lvOverViewRoleView.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error have occured: " + ex.Message, "Error",
                    MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                client.Close();
            }
        }
예제 #12
0
 private void btnUpdateTask_Click(object sender, RoutedEventArgs e)
 {
     if (lstManageTasks.SelectedIndex == -1)
     {
         MessageBox.Show("Please select a task to update!", "Invalid Input",
             MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return;
     }
     Task t = (Task)lstManageTasks.SelectedItem;
     TasksHelper client = new TasksHelper();
     var textRange = new TextRange(txtDesc.Document.ContentStart, txtDesc.Document.ContentEnd);
     try
     {
         client.UpdateTask(user, event_.EventID, t.TaskID, txtTaskName.Text.Trim(), textRange.Text.Trim(),
             dtpDueDate.SelectedDateTime);
         int currIdx = cboRole.SelectedIndex;
         cboRole.SelectedIndex = -1;
         cboRole.SelectedIndex = currIdx;
         MessageBox.Show("Operation Succeeded");
     }
     catch (Exception ex)
     {
         MessageBox.Show("An Error have occured: " + ex.Message, "Error",
            MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         client.Close();
     }
     LoadTasks();
 }
예제 #13
0
 private void btnDeleteTask_Click(object sender, RoutedEventArgs e)
 {
     if (lstManageTasks.SelectedIndex == -1)
     {
         MessageBox.Show("Please select a task to delete!", "Invalid Input",
             MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return;
     }
     Task t = (Task)lstManageTasks.SelectedItem;
     TasksHelper client = new TasksHelper();
     try
     {
         client.DeleteTask(user, event_.EventID, t.TaskID);
         int currIdx = cboRole.SelectedIndex;
         cboRole.SelectedIndex = -1;
         cboRole.SelectedIndex = currIdx;
         MessageBox.Show("Operation Succeeded");
     }
     catch (Exception ex)
     {
         MessageBox.Show("An Error have occured: " + ex.Message, "Error",
            MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         client.Close();
     }
     LoadTasks();
 }