예제 #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;
 }
예제 #2
0
        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();
        }
예제 #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!"));
            }
        }
예제 #4
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;
                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();
        }
예제 #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!"));
            }
        }
예제 #6
0
        //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));
            }
        }
예제 #7
0
        //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));
            }
        }
예제 #8
0
        //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));
            }
        }
예제 #9
0
        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);
            }
        }
예제 #10
0
 public void SetTaskRead(Task task, int roleID)
 {
     TaskAssignmentController.SetToRead(task, roleID);
 }
예제 #11
0
 public void SetTaskIncomplete(User user, Task task, int roleID, string remarks)
 {
     TaskAssignmentController.SetInComplete(user, task, roleID, remarks);
 }
예제 #12
0
 public void SetTaskCompleted(Task task, int roleID, string remarks)
 {
     TaskAssignmentController.SetCompleted(task, roleID, remarks);
 }