private void LoadTaskSessions() { using (ProjectInfoContext db = new ProjectInfoContext()) { var savedSessions = db.TaskDataEntities.ToList(); foreach (TaskInfo session in savedSessions) { tb = new TaskBox(session.TaskBoxID, session.TrackedTime, session.Name, _rate, _currentProject); //TODO FreelancerMode tb.textBlockHorRate.Text = _rate.ToString(); _tasks.Add(tb); tasksStackPanel.Children.Add(tb); } } }
private void btnAddTimer_Click(object sender, RoutedEventArgs e) { if (_freelancerMode == true) { _task = new TaskModel(taskCounter, _rate, _currentProject); _task.InsertSession(new TaskInfo() { TaskBoxID = taskCounter, Task_Id = taskCounter, HourRate = _rate, Project = _currentProject }); tb = new TaskBox(taskCounter, _rate, _currentProject); } else { _task = new TaskModel(taskCounter, _currentProject); _task.InsertSession(new TaskInfo() { Task_Id = taskCounter, TaskBoxID = taskCounter, Project = _currentProject }); tb = new TaskBox(taskCounter, _currentProject); } tb.ID = taskCounter; _tasks.Add(tb); tasksStackPanel.Children.Add(tb); taskCounter++; }