public void Edit(WorkTask task)
 {
     RepositoryAction.Transaction((c, t) =>
     {
         var row = WorkTaskTableRow.FromDomainObject(task);
         var dao = new WorkTaskDao(c, t);
         dao.Update(row);
     });
 }
        public static WorkTask Create(WorkTaskTableRow workTaskTableRow, bool isCompleted)
        {
            if (workTaskTableRow == null)
            {
                return(null);
            }

            return(new WorkTask(
                       new Identity <WorkTask>(workTaskTableRow.Id)
                       , workTaskTableRow.Title
                       , workTaskTableRow.TaskCategory
                       , new Identity <Domain.Domain.Products.Product>(workTaskTableRow.ProductId)
                       , new Identity <Domain.Domain.Clients.Client>(workTaskTableRow.ClientId)
                       , new Identity <Domain.Domain.WorkProcesses.WorkProcess>(workTaskTableRow.ProcessId)
                       , workTaskTableRow.TaskSource
                       , isCompleted));
        }
Exemple #3
0
        public void Edit(WorkTask task)
        {
            RepositoryAction.Transaction((c, t) =>
            {
                var row     = WorkTaskTableRow.FromDomainObject(task);
                var dao     = new WorkTaskDao(c, t);
                var compDao = new WorkTaskCompletedDao(c, t);
                dao.Update(row);

                if (task.IsCompleted)
                {
                    compDao.InsertIfNotExist(task.Id.Value);
                }
                else
                {
                    compDao.DeleteByWorkTaskId(task.Id.Value);
                }
            });
        }
Exemple #4
0
        private WorkTask AddCore(WorkTask task, ImportedTask workTaskImportSource)
        {
            var row = WorkTaskTableRow.FromDomainObject(task);

            RepositoryAction.Transaction((c, t) =>
            {
                var dao = new WorkTaskDao(c, t);
                var id  = dao.Insert(row);

                // ID採番結果
                row.Id = id;

                // スケジュールからの取込の場合は取込歴にも残す
                if (task.IsScheduled)
                {
                    var importDao = new ImportedTaskDao(c, t);
                    importDao.Insert(ImportedTaskTableRow.FromDomainObject(id, workTaskImportSource));
                }
            });

            return(WorkTaskFactory.Create(row, task.IsCompleted));
        }
        public WorkTask Add(WorkTask task)
        {
            var row = WorkTaskTableRow.FromDomainObject(task);

            RepositoryAction.Transaction((c, t) =>
            {
                var dao = new WorkTaskDao(c, t);
                var id  = dao.Insert(row);

                // ID採番結果
                row.Id = id;

                // スケジュールからの取込の場合は取込歴にも残す
                if (task.IsScheduled)
                {
                    var importDao = new ImportedTaskDao(c, t);
                    importDao.Insert(ImportedTaskTableRow.FromDomainObject(task));
                }
            });

            return(row.ConvertToDomainObject());
        }