Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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));
        }