private void PauseWorkOnProject(bool stopWorkOnProject = false) { if (currentProject == null) { throw new Exception("No project selected"); } if (state == MainFormState.WorkingOnProjectState) { ProjectLog log = new ProjectLog(); log.ProjectId = currentProject.ProjectId; log.StartDate = lastTimeStarted; log.EndDate = DateTime.Now; ResetTimer(); log.UserId = loggedInUserId; log.Description = descriptionTextBox.Text; projectLogRepository.Save(log); currentProject.EndDate = log.EndDate; SaveScreenShots(log); } currentProject.IsInProgress = !stopWorkOnProject; projectRepository.Save(currentProject); state = MainFormState.ProjectPausedState; ResetProjectsGrid(); ResetTimer(); screenShots.Clear(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { ProjectLog projectLog = ProjectLogView.Rows[e.RowIndex].DataBoundItem as ProjectLog; ProjectLogDetailsForm projectLogDetailsForm = new ProjectLogDetailsForm(projectLog); projectLogDetailsForm.Show(); } }
private void SaveScreenShots(ProjectLog log) { if (screenShots == null || screenShots.Count <= 0) { return; } FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.SelectedPath = DEFAULT_SCREEN_SHOT_FOLDER; dialog.Description = "Select where to save your screen shots"; if (dialog.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(dialog.SelectedPath)) { foreach (Bitmap screenShot in screenShots) { string path = dialog.SelectedPath + @"\" + "Screen Shot_" + Guid.NewGuid() + ".png"; screenShot.Save(path); Screenshots screenShotdata = new Screenshots(); screenShotdata.Location = path; screenShotdata.ProjectLogId = log.ProjectLogId; screenShotRepository.Save(screenShotdata); } } }