private void butOK_Click(object sender, EventArgs e) { if (!ValidateTitle()) { return; } if (!ValidateJob()) { return; } _jobNew.JobVersion = textVersion.Text; _jobNew.Requirements = textConcept.MainRtf; long jobNum = Jobs.Insert(_jobNew); foreach (JobLink link in _listJobLinks) { link.JobNum = jobNum; JobLinks.Insert(link); } foreach (JobQuote quote in _listJobQuotes) { quote.JobNum = jobNum; JobQuotes.Insert(quote); } DialogResult = DialogResult.OK; }
private void butLinkTask_Click(object sender, EventArgs e) { FormTaskSearch FormTS = new FormTaskSearch(); FormTS.IsSelectionMode = true; if (FormTS.ShowDialog() == DialogResult.OK) { JobLink jobLink = new JobLink(); jobLink.JobNum = _jobNum; jobLink.FKey = FormTS.SelectedTaskNum; jobLink.LinkType = JobLinkType.Task; JobLinks.Insert(jobLink); _jobLinks = JobLinks.GetJobLinks(_jobNum); _hasChanged = true; FillGrid(); } }
private void butLinkFeatReq_Click(object sender, EventArgs e) { FormFeatureRequest FormFR = new FormFeatureRequest(); FormFR.IsSelectionMode = true; FormFR.ShowDialog(); if (FormFR.DialogResult == DialogResult.OK) { JobLink jobLink = new JobLink(); jobLink.JobNum = _jobNum; jobLink.FKey = FormFR.SelectedFeatureNum; jobLink.LinkType = JobLinkType.Request; JobLinks.Insert(jobLink); _jobLinks = JobLinks.GetJobLinks(_jobNum); _hasChanged = true; FillGrid(); } }
public static Bug AddBugAndJob(ODForm form, List <BugSubmission> listSelectedSubs, Patient pat) { if (!JobPermissions.IsAuthorized(JobPerm.Concept, true) && !JobPermissions.IsAuthorized(JobPerm.NotifyCustomer, true) && !JobPermissions.IsAuthorized(JobPerm.FeatureManager, true) && !JobPermissions.IsAuthorized(JobPerm.Documentation, true)) { return(null); } if (listSelectedSubs.Count == 0) { MsgBox.Show(form, "You must select a bug submission to create a job for."); return(null); } Job jobNew = new Job(); jobNew.Category = JobCategory.Bug; InputBox titleBox = new InputBox("Provide a brief title for the job."); if (titleBox.ShowDialog() != DialogResult.OK) { return(null); } if (String.IsNullOrEmpty(titleBox.textResult.Text)) { MsgBox.Show(form, "You must type a title to create a job."); return(null); } List <Def> listJobPriorities = Defs.GetDefsForCategory(DefCat.JobPriorities, true); if (listJobPriorities.Count == 0) { MsgBox.Show(form, "You have no priorities setup in definitions."); return(null); } jobNew.Title = titleBox.textResult.Text; long priorityNum = 0; priorityNum = listJobPriorities.FirstOrDefault(x => x.ItemValue.Contains("BugDefault")).DefNum; jobNew.Priority = priorityNum == 0?listJobPriorities.First().DefNum:priorityNum; jobNew.PhaseCur = JobPhase.Concept; jobNew.UserNumConcept = Security.CurUser.UserNum; Bug bugNew = new Bug(); bugNew = Bugs.GetNewBugForUser(); InputBox bugDescription = new InputBox("Provide a brief description for the bug. This will appear in the bug tracker.", jobNew.Title); if (bugDescription.ShowDialog() != DialogResult.OK) { return(null); } if (String.IsNullOrEmpty(bugDescription.textResult.Text)) { MsgBox.Show(form, "You must type a description to create a bug."); return(null); } FormVersionPrompt FormVP = new FormVersionPrompt("Enter versions found"); FormVP.ShowDialog(); if (FormVP.DialogResult != DialogResult.OK || string.IsNullOrEmpty(FormVP.VersionText)) { MsgBox.Show(form, "You must enter a version to create a bug."); return(null); } bugNew.Status_ = BugStatus.Accepted; bugNew.VersionsFound = FormVP.VersionText; bugNew.Description = bugDescription.textResult.Text; BugSubmission sub = listSelectedSubs.First(); jobNew.Requirements = BugSubmissions.GetSubmissionDescription(pat, sub); Jobs.Insert(jobNew); JobLink jobLinkNew = new JobLink(); jobLinkNew.LinkType = JobLinkType.Bug; jobLinkNew.JobNum = jobNew.JobNum; jobLinkNew.FKey = Bugs.Insert(bugNew); JobLinks.Insert(jobLinkNew); BugSubmissions.UpdateBugIds(bugNew.BugId, listSelectedSubs.Select(x => x.BugSubmissionNum).ToList()); if (MsgBox.Show(form, MsgBoxButtons.YesNo, "Would you like to create a task too?")) { long taskNum = CreateTask(pat, sub); if (taskNum != 0) { jobLinkNew = new JobLink(); jobLinkNew.LinkType = JobLinkType.Task; jobLinkNew.JobNum = jobNew.JobNum; jobLinkNew.FKey = taskNum; JobLinks.Insert(jobLinkNew); } } Signalods.SetInvalid(InvalidType.Jobs, KeyType.Job, jobNew.JobNum); FormOpenDental.S_GoToJob(jobNew.JobNum); return(bugNew); }