private void butText_Click(object sender,EventArgs e) { long patNum; string wirelessPhone; YN txtMsgOk; if(grid.Rows.Count==0) { MsgBox.Show(this,"There are no Patients in the table. Must have at least one."); return; } if(PrefC.GetLong(PrefName.ConfirmStatusTextMessaged)==0) { MsgBox.Show(this,"You need to set a status first for confirmation text messages in the Recall Setup window."); return; } if(grid.SelectedIndices.Length==0) {//None selected. Select all of type text that are not yet confirmed by text message. ContactMethod cmeth; for(int i=0;i<Table.Rows.Count;i++) { cmeth=(ContactMethod)PIn.Int(Table.Rows[i]["PreferConfirmMethod"].ToString()); if(cmeth!=ContactMethod.TextMessage) { continue; } if(Table.Rows[i]["confirmed"].ToString()==DefC.GetName(DefCat.ApptConfirmed,PrefC.GetLong(PrefName.ConfirmStatusTextMessaged))) {//Already confirmed by text continue; } if(!Table.Rows[i]["contactMethod"].ToString().StartsWith("Text:")) {//Check contact method continue; } grid.SetSelected(i,true); } if(grid.SelectedIndices.Length==0) { MsgBox.Show(this,"All patients of text message type have been sent confirmations."); return; } } //deselect the ones that do not have text messages specified or are not OK to send texts to or have already been texted int skipped=0; for(int i=grid.SelectedIndices.Length-1;i>=0;i--) { wirelessPhone=Table.Rows[grid.SelectedIndices[i]]["WirelessPhone"].ToString(); if(wirelessPhone=="") {//Check for wireless number skipped++; grid.SetSelected(grid.SelectedIndices[i],false); continue; } txtMsgOk=(YN)PIn.Int(Table.Rows[grid.SelectedIndices[i]]["TxtMsgOk"].ToString()); if(txtMsgOk==YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)) {//Check if OK to text skipped++; grid.SetSelected(grid.SelectedIndices[i],false); continue; } if(txtMsgOk==YN.No){//Check if OK to text skipped++; grid.SetSelected(grid.SelectedIndices[i],false); continue; } } if(grid.SelectedIndices.Length==0) { MsgBox.Show(this,"None of the selected patients have wireless phone numbers and are OK to text."); return; } if(skipped>0) { MessageBox.Show(Lan.g(this,"Selected patients skipped: ")+skipped.ToString()); } if(!MsgBox.Show(this,MsgBoxButtons.YesNo,"Send text message to all of the selected patients?")) { return; } Cursor=Cursors.WaitCursor; FormTxtMsgEdit FormTME=new FormTxtMsgEdit(); string message=""; //Appointment apt; for(int i=0;i<grid.SelectedIndices.Length;i++){ patNum=PIn.Long(Table.Rows[grid.SelectedIndices[i]]["PatNum"].ToString()); wirelessPhone=PIn.String(Table.Rows[grid.SelectedIndices[i]]["WirelessPhone"].ToString()); txtMsgOk=((YN)PIn.Int(Table.Rows[grid.SelectedIndices[i]]["TxtMsgOk"].ToString())); message=PrefC.GetString(PrefName.ConfirmTextMessage); message=message.Replace("[NameF]",Table.Rows[grid.SelectedIndices[i]]["nameF"].ToString()); message=message.Replace("[NameFL]",Table.Rows[grid.SelectedIndices[i]]["nameFL"].ToString()); message=message.Replace("[date]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortDateString()); message=message.Replace("[time]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortTimeString()); FormTME.SendText(patNum,wirelessPhone,message,txtMsgOk); Appointments.SetConfirmed(PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()),PrefC.GetLong(PrefName.ConfirmStatusTextMessaged)); } FillMain(); Cursor=Cursors.Default; }
private void OnTxtMsg_Click() { FormTxtMsgEdit FormTME=new FormTxtMsgEdit(); Patient pat=Patients.GetPat(CurPatNum); FormTME.PatNum=CurPatNum; FormTME.WirelessPhone=pat.WirelessPhone; FormTME.TxtMsgOk=pat.TxtMsgOk; FormTME.ShowDialog(); if(FormTME.DialogResult==DialogResult.OK) { RefreshCurrentModule(); } }
private void butText_Click(object sender,EventArgs e) { string message; message=PrefC.GetString(PrefName.ConfirmTextMessage); message=message.Replace("[NameF]",pat.GetNameFirst()); message=message.Replace("[NameFL]",pat.GetNameFL()); message=message.Replace("[date]",AptCur.AptDateTime.ToShortDateString()); message=message.Replace("[time]",AptCur.AptDateTime.ToShortTimeString()); FormTxtMsgEdit FormTME=new FormTxtMsgEdit(); FormTME.PatNum=pat.PatNum; FormTME.WirelessPhone=pat.WirelessPhone; FormTME.Message=message; FormTME.TxtMsgOk=pat.TxtMsgOk; FormTME.ShowDialog(); }
private void butText_Click(object sender,EventArgs e) { if(Plugins.HookMethod(this,"FormApptEdit.butText_Click_start",pat,AptCur,this)) { return; } string message; message=PrefC.GetString(PrefName.ConfirmTextMessage); message=message.Replace("[NameF]",pat.GetNameFirst()); message=message.Replace("[NameFL]",pat.GetNameFL()); message=message.Replace("[date]",AptCur.AptDateTime.ToShortDateString()); message=message.Replace("[time]",AptCur.AptDateTime.ToShortTimeString()); FormTxtMsgEdit FormTME=new FormTxtMsgEdit(); FormTME.PatNum=pat.PatNum; FormTME.WirelessPhone=pat.WirelessPhone; FormTME.Message=message; FormTME.TxtMsgOk=pat.TxtMsgOk; FormTME.ShowDialog(); }