private void timerRefreshAll_Tick(object sender, EventArgs e) { timerRefreshAll.Stop(); _jobSprintCur = JobSprints.GetOne(_jobSprintCur.JobSprintNum); //Get the latest version from the database RefreshAll(); timerRefreshAll.Start(); }
private bool SaveJobSprint() { if (textDateStart.errorProvider1.GetError(textDateStart) != "" || textDateEnd.errorProvider1.GetError(textDateEnd) != "" || textEngJobPercent.errorProvider1.GetError(textEngJobPercent) != "" || textAvgDevelopmentHours.errorProvider1.GetError(textAvgDevelopmentHours) != "" || textBreakHours.errorProvider1.GetError(textBreakHours) != "") { MsgBox.Show(this, "Please fix sprint settings before saving."); return(false); } _jobSprintCur.Title = textTitle.Text; _jobSprintCur.DateStart = PIn.Date(textDateStart.Text); _jobSprintCur.DateEndTarget = PIn.Date(textDateEnd.Text); _jobSprintCur.JobPercent = PIn.Double(textEngJobPercent.Text); _jobSprintCur.HoursAverageDevelopment = PIn.Double(textAvgDevelopmentHours.Text); _jobSprintCur.HoursAverageBreak = PIn.Double(textBreakHours.Text); _jobSprintCur.Note = textNote.Text; JobSprints.Update(_jobSprintCur); _hasUnsavedChanges = false; if (SaveClick != null) { SaveClick(this, new EventArgs()); } return(true); }
private void gridSprints_TitleAddClick(object sender, EventArgs e) { JobSprint jobSprintNew = new JobSprint(); jobSprintNew.Title = "Version"; jobSprintNew.Note = ""; jobSprintNew.DateStart = DateTime.Today; jobSprintNew.DateEndTarget = DateTime.Today.AddDays(70);//Add 10 weeks jobSprintNew.DateEndActual = DateTime.MinValue; jobSprintNew.JobPercent = 0.173; jobSprintNew.HoursAverageDevelopment = 9.43; jobSprintNew.HoursAverageBreak = 0.85; JobSprints.Insert(jobSprintNew); FillGridSprints(); userControlSprintManager.LoadSprint(jobSprintNew, _listJobsAll); FillGridEngineers(userControlSprintManager.JobSprintCur); }
private void FillGridSprints() { gridSprints.BeginUpdate(); gridSprints.ListGridColumns.Clear(); gridSprints.ListGridColumns.Add(new GridColumn("Start Date", 70)); gridSprints.ListGridColumns.Add(new GridColumn("Title", 50)); gridSprints.ListGridRows.Clear(); foreach (JobSprint sprint in JobSprints.GetAll().OrderByDescending(x => x.DateStart)) { GridRow row = new GridRow() { Tag = sprint }; row.Cells.Add(sprint.DateStart.ToShortDateString()); row.Cells.Add(sprint.Title.ToString()); gridSprints.ListGridRows.Add(row); } gridSprints.EndUpdate(); }
private void FillGrid() { List <JobSprint> listJobSprints = JobSprints.GetAll(); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridRows.Clear(); gridMain.ListGridColumns.Add(new GridColumn("Date Start", 70, HorizontalAlignment.Center, GridSortingStrategy.DateParse)); gridMain.ListGridColumns.Add(new GridColumn("Date End", 70, HorizontalAlignment.Center, GridSortingStrategy.DateParse)); gridMain.ListGridColumns.Add(new GridColumn("Title", 0)); foreach (JobSprint jobSprint in listJobSprints) { gridMain.ListGridRows.Add( new GridRow( new GridCell(jobSprint.DateStart.ToShortDateString()), new GridCell(jobSprint.DateEndTarget.ToShortDateString()), new GridCell(jobSprint.Title)) { Tag = jobSprint } ); } gridMain.EndUpdate(); }
private void gridSprints_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } ContextMenu menu = new ContextMenu(); menu.MenuItems.Add("Remove Sprint", (o, arg) => { int selectedIndex = gridSprints.GetSelectedIndex(); if (selectedIndex == -1) { return; //Nothing to remove. } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will permanently delete this sprint. Continue?")) { return; } long sprintNum = ((JobSprint)gridSprints.ListGridRows[selectedIndex].Tag).JobSprintNum; userControlSprintManager.Enabled = false; JobSprints.Delete(sprintNum); FillGridSprints(); }); menu.MenuItems.Add("Copy Sprint", (o, arg) => { int selectedIndex = gridSprints.GetSelectedIndex(); if (selectedIndex == -1) { return; //Nothing to copy. } JobSprint sprint = ((JobSprint)gridSprints.ListGridRows[selectedIndex].Tag); sprint.Title += "_Copy"; List <JobSprintLink> listSprintLinks = JobSprintLinks.GetForSprint(sprint.JobSprintNum); JobSprints.Insert(sprint); foreach (JobSprintLink sprintLink in listSprintLinks) { sprintLink.JobSprintNum = sprint.JobSprintNum; JobSprintLinks.Insert(sprintLink); } FillGridSprints(); userControlSprintManager.LoadSprint(sprint, _listJobsAll); }); menu.MenuItems.Add("End Sprint", (o, arg) => { int selectedIndex = gridSprints.GetSelectedIndex(); if (selectedIndex == -1) { return; //Nothing to end. } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will set the sprints actual end date to today. Continue?")) { return; } JobSprint sprint; //This gets the most recent sprint instance to save and unloads it so we can load it in if (!userControlSprintManager.Enabled || !userControlSprintManager.UnloadSprint(out sprint)) { return; } else { sprint = ((JobSprint)gridSprints.ListGridRows[selectedIndex].Tag); } sprint.DateEndActual = DateTime.Today; JobSprints.Update(sprint); FillGridSprints(); userControlSprintManager.LoadSprint(sprint, _listJobsAll); FillGridEngineers(userControlSprintManager.JobSprintCur); }); menu.Show(gridSprints, gridSprints.PointToClient(Cursor.Position)); }