コード例 #1
0
        private void SetTaskData(DataEntities.ProductRequests.ProductRequestRegistrationTask dataTask, ProductRequestRegistrationTask businessTask, int accountId)
        {
            if ((dataTask.ProductRequestRegistrationTaskId == 0 &&
                    (businessTask.IsCompleted || !string.IsNullOrWhiteSpace(businessTask.Comment))
                )
                ||
                (dataTask.ProductRequestRegistrationTaskId > 0 &&
                    (businessTask.IsCompleted != dataTask.IsCompleted || !string.Equals(businessTask.Comment, dataTask.Comment, StringComparison.CurrentCulture))
                ))
            {
                dataTask.LastChangedByAccountId = accountId;
                dataTask.LastChangedOn = SystemTime.Now;

                dataTask.IsCompleted = businessTask.IsCompleted;
                dataTask.Comment = businessTask.Comment;
            }
        }
コード例 #2
0
        private void UpdateExistingTask(DataEntities.ProductRequests.ProductRequestRegistrationTask existingTask, ProductRequestRegistrationTask task, DataEntities.Auth.Account dataAccount)
        {
            SetTaskData(existingTask, task, dataAccount.AccountId);

            ProductRequestRegistrationTaskRepository.Update(existingTask);
        }
コード例 #3
0
        private void CreateNewTask(ProductRequestRegistration registration, int registrationId, ProductRequestRegistrationTask task, DataEntities.Auth.Account dataAccount)
        {
            var taskForType = GetTasksByType(registration.ProductRequestTypeId).FirstOrDefault(o => o.ExternalId == task.ProductRequestTaskId);
            if (taskForType == null)
                throw new EntityNotFoundException(typeof(ProductRequestRegistrationTask), task.ProductRequestTaskId);

            var newEntity =
                new DataEntities.ProductRequests.ProductRequestRegistrationTask
                {
                    ProductRequestTaskId = taskForType.ProductRequestTaskId,
                    ProductRequestRegistrationId = registrationId,
                };

            SetTaskData(newEntity, task, dataAccount.AccountId);

            ProductRequestRegistrationTaskRepository.Insert(newEntity);
        }