public void ShowDialogSplitCurrentProject() { List <WorktimeRecord> projects = new DialogDefineProjects().ShowDialogDistraction(ProjectHandler); if (projects != null && projects.Count > 0) { ProjectCorrectionHandler.splitCurrentProject(projects); } }
public void ShowDialogNewProject() { var newCurrentProject = new DialogDefineProjects().ShowDialogNewProject(ProjectHandler); if (newCurrentProject != null) { ProjectCorrectionHandler.addNewCurrentProject(newCurrentProject.ProjectName, newCurrentProject.Comment); } }
private void CorrectProject_Click(object sender, EventArgs e) { if (Form.correctProjectCombobox.Text == "") { MessageBox.Show("Correct Project must not be empty!"); return; } ProjectCorrectionHandler.splitCurrentProject(Form.correctProjectCombobox.Text, Form.getTrackerbarPercentage()); }
public void ShowDialogAddComment() { //new DialogDefineProjects().ShowDialogChangeCurrentProject(ProjectHandler); List <WorktimeRecord> projects = new DialogDefineProjects().ShowDialogSince(ProjectHandler); if (projects != null && projects.Count > 0) { ProjectCorrectionHandler.splitCurrentProject(projects); } }
private void grid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { var grid = Form.dataGridView1; if (e.RowIndex == Form.dataGridView1.Rows.Count - 1 && currentProjectVisible()) { if (grid.Columns[e.ColumnIndex].Name == "Comment") { ProjectCorrectionHandler.changeCurrentProject( grid.Rows[e.RowIndex].Cells["Project"].Value.ToString(), grid.Rows[e.RowIndex].Cells["Comment"].Value.ToString()); } return; } try { var date = DateTime.Parse(grid.Rows[e.RowIndex].Cells["Date"].Value.ToString()); var startTime = DateTime.Parse(date.Date.ToString().Substring(0, 10) + " " + grid.Rows[e.RowIndex].Cells["StartTime"].Value.ToString()); var startDateTime = date.Date.Add(startTime.TimeOfDay); var endTime = DateTime.Parse(date.Date.ToString().Substring(0, 10) + " " + grid.Rows[e.RowIndex].Cells["EndTime"].Value.ToString()); var endDateTime = date.Date.Add(endTime.TimeOfDay); //TODO compensate date for overnighters var index = Convert.ToInt32(grid.Rows[e.RowIndex].Cells["Index"].Value); if (grid.Columns[e.ColumnIndex].Name == "StartTime") //TODO consts oder so { storage.ChangeStartTime(index, startTime); } if (grid.Columns[e.ColumnIndex].Name == "EndTime") { storage.ChangeEndTime(index, endTime); } if (grid.Columns[e.ColumnIndex].Name == "Project") { storage.ChangeProjectName(index, grid.Rows[e.RowIndex].Cells["Project"].Value.ToString()); } if (grid.Columns[e.ColumnIndex].Name == "Comment") { storage.ChangeProjectComment(index, grid.Rows[e.RowIndex].Cells["Comment"].Value?.ToString() ?? ""); } } catch (Exception ex) { //We basically have 2 different forms of validation with this (see CellValidating), but it is apparently not possible //to trigger any e.Cancel in CellValueChanged and there appears to be no really pretty way to uncouple the validation logic //in the data storage from the actually storing the value - I decided that, until there is no better implementation with //a data binding, that i don't care MessageBox.Show(ex.Message, "Validation Error"); } refreshGrid(); }
public Tuple <DateTime, DateTime> getProjectCorrections(float percentage) { //TODO errorhandling return(ProjectCorrectionHandler.getCurrentProjectCorrectedTimes(percentage)); }