Ejemplo n.º 1
0
        public void CreateHouseholdTask(HouseholdTaskEntity task)
        {
            task.Id = GetGlobalCounter();
            int numberOfRow = RunCommand($"INSERT INTO {TableNames.HouseholdTasks} (Id, Title, Description, ProcessingTimeId, CreatorId) VALUES ({task.Id}, '{task.Title}', '{task.Description}', {task.ProcessingTimeId}, '{task.CreatorId}' );");

            IsRowEffected(numberOfRow, "Beim Erstellen des Nutzers ist ein Fehler aufgetreten.");
        }
Ejemplo n.º 2
0
 public void CreateOrUpdate(HouseholdTaskEntity task)
 {
     if (task.Id == 0)
     {
         CreateHouseholdTask(task);
     }
     else
     {
         UpdateHouseholdTask(task);
     }
 }
Ejemplo n.º 3
0
        public static HouseholdTaskEntity GetHouseholdTask()
        {
            HouseholdTaskEntity householdTask = new HouseholdTaskEntity
            {
                Id               = id,
                CreatorId        = creatorId,
                Description      = description,
                Title            = title,
                ProcessingTimeId = processingTimeId
            };

            return(householdTask);
        }
Ejemplo n.º 4
0
        public void InitTest()
        {
            HouseholdTaskEntity householdTask = GetHouseholdTask();

            Assert.IsNotNull(householdTask);

            Assert.AreEqual(id, householdTask.Id);
            Assert.AreEqual(creatorId, householdTask.CreatorId);
            Assert.AreEqual(description, householdTask.Description);
            Assert.AreEqual(title, householdTask.Title);
            Assert.AreEqual(processingTimeId, householdTask.ProcessingTimeId);

            ProcessingTimeEntity processingTime = GetProcessingTime();

            Assert.IsNotNull(processingTime);

            Assert.AreEqual(processingTimeId, processingTime.Id);
            Assert.AreEqual(initialDate, processingTime.InitialDate);
            Assert.AreEqual(ProcessingDateReplay.Daily, processingTime.Replay);
        }
        public void LoadTest()
        {
            CreateHistoryTasks();

            var tasks = access.GetHouseholdTasks();

            Assert.AreEqual(2, tasks.Count);

            HouseholdTaskEntity household2 = tasks.Last();

            HistoryTaskFactory historyTaskFactory = new HistoryTaskFactory(access);

            List <HistoryTask> historyTasks1 = historyTaskFactory.LoadHistoryTasks(tasks.First());

            Assert.AreEqual(1, historyTasks1.Count);
            HistoryTask historyTask1 = historyTasks1.First();

            List <HistoryTask> historyTasks2 = historyTaskFactory.LoadHistoryTasks(tasks.Last());
            var historyTask2 = historyTasks1.First();
        }
Ejemplo n.º 6
0
        public List <HistoryTask> LoadHistoryTasks(HouseholdTaskEntity task)
        {
            List <HistoryTask> output = new List <HistoryTask>();

            List <HistoryTaskEntity> historyTaskEntities = _access.GetHistoryTasks().Where(t => t.TaskId == task.Id).ToList();

            foreach (var historyTaskEntity in historyTaskEntities)
            {
                HistoryTask historyTask = new HistoryTask
                {
                    Id       = historyTaskEntity.Id,
                    TaskId   = historyTaskEntity.TaskId,
                    EditorId = historyTaskEntity.EditorId,
                    Date     = historyTaskEntity.Date,
                    Status   = historyTaskEntity.Status,
                    Task     = task,
                    Editor   = userFactory.LoadUser(historyTaskEntity.EditorId)
                };

                output.Add(historyTask);
            }

            return(output);
        }
Ejemplo n.º 7
0
        public void UpdateHouseholdTask(HouseholdTaskEntity task)
        {
            int numberOfRow = RunCommand($"UPDATE {TableNames.HouseholdTasks} SET Title='{task.Title}', Description='{task.Description}', ProcessingTimeId={task.ProcessingTimeId}, CreatorId='{task.CreatorId}'  WHERE Id = {task.Id};");

            IsRowEffected(numberOfRow, "Beim Ändern des Nutzers ist ein Fehler aufgetreten.");
        }
Ejemplo n.º 8
0
        public ActionResult Post(HouseholdTaskEntity householdTask)
        {

            return new OkResult();
        }