Exemple #1
0
 public ExportData(Events evnt, EventDay[] days, Task[] tasks, FacilityBookingConfirmed[][] facilities, Program[][] programs, Guest[][] guests, Participant[] participants
     , OptimizedBudgetItems optitems, BudgetIncome[] budgetincomes, Field[] field)
 {
     this.evnts = evnt;
     this.days = days;
     this.tasks = tasks;
     this.facilities = facilities;
     this.programs = programs;
     this.guests = guests;
     this.participants = participants;
     this.optitems = optitems;
     this.budgetincomes = budgetincomes;
     this.field = field;
 }
        public static void AddSingleAssignment(User user, int eventID, int roleID, Task task)
        {
            //TODO: Put in after roles management for task up
            if (!user.isAuthorized(EventController.GetEvent(eventID), EnumFunctions.Assign_Task)
                || !user.isAuthorized(EventController.GetEvent(eventID), EnumFunctions.Add_Task))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Assign Tasks!"));

            DAL dalDataContext = new DAL();
            TaskAssignment taskAssn = new TaskAssignment(eventID, task.TaskID, roleID);
            Table<TaskAssignment> assignmentTable = dalDataContext.taskAssignments;

            assignmentTable.InsertOnSubmit(taskAssn);
            assignmentTable.Context.SubmitChanges();
        }
Exemple #3
0
        public static void CreateTask(int eventID, string taskName,
            string taskDesc, DateTime DueDate, DAL dalDataContext)
        {
            try
            {

                Table<Task> taskTable = dalDataContext.tasks;
                Task task = new Task(eventID, taskName, taskDesc, DueDate);

                taskTable.InsertOnSubmit(task);
                taskTable.Context.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Task, Please Try Again!"));
            }
        }
        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;
                Task t = new Task();
                t.TaskName = txtTaskName.Text.Trim();
                t.TaskDesc = textRange.Text.Trim();
                t.DueDate = dtpDueDate.SelectedDateTime;
                lstManageTasks.Items.Add(t);
                tasks.Add(t);

                MessageBox.Show("Operation succeeded!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occured: " + ex.Message, "Error",
                    MessageBoxButton.OK, MessageBoxImage.Error);
            }

            //client.Close();
            LoadTasks();
        }
Exemple #5
0
        //Create a new task without assigning to anyone
        public static void CreateTask(User user, int eventID, string taskName,
            string taskDesc, DateTime DueDate)
        {
            //TODO: Put in after roles management for task up
            if (!user.isAuthorized(EventController.GetEvent(eventID), EnumFunctions.Add_Task))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Add Tasks!"));
            try
            {
                DAL dalDataContext = new DAL();
                Table<Task> taskTable = dalDataContext.tasks;
                Task task = new Task(eventID, taskName, taskDesc, DueDate);

                taskTable.InsertOnSubmit(task);
                taskTable.Context.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Task, Please Try Again!"));
            }
        }
        //Set Task to read
        public static void SetToRead(Task readTask, int roleID)
        {
            DAL dalDataContext = new DAL();
            try
            {
                TaskAssignment taskAssigned = (from tAssn in dalDataContext.taskAssignments
                                               where tAssn.TaskID == readTask.TaskID &&
                                                     tAssn.EventID == readTask.EventID &&
                                                     tAssn.AssignedRoleID == roleID
                                               select tAssn).SingleOrDefault();
                taskAssigned.IsRead = true;

                dalDataContext.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(),
                  new FaultReason(ex.Message));
            }
        }
        //Set task to not completed however need rights not anyone can do this
        //to prevent sabo
        public static void SetInComplete(User authorizedPerson, Task completedTask, int roleID, string remarks)
        {
            if (!authorizedPerson.isAuthorized(EventController.GetEvent(completedTask.EventID), EnumFunctions.Update_Task))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Update Tasks!"));
            DAL dalDataContext = new DAL();
            try
            {
                TaskAssignment taskAssigned = (from tAssn in dalDataContext.taskAssignments
                                               where tAssn.TaskID == completedTask.TaskID &&
                                               tAssn.EventID == completedTask.EventID &&
                                               tAssn.AssignedRoleID == roleID
                                               select tAssn).SingleOrDefault();

                taskAssigned.IsCompleted = false;
                taskAssigned.Remarks = remarks;
                dalDataContext.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(),
                  new FaultReason(ex.Message));
            }
        }
        //Set task to completed
        public static void SetCompleted(Task completedTask, int roleID, string remarks)
        {
            DAL dalDataContext = new DAL();
            try
            {
                TaskAssignment taskAssigned = (from tAssn in dalDataContext.taskAssignments
                                               where tAssn.TaskID == completedTask.TaskID &&
                                               tAssn.EventID == completedTask.EventID &&
                                               tAssn.AssignedRoleID == roleID
                                               select tAssn).SingleOrDefault();

                taskAssigned.IsCompleted = true;
                taskAssigned.CompletedDateTime = DateTime.Now;
                taskAssigned.Remarks = remarks;
                dalDataContext.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(),
                  new FaultReason(ex.Message));
            }
        }
        private void clone(List<Task> t1, List<Task> t2)
        {
            t2.Clear();

            for (int x = 0; x < t1.Count; x++)
            {

                Task t = new Task();
                t.DueDate = t1[x].DueDate;
                t.TaskDesc = t1[x].TaskDesc;
                t.TaskName = t1[x].TaskName;

                t2.Add(t);
            }
        }
Exemple #10
0
 public void SetTaskRead(Task task, int roleID)
 {
     TaskAssignmentController.SetToRead(task, roleID);
 }
Exemple #11
0
 public void SetTaskIncomplete(User user, Task task, int roleID, string remarks)
 {
     TaskAssignmentController.SetInComplete(user, task, roleID, remarks);
 }
Exemple #12
0
 public void SetTaskCompleted(Task task, int roleID, string remarks)
 {
     TaskAssignmentController.SetCompleted(task, roleID, remarks);
 }