public async Task <DeleteTaskResult> DeleteTaskItem(string id, bool keepChildren) { try { var result = new DeleteTaskResult(); var current = await TaskItemRepository.Get(id).ConfigureAwait(false); if (current == null) { return(null); } await TaskItemRepository.Delete(id).ConfigureAwait(false); if (!string.IsNullOrWhiteSpace(current.Parent)) { result.Parent = await TaskItemRepository.Get(current.Parent).ConfigureAwait(false); await UpdateTotalEstimation(result.Parent).ConfigureAwait(false); } else if (!current.IsInterruption) { await ProcessChildTasks(current, keepChildren, result).ConfigureAwait(false); } return(result); } catch { return(null); } }
public async Task <TaskItem> ConvertInterruptionToTaskItem(TaskItem interruption) { interruption.IsInterruption = false; await TaskItemRepository.Replace(interruption).ConfigureAwait(false); return(interruption); }
public UnitOfWork(DataContext context) { _context = context; Tasks = new TaskItemRepository(_context); Projects = new ProjectRepository(_context); Sprints = new SprintRepository(_context); }
public void EnsureRepositoryCanBeLoaded() { var repo = new TaskItemRepository(connectionString); var transactionOptions = new TransactionOptions { IsolationLevel = IsolationLevel.Serializable }; var tasks = repo.GetAllTasks(); }
private TaskItemRepository CreateSUT() { var connectionString = ConfigurationManager.ConnectionStrings["TaskManager"].ConnectionString; var sqlClient = new SQLClient(connectionString); var sut = new TaskItemRepository(sqlClient); return(sut); }
public void EnsureTaskCanBeAdded() { var name = new Guid().ToString("N"); var task = new TaskItem(name); var repo = new TaskItemRepository(connectionString); var newId = repo.AddTask(task); Assert.IsTrue(newId > 0); }
public TaskItemBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; taskRepository = new TaskItemRepository(unitOfWork); taskStatusRepository = new TaskStatusRepository(unitOfWork); contactRepository = new ContactRepository(unitOfWork); leadRepository = new LeadRepository(unitOfWork); accountRepository = new AccountRespository(unitOfWork); }
public TaskItemService ( CategoryRepository categoryRepository, TaskItemRepository taskItemRepository, AppSettingsService appSettingsService ) { CategoryRepository = categoryRepository; TaskItemRepository = taskItemRepository; AppSettingsService = appSettingsService; }
private async Task UpdateTotalEstimation(TaskItem parent) { var settings = await AppSettingsService.GetSessionSettings().ConfigureAwait(false); var children = await TaskItemRepository.GetChildTaskItems(parent.Id).ConfigureAwait(false); var total = children.Sum(_ => _.Estimate); parent.Estimate = total == 0 ? settings.SessionDuration : total; await TaskItemRepository.Replace(parent).ConfigureAwait(false); }
public async Task <IEnumerable <TaskItem> > GetIncompleteTaskItems(int limit) { try { return(await TaskItemRepository.GetIncompleteTaskItems(limit).ConfigureAwait(false)); } catch { return(new List <TaskItem>()); } }
public async Task <TaskItem> GetTaskItem(string id) { try { return(await TaskItemRepository.Get(id).ConfigureAwait(false)); } catch { return(null); } }
public async Task <JArray> AddArchivedTaskItemListAsync(JArray result, int boardId) { JObject json; JToken jsonList; var uri = $"http://{Subdomain}.kanbanize.com/index.php/api/kanbanize/get_all_tasks/"; var body = "{\"boardid\":\"" + boardId + "\", \"comments\": \"yes\", \"container\": \"archive\"}"; var xmlTaskItemList = GetInformation(uri, body); var doc = new XmlDocument(); doc.LoadXml(xmlTaskItemList); try { json = JObject.Parse(JsonConvert.SerializeXmlNode(doc)); jsonList = json["xml"]["task"]["item"]; } catch (InvalidOperationException ex) { return(new JArray()); } foreach (var item in jsonList) { try { var taskItemRepository = new TaskItemRepository(); if (((int)item["workflow_id"] == 19 && boardId == 4) || ((int)item["workflow_id"] == 8 && boardId == 5) && !await taskItemRepository.TaskItemHasBeenReleasedAsync((int)item["taskid"])) { result.Add(item); } else { if (item["workflow_name"].ToString().Contains("Delivery")) { Console.WriteLine( $"Task {item["taskid"]} has already been released. No more updates are needed."); } } } catch (Exception ex) { Console.Write(""); } } return(result); }
public AccountBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; accountRepository = new AccountRespository(unitOfWork); accountTypeRepository = new AccountTypeRespository(unitOfWork); tagRepository = new TagRepository(unitOfWork); accountTagRepository = new AccountTagRepository(unitOfWork); taskItemRepository = new TaskItemRepository(unitOfWork); contactRepository = new ContactRepository(unitOfWork); fileAttachmentRepository = new FileAttachmentRepository(unitOfWork); salesOrderRepository = new SalesOrderRepository(unitOfWork); accountCaseRepository = new AccountCaseRepository(unitOfWork); }
private static async Task InsertDevOpsCardsAsync() { var accessTaskItemData = new TaskItemRepository(); var taskItemList = await DevOpsApiWrapper.GetTaskItemList(); if (taskItemList.Any()) { await accessTaskItemData.InsertTaskItemListAsync(await DevOpsDeserializer.TaskItemListAsync(taskItemList)); } else { Console.WriteLine("No new cards."); } }
public void EnsureTaskIsCorrectlyAdded() { var name = new Guid().ToString("N"); var task = new TaskItem(name); var repo = new TaskItemRepository(connectionString); var newId = repo.AddTask(task); var loadedTask = repo.GetTask(newId); Assert.IsNotNull(loadedTask); Assert.AreEqual(newId, loadedTask.Id); Assert.AreEqual(name, loadedTask.Name); Assert.AreEqual(false, loadedTask.IsComplete); }
public async Task <TaskItem> ConvertChildToParent(TaskItem child) { var parent = await TaskItemRepository.Get(child.Parent).ConfigureAwait(false); if (parent == null) { return(null); } child.Parent = null; child.CategoryId = parent.CategoryId; await TaskItemRepository.Replace(child).ConfigureAwait(false); return(child); }
public async Task <TaskItem> AddTaskItem(TaskItem item) { if (string.IsNullOrWhiteSpace(item.Name)) { throw new ArgumentException("Must provide a valid name."); } try { await TaskItemRepository.Add(item).ConfigureAwait(false); return(item); } catch { return(null); } }
public async Task <AddChildResult> AddChildTaskItem(string parentId, TaskItem item) { if (string.IsNullOrWhiteSpace(item.Name)) { throw new ArgumentException("Must provide a valid name."); } var parent = await TaskItemRepository.Get(parentId).ConfigureAwait(false); if (parent == null) { throw new ArgumentException("Parent task not found."); } try { var settings = await AppSettingsService.GetSessionSettings().ConfigureAwait(false); item.Parent = parent.Id; item.CategoryId = null; item.Deadline ??= parent.Deadline; item.Estimate = settings.SessionDuration; item.Recur = parent.Recur; item.Priority ??= new RankItem { Rank = (int)Priority.Normal, Name = Enum.GetName(typeof(Priority), Priority.Normal) }; await TaskItemRepository.Add(item).ConfigureAwait(false); await UpdateTotalEstimation(parent).ConfigureAwait(false); return(new AddChildResult { Parent = parent, Child = item }); } catch { return(null); } }
static async Task Main(string[] args) { var releaseRepository = new ReleaseRepository(); var taskItemRepository = new TaskItemRepository(); var taskItemList = await taskItemRepository.GetTaskItemListAsync( new DateTimeOffset(new DateTime(2015, 1, 1), TimeSpan.Zero), DateTimeOffset.Now); var newTaskItemList = new List <TaskItem>(); foreach (var taskItem in taskItemList) { taskItem.Release = await releaseRepository.GetFirstReleaseBeforeDateAsync(taskItem.FinishTime); newTaskItemList.Add(taskItem); Console.WriteLine($"Determined Task {taskItem.Id}'s Release is {taskItem.Release.Id}."); } await taskItemRepository.InsertTaskItemListAsync(newTaskItemList); }
public LeadBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; leadRepository = new LeadRepository(unitOfWork); taskItemRepository = new TaskItemRepository(unitOfWork); stageRepository = new StageRepository(unitOfWork); leadAuditBusiness = new LeadAuditBusiness(unitOfWork); accountRepository = new AccountRespository(_unitOfWork); contactRepository = new ContactRepository(_unitOfWork); moduleRepository = new ModuleRepository(_unitOfWork); leadStatusRepository = new LeadStatusRepository(_unitOfWork); fileAttachmentrepository = new FileAttachmentRepository(_unitOfWork); stageBusiness = new StageBusiness(_unitOfWork); ratingBusiness = new RatingBusiness(_unitOfWork); leadContactRepository = new LeadContactRepository(_unitOfWork); accountcontactRepository = new AccountContactRepository(_unitOfWork); salesOrderRepository = new SalesOrderRepository(_unitOfWork); tagRepository = new TagRepository(_unitOfWork); leadTagRepository = new LeadTagRepository(_unitOfWork); }
private async Task ProcessChildTasks(TaskItem parent, bool keepChildren, DeleteTaskResult result) { var tasks = await TaskItemRepository.GetChildTaskItems(parent.Id).ConfigureAwait(false); if (!keepChildren) { result.DeletedChildren = tasks.ToList(); await TaskItemRepository.DeleteMany(result.DeletedChildren).ConfigureAwait(false); return; } foreach (var task in tasks) { task.Parent = null; task.CategoryId = parent.CategoryId; result.UpdatedChildren.Add(task); } await TaskItemRepository.ReplaceMany(result.UpdatedChildren).ConfigureAwait(false); }
public async Task <UpdateTaskResult> UpdateTaskItem(TaskItem item) { try { var result = new UpdateTaskResult { Target = item }; await TaskItemRepository.Replace(item).ConfigureAwait(false); if (!string.IsNullOrWhiteSpace(item.Parent)) { result.Parent = await TaskItemRepository.Get(item.Parent).ConfigureAwait(false); await UpdateTotalEstimation(result.Parent).ConfigureAwait(false); } return(result); } catch { return(null); } }
public MultipleLinearRegressionAnalysisHelper() { taskItemRepository = new TaskItemRepository(); }
public void EnsureRepositoryCanBeCreated() { var repo = new TaskItemRepository(connectionString); }
public static void Main(string[] args) { BuildWebHost(args).Run(); var x = new TaskItemRepository(); }
public TaskItemController(ILogger <TaskListController> logger, TaskItemRepository taskItemRepository) { _logger = logger; _taskItemRepository = taskItemRepository; }
public async Task <MultinomialLogisticRegressionAnalysisItemList> GetLogisticRegressionAnalysisData( DateTimeOffset?startDate, DateTimeOffset?finishDate, bool product, bool engineering, bool unanticipated, bool assessmentsTeam, bool enterpriseTeam) { var logisticRegressionData = new MultinomialLogisticRegressionAnalysisItemList(); var taskItemRepository = new TaskItemRepository(); var taskItemList = await taskItemRepository.GetTaskItemListAsync(startDate, finishDate); logisticRegressionData.UserIds = GetUserIds(taskItemList); var inputs = new List <List <double> >(); var outputList = new List <int>(); var ids = new List <int>(); var titles = new List <string>(); var taskItemHelper = new TaskItemHelper(); foreach (var logisticRegressionTaskItem in from taskItem in taskItemList where taskItem.StartTime != null && taskItem.FinishTime != null && taskItemHelper.TaskItemDevTeamIsSelected(assessmentsTeam, enterpriseTeam, taskItem) select GetLogisticRegressionTaskItem(taskItem)) { ids.Add(logisticRegressionTaskItem.Id); titles.Add(logisticRegressionTaskItem.Title); inputs.Add(new List <double> { logisticRegressionTaskItem.Lifetime.TotalDays, logisticRegressionTaskItem.LeadTime.TotalDays, logisticRegressionTaskItem.TimeSpentInBacklog.TotalDays, (logisticRegressionTaskItem.DevTeamIsAssessments ? 1.0 : 0.0), (logisticRegressionTaskItem.DevTeamIsEnterprise ? 1.0 : 0.0), logisticRegressionTaskItem.NumRevisions }); foreach (var user in logisticRegressionData.UserIds) { inputs.Last().Add(logisticRegressionTaskItem.CreatedById == user ? 1.0 : 0.0); } foreach (var user in logisticRegressionData.UserIds) { inputs.Last().Add(logisticRegressionTaskItem.LastChangedBy.Id == user ? 1.0 : 0.0); } outputList.Add((int)logisticRegressionTaskItem.TaskItemType); } var inputArray = inputs.Select(inputList => inputList.ToArray()).ToArray(); var actualResults = outputList.ToArray(); var lbnr = new LowerBoundNewtonRaphson() { MaxIterations = 100, Tolerance = 1e-6 }; var mlr = lbnr.Learn(inputArray, actualResults); var predictions = mlr.Decide(inputArray); var probabilities = mlr.Probabilities(inputArray); logisticRegressionData.Error = new ZeroOneLoss(actualResults).Loss(predictions); for (var i = 0; i < ids.Count; i++) { if (taskItemHelper.TaskItemTypeIsSelected(product, engineering, unanticipated, actualResults[i])) { var probability = probabilities[i].Max(); var logisticRegressionItem = new MultinomialLogisticRegressionAnalysisItem { Id = ids[i], Inputs = inputs[i], Title = titles[i], Actual = actualResults[i], Prediction = predictions[i], Probability = probability }; if (logisticRegressionItem.Actual != logisticRegressionItem.Prediction) { logisticRegressionData.Items.Add(logisticRegressionItem); } } } return(logisticRegressionData); }
public async Task When_getting_task_item_list_from_invalid_task_item_info() { var result = await TaskItemRepository.GetTaskItemListFromTaskItemInfoAsync(null); Assert.That(result.Count, Is.Zero); }
public CategoryService(CategoryRepository categoryRepository, TaskItemRepository taskItemRepository) { CategoryRepository = categoryRepository; TaskItemRepository = taskItemRepository; }
public MultipleLinearRegressionAnalysisHelper(TaskItemRepository taskItemRepository) { this.taskItemRepository = taskItemRepository; }