private void butNewTask_Click(object sender, EventArgs e) { FormTaskListSelect FormTLS = new FormTaskListSelect(TaskObjectType.Patient); FormTLS.Text = Lan.g(FormTLS, "Add Task") + " - " + FormTLS.Text; FormTLS.ShowDialog(); if (FormTLS.DialogResult != DialogResult.OK || FormTLS.ListSelectedLists[0] == 0) { return; } Task task = new Task() { TaskListNum = -1 }; //don't show it in any list yet. Tasks.Insert(task); Task taskOld = task.Copy(); task.UserNum = Security.CurUser.UserNum; task.TaskListNum = FormTLS.ListSelectedLists[0]; FormTaskEdit FormTE = new FormTaskEdit(task, taskOld); FormTE.IsNew = true; FormTE.ShowDialog(); //modal if (FormTE.DialogResult != DialogResult.OK) { return; } SelectedTaskNum = task.TaskNum; DialogResult = DialogResult.OK; Close(); }
public static long CreateTask(Patient pat, BugSubmission sub) { //Button is only enabled if _patCur is not null (user has 1 row selected). //Mimics FormOpenDental.OnTask_Click() FormTaskListSelect FormT = new FormTaskListSelect(TaskObjectType.Patient); //FormT.Location=new Point(50,50); FormT.Text = Lan.g(FormT, "Add Task") + " - " + FormT.Text; FormT.ShowDialog(); if (FormT.DialogResult != DialogResult.OK) { return(0); } Task task = new Task(); task.TaskListNum = -1; //don't show it in any list yet. Tasks.Insert(task); Task taskOld = task.Copy(); task.KeyNum = pat.PatNum; task.ObjectType = TaskObjectType.Patient; task.TaskListNum = FormT.ListSelectedLists[0]; task.UserNum = Security.CurUser.UserNum; //Mimics the ?bug quick note at HQ. task.Descript = BugSubmissions.GetSubmissionDescription(pat, sub); FormTaskEdit FormTE = new FormTaskEdit(task, taskOld); FormTE.IsNew = true; FormTE.ShowDialog(); return(task.TaskNum); }
private void CreateTask() { if (gridVoiceMails.SelectedCell.Y == -1 || gridVoiceMails.Rows.Count <= gridVoiceMails.SelectedCell.Y) { MsgBox.Show(this, "No voice mail selected"); return; } VoiceMail voiceMailCur = (VoiceMail)gridVoiceMails.Rows[gridVoiceMails.SelectedCell.Y].Tag; VoiceMail voiceMailOld = voiceMailCur.Copy(); if (voiceMailCur.PatNum == 0) //Multiple patients had a match for the phone number { FormPatientSelect FormPS = new FormPatientSelect(new Patient { HmPhone = voiceMailCur.PhoneNumber }); if (FormPS.ShowDialog() != DialogResult.OK) { return; } voiceMailCur.PatNum = FormPS.SelectedPatNum; VoiceMails.Update(voiceMailCur, voiceMailOld); FillGrid(); } Task task = new Task() { TaskListNum = -1 }; //don't show it in any list yet. Tasks.Insert(task); Task taskOld = task.Copy(); task.UserNum = Security.CurUser.UserNum; task.TaskListNum = Tasks.TriageTaskListNum; task.DateTimeEntry = voiceMailCur.DateCreated; task.PriorityDefNum = Tasks.TriageBlueNum; task.ObjectType = TaskObjectType.Patient; task.KeyNum = voiceMailCur.PatNum; task.Descript = "VM " + TelephoneNumbers.AutoFormat(voiceMailCur.PhoneNumber) + " "; FormTaskEdit FormTE = new FormTaskEdit(task, taskOld); FormTE.IsNew = true; FormTE.Show(); //non-modal FormTE.BringToFront(); //The reason the below line didn't work is because popups would appear behind the task. //FormTE.TopMost=true;//For some techs, when they open a task from this window, it goes behind all the other windows. This is an attempted fix. }
///<summary>Returns true if a task was inserted into the DB, when true formTaskEdit is set. Otherwise null.</summary> private bool TryCreateTaskAndForm(out FormTaskEdit formTaskEdit) { formTaskEdit = null; if (gridVoiceMails.SelectedCell.Y == -1 || gridVoiceMails.ListGridRows.Count <= gridVoiceMails.SelectedCell.Y) { MsgBox.Show(this, "No voice mail selected"); return(false); } VoiceMail voiceMailCur = (VoiceMail)gridVoiceMails.ListGridRows[gridVoiceMails.SelectedCell.Y].Tag; VoiceMail voiceMailOld = voiceMailCur.Copy(); if (voiceMailCur.PatNum == 0) //Multiple patients had a match for the phone number { FormPatientSelect FormPS = new FormPatientSelect(new Patient { HmPhone = voiceMailCur.PhoneNumber }); if (FormPS.ShowDialog() != DialogResult.OK) { return(false); } voiceMailCur.PatNum = FormPS.SelectedPatNum; VoiceMails.Update(voiceMailCur, voiceMailOld); FillGrid(); } Task task = new Task() { TaskListNum = -1 }; //don't show it in any list yet. Tasks.Insert(task); Task taskOld = task.Copy(); task.UserNum = Security.CurUser.UserNum; task.TaskListNum = Tasks.TriageTaskListNum; task.DateTimeEntry = voiceMailCur.DateCreated; task.PriorityDefNum = Tasks.TriageBlueNum; task.ObjectType = TaskObjectType.Patient; task.KeyNum = voiceMailCur.PatNum; task.Descript = "VM " + TelephoneNumbers.AutoFormat(voiceMailCur.PhoneNumber) + " "; FormTaskEdit FormTE = new FormTaskEdit(task, taskOld); FormTE.IsNew = true; formTaskEdit = FormTE; return(true); }