Esempio n. 1
0
        public void updateDatabase()
        {
            if (beenChanged)
            {
                AssignedTaskTableAdapter taskAdapter            = new AssignedTaskTableAdapter();
                NuRacingDataSet.AssignedTaskDataTable taskTable = taskAdapter.GetAssignedTask(taskID);
                NuRacingDataSet.AssignedTaskRow       taskRow   = (NuRacingDataSet.AssignedTaskRow)taskTable.Rows[0];
                taskRow.WorkType_UID        = workTypeID;
                taskRow.Task_Name           = taskName;
                taskRow.Task_Description    = taskDescription;
                taskRow.Task_TakeFiveNeeded = takeFiveNeeded;
                taskRow.Task_DueDate        = dueDate;

                if (taskStatus != null)
                {
                    taskRow.Task_Status = taskStatus;
                }

                if (taskIncompleteReason != null)
                {
                    taskRow.Task_IncompleteReason = taskIncompleteReason;
                }

                taskAdapter.Update(taskTable);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a task for the specified user and send them an email notification.
        /// </summary>
        /// <param name="assigningUser">User assigning the task</param>
        /// <param name="assignedToUser">User task was assigned to</param>
        /// <param name="workType">Work task belongs to</param>
        /// <param name="name">Name of the task</param>
        /// <param name="description">Description of task</param>
        /// <param name="takeFiveNeeded">Requires a take five</param>

        static public void addTask(string assigningUser, List <string> assignedToUsers, int workType, DateTime dueDate, string name, string description, bool takeFiveNeeded)
        {
            AssignedTaskTableAdapter assignedTaskAdapter = new AssignedTaskTableAdapter();

            NuRacingDataSet.AssignedTaskDataTable assignedTaskTable = assignedTaskAdapter.GetData();

            NuRacingDataSet.AssignedTaskRow assignedTaskRow = assignedTaskTable.NewAssignedTaskRow();

            assignedTaskRow.User_Username_AssignedBy = assigningUser;

            assignedTaskRow.WorkType_UID = workType;

            assignedTaskRow.Task_Name = name;

            assignedTaskRow.Task_Description = description;

            assignedTaskRow.Task_TakeFiveNeeded = takeFiveNeeded;

            assignedTaskRow.Task_DueDate = dueDate;

            assignedTaskRow.Task_Status = "Incomplete";

            assignedTaskTable.AddAssignedTaskRow(assignedTaskRow);

            assignedTaskAdapter.Update(assignedTaskTable);


            AssignedUserTableAdapter assignedUserAdapter = new AssignedUserTableAdapter();

            NuRacingDataSet.AssignedUserDataTable assignedUserTable = assignedUserAdapter.GetData();

            int TaskID = getTaskID(assigningUser, workType, dueDate, name, description, takeFiveNeeded);

            foreach (string assignedToUser in assignedToUsers)
            {
                NuRacingDataSet.AssignedUserRow assignedUserRow = assignedUserTable.NewAssignedUserRow();

                assignedUserRow.User_Username = assignedToUser;
                assignedUserRow.Task_UID      = TaskID;

                assignedUserTable.AddAssignedUserRow(assignedUserRow);

                EmailManager.taskNotification(assignedToUser, assigningUser, name, description, User.getEmail(assignedToUser));
            }

            assignedUserAdapter.Update(assignedUserTable);
        }
Esempio n. 3
0
        public void resetData()
        {
            if (!beenChanged)
            {
                AssignedTaskTableAdapter assignedTaskAdapter            = new AssignedTaskTableAdapter();
                NuRacingDataSet.AssignedTaskDataTable assignedTaskTable = assignedTaskAdapter.GetAssignedTask(taskID);
                NuRacingDataSet.AssignedTaskRow       taskRow           = (NuRacingDataSet.AssignedTaskRow)assignedTaskTable.Rows[0];

                assigningUserInfo = UserInfo.getUser(taskRow.User_Username_AssignedBy);

                taskID = taskRow.Task_UID;

                workTypeID = taskRow.WorkType_UID;

                taskName = taskRow.Task_Name;

                taskDescription = taskRow.Task_Description;

                takeFiveNeeded = taskRow.Task_TakeFiveNeeded;

                if (!taskRow.IsTask_StatusNull())
                {
                    taskStatus = taskRow.Task_Status;

                    if (!taskRow.IsTask_IncompleteReasonNull())
                    {
                        taskIncompleteReason = taskRow.Task_IncompleteReason;
                    }
                }

                dueDate = taskRow.Task_DueDate;

                AssignedUserTableAdapter assignedUserAdapter            = new AssignedUserTableAdapter();
                NuRacingDataSet.AssignedUserDataTable assignedUserTable = assignedUserAdapter.GetDataByTaskID(TaskID);

                userAssignedInfo = new List <UserInfo>(assignedUserTable.Rows.Count);

                foreach (NuRacingDataSet.AssignedUserRow assignedUserRow in assignedUserTable.Rows)
                {
                    userAssignedInfo.Add(UserInfo.getUser(assignedUserRow.User_Username));
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Sets the specified task to complete if it exists
        /// </summary>
        /// <param name="taskID">ID of task</param>

        static public void taskComplete(int taskID)
        {
            if (taskExists(taskID))
            {
                AssignedTaskTableAdapter assignedTaskAdapter = new AssignedTaskTableAdapter();

                NuRacingDataSet.AssignedTaskDataTable assignedTaskTable = assignedTaskAdapter.GetDataByWorkTypeID(taskID);

                NuRacingDataSet.AssignedTaskRow assignedTaskRow = (NuRacingDataSet.AssignedTaskRow)assignedTaskTable.Rows[0];

                assignedTaskRow.Task_Status = "Complete";

                assignedTaskAdapter.Update(assignedTaskTable);
            }

            else
            {
                throw new ArgumentException("Assigned Task Doesn't Exist");
            }
        }