private void butListPatients_Click(object sender,EventArgs e) { ODForm form=new ODForm() { Size=new Size(500,400), Text="Other Patients List", FormBorderStyle=FormBorderStyle.FixedSingle }; ODGrid grid=new ODGrid() { Size=new Size(475,300), Location=new Point(5,5), Title="Patients", TranslationName="" }; UI.Button butClose=new UI.Button() { Size=new Size(75,23), Text="Close", Location=new Point(form.ClientSize.Width-80,form.ClientSize.Height-28),//Subtract the button's size plus 5 pixel buffer. }; butClose.Click+=(s,ex) => form.Close();//When butClose is pressed, simply close the form. If more functionality is needed, make a method below. form.Controls.Add(grid); form.Controls.Add(butClose); grid.BeginUpdate(); grid.Columns.Clear(); grid.Columns.Add(new ODGridColumn(Lan.g(this,"Name"),0)); grid.Rows.Clear(); foreach(string patName in _listPatNames) { grid.Rows.Add(new ODGridRow(patName)); } grid.EndUpdate(); form.ShowDialog(); }
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); }