Exemple #1
0
        public static void AddWork(string[] Usernames, DateTime DateCompleted, string Description, int WorkTypeID, int TimeWorkedMins, TakeFiveResponse[] TakeFiveResponses)
        {
            foreach (String Username in Usernames)
            {
                if (!User.UsernameExists(Username))
                {
                    throw new ArgumentException("Username doesn't exist: " + Username);
                }
            }

            if (!WorkType.WorkTypeExists(WorkTypeID))
            {
                throw new ArgumentException("Work Type doesn't exist");
            }

            StoreWork(DateCompleted, Description, null, WorkTypeID, TimeWorkedMins, true);
            int WorkID = findWorkID(DateCompleted, Description, null, WorkTypeID, TimeWorkedMins, true);

            StoreWorkDoneBy(Usernames, WorkID);

            StoreTakeFivesTaken(TakeFiveResponses, WorkID);
        }
Exemple #2
0
        public static void CompleteTask(string[] Usernames, DateTime DateCompleted, int AssignedTaskID, string Description, int TimeWorkedMins, TakeFiveResponse[] takeFiveResponses)
        {
            foreach (string Username in Usernames)
            {
                if (!User.UsernameExists(Username))
                {
                    throw new ArgumentException("Username doesn't exist");
                }
                if ((new AssignedUserTableAdapter()).GetDataByBoth(AssignedTaskID, Username).Rows.Count == 0)
                {
                    throw new ArgumentException("Username wasn't consistant with Assigned Task record");
                }
            }
            if (AssignedTask.taskExists(AssignedTaskID))
            {
                throw new ArgumentException("Task doesn't exist");
            }

            int WorkTypeID = ((NuRacingDataSet.AssignedTaskRow)((new AssignedTaskTableAdapter()).GetAssignedTask(AssignedTaskID).Rows[0])).WorkType_UID;

            StoreWork(DateCompleted, Description, AssignedTaskID, WorkTypeID, TimeWorkedMins, true);
            int WorkID = findWorkID(DateCompleted, Description, AssignedTaskID, WorkTypeID, TimeWorkedMins, true);

            StoreWorkDoneBy(Usernames, WorkID);

            StoreTakeFivesTaken(takeFiveResponses, WorkID);
        }
Exemple #3
0
        private static void StoreTakeFivesTaken(TakeFiveResponse[] responses, int WorkID)
        {
            TakeFiveResponseTableAdapter responseAdapter = new TakeFiveResponseTableAdapter();
            NuRacingDataSet.TakeFiveResponseDataTable responseTable = responseAdapter.GetData();

            foreach (TakeFiveResponse response in responses)
            {
                NuRacingDataSet.TakeFiveResponseRow responseRow = responseTable.NewTakeFiveResponseRow();

                responseRow.Work_UID = WorkID;
                responseRow.TakeFive_UID = response.TakeFiveID;
                responseRow.TakeFiveResponse_Reason = response.Response;

                responseTable.AddTakeFiveResponseRow(responseRow);
            }

            responseAdapter.Update(responseTable);
        }