Ejemplo n.º 1
0
        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()));
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
        private void loadTasks()
        {
            TasksHelper client = new TasksHelper();

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

            client.Close();
            ClearAll();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 8
0
 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();
 }
Ejemplo n.º 9
0
        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();
        }
Ejemplo n.º 10
0
 private void LoadTasks()
 {
     TasksHelper client = new TasksHelper();
     lstManageTasks.ItemsSource = lstOverviewAllTask.ItemsSource = client.GetTasksByEvent(user.UserID, event_.EventID);
     client.Close();
     ClearAll();
 }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 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();
 }