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); }
///<summary>Returns true if the VM was successfully sent to self.</summary> private bool SendToMe() { if (gridVoiceMails.SelectedCell.Y == -1 || gridVoiceMails.ListGridRows.Count <= gridVoiceMails.SelectedCell.Y) { return(false); } VoiceMail voiceMailCur = (VoiceMail)gridVoiceMails.ListGridRows[gridVoiceMails.SelectedCell.Y].Tag; VoiceMail voiceMailOld = voiceMailCur.Copy(); if (voiceMailCur.UserNum == Security.CurUser.UserNum) //Trying to send a VM to themselves that is already theirs { return(true); //Save a couple trips to the database } VoiceMail voiceMailUpdated = VoiceMails.GetOne(voiceMailCur.VoiceMailNum); if (voiceMailUpdated == null || voiceMailCur.StatusVM == VoiceMailStatus.Deleted) { MsgBox.Show(this, "This voice mail has been deleted."); FillGrid(); return(false); } DateTime dateTimeNow = MiscData.GetNowDateTime(); if ((voiceMailCur.UserNum == 0 && //The tech is trying to send an unclaimed VM to themselves. voiceMailUpdated.UserNum != 0) || //Someone else has already claimed it. voiceMailUpdated.DateClaimed > dateTimeNow.AddSeconds(-8)) //Someone has claimed it in the last 8 seconds { MsgBox.Show(this, "This voice mail has just been claimed by someone else."); FillGrid(); return(false); } if (voiceMailUpdated.UserNum != 0 && !MsgBox.Show(this, MsgBoxButtons.YesNo, "This voice mail has been claimed by someone else. Are you sure you want to send it to yourself?")) { return(false); } voiceMailCur.UserNum = Security.CurUser.UserNum; voiceMailCur.DateClaimed = dateTimeNow; VoiceMails.Update(voiceMailCur, voiceMailOld); Signalods.Insert(new Signalod { IType = InvalidType.VoiceMails }); FillGrid(); return(true); }
private void gridVoiceMails_CellLeave(object sender, ODGridClickEventArgs e) { if (gridVoiceMails.ListGridColumns[e.Col].Tag.ToString() != nameof(VoiceMail.Note)) { return; } VoiceMail voiceMailCur = (VoiceMail)gridVoiceMails.ListGridRows[e.Row].Tag; VoiceMail voiceMailOld = voiceMailCur.Copy(); voiceMailCur.Note = gridVoiceMails.GetText(e.Row, e.Col); VoiceMails.Update(voiceMailCur, voiceMailOld); if (voiceMailCur.Note != voiceMailOld.Note) { Signalods.Insert(new Signalod { IType = InvalidType.VoiceMails }); } }