///<summary>Will return the UserOdPref corresponding to the usernum/fkey/fkeytype/ClinicNum composite key given.</summary> public static UserOdPref GetByCompositeKey(long userNum, long fkey, UserOdFkeyType fkeyType, long clinicNum = 0) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <UserOdPref>(MethodBase.GetCurrentMethod(), userNum, fkey, fkeyType, clinicNum)); } string command = "SELECT * FROM userodpref WHERE UserNum=" + POut.Long(userNum) + " AND Fkey=" + POut.Long(fkey) + " AND FkeyType=" + POut.Int((int)fkeyType) + " AND ClinicNum=" + POut.Long(clinicNum); return(ODMethodsT.Coalesce( //Get the db value if it exists. Crud.UserOdPrefCrud.SelectOne(command), //Create a new instance if db value does not exist. new UserOdPref() { IsNew = true, UserOdPrefNum = 0, Fkey = fkey, FkeyType = fkeyType, UserNum = userNum, ValueString = "", ClinicNum = clinicNum, })); }
///<summary>Thread was started on form load and must exit with no errors in order to continue modifying clinics pref. ///Call this method to assure that this method has returned ok. Throws exceptions if failed or returns if ok.</summary> private void ValidateHqValidationComplete() { if (_threadSignupPortal != null || _signupException != null || _signupOut == null) { throw ODMethodsT.Coalesce(_signupException, new Exception(Lan.g(this, "Unknown error while trying to evaluate eService signups. Please try again later."))); } }
///<summary>Replaces the template with the passed in arguments.</summary> public static string ReplacesTemplateTags(string template, long clinicNum = -1, DateTime dateTime = new DateTime(), string nameF = null, string asapUrl = null) { StringBuilder newTemplate = new StringBuilder(); newTemplate.Append(template); //Note: RegReplace is case insensitive by default. if (dateTime.Year > 1880) { newTemplate.RegReplace("\\[Date]", dateTime.ToString(PrefC.PatientCommunicationDateFormat)); newTemplate.RegReplace("\\[Time]", dateTime.ToShortTimeString()); } if (clinicNum > -1) { Clinic clinic = ODMethodsT.Coalesce(Clinics.GetClinic(clinicNum), Clinics.GetPracticeAsClinicZero()); newTemplate.RegReplace("\\[OfficeName]", clinic.Description); newTemplate.RegReplace("\\[OfficePhone]", clinic.Phone); } if (nameF != null) { newTemplate.RegReplace("\\[NameF]", nameF); } if (asapUrl != null) { newTemplate.RegReplace("\\[AsapURL]", asapUrl); } return(newTemplate.ToString()); }
private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones) { try { escalationView.BeginUpdate(); escalationView.Items.Clear(); escalationView.DictProximity.Clear(); escalationView.DictShowExtension.Clear(); escalationView.DictExtensions.Clear(); escalationView.DictWebChat.Clear(); escalationView.DictGTAChat.Clear(); if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex)) { escalationView.IsNewItems = true; escalationView.Tag = tabMain.SelectedIndex; } List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones)); List <PhoneEmpDefault> listSorted = SortForEscalationView(listFiltered, phones); if (_listChatUsers == null) { _listChatUsers = ChatUsers.GetAll(); } if (_listWebChatSessions == null) { _listWebChatSessions = WebChatSessions.GetActiveSessions(); } for (int i = 0; i < listSorted.Count; i++) { PhoneEmpDefault ped = listSorted[i]; Phone phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum)); escalationView.Items.Add(ped.EmpName); //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room. escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible)); WebChatSession webChatSession = _listWebChatSessions.FirstOrDefault(x => x.TechName == phone.EmployeeName); if (webChatSession != null) { escalationView.DictWebChat.Add(ped.EmpName, true); escalationView.DictGTAChat.Add(ped.EmpName, false); } else { escalationView.DictWebChat.Add(ped.EmpName, false); escalationView.DictGTAChat.Add(ped.EmpName, _listChatUsers.FindAll(x => x.Extension == ped.PhoneExt && x.CurrentSessions > 0).Count > 0); } //Extensions will always show for both locations unless the employee is not proximal. escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible); escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt); } } catch { } finally { escalationView.EndUpdate(); } }
public static void SendData(Program ProgramCur, Patient pat) { try { if (CADIWindow == null) //Only release this reference once the CADIWindow instance has closed. { CADIWindow = new CADINativeWindow(new Action(() => CADIWindow = null)); } CADIWindow.SendData(ProgramCur, pat); } catch (Exception e) { MessageBox.Show(e.Message); SecurityLogs.MakeLogEntry(Permissions.ChartModule, ODMethodsT.Coalesce(pat).PatNum, e.Message); } }
///<summary>Sorts the list of PhoneEmpDefaults in the appropriate way for the selected escalation view.</summary> private List <PhoneEmpDefault> SortForEscalationView(List <PhoneEmpDefault> peds, List <Phone> phones) { if (_curSubGroupType == PhoneEmpSubGroupType.Avail) { Func <PhoneEmpDefault, Phone> getPhone = new Func <PhoneEmpDefault, Phone>((phoneEmpDef) => { return(ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, phoneEmpDef.EmployeeNum))); }); return(peds.OrderBy(x => getPhone(x).ClockStatus != ClockStatusEnum.Available) //Show Available first .ThenBy(x => getPhone(x).ClockStatus != ClockStatusEnum.Training) //Training next .ThenBy(x => getPhone(x).ClockStatus != ClockStatusEnum.Backup) //Backup next .ThenBy(x => getPhone(x).DateTimeStart.Year < 1880) //Show people who have an actual DateTimeStart first .ThenBy(x => getPhone(x).DateTimeStart) //Show those first who have been in this status longest .ToList()); } //All other escalation views beside Avail return(peds.OrderBy(x => x.EscalationOrder) //Show people at the selected location first .ThenBy(x => x.EmpName).ToList()); }
private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones) { try { escalationView.BeginUpdate(); escalationView.Items.Clear(); escalationView.DictProximity.Clear(); escalationView.DictShowExtension.Clear(); escalationView.DictExtensions.Clear(); escalationView.DictColors.Clear(); if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex)) { escalationView.IsNewItems = true; escalationView.Tag = tabMain.SelectedIndex; } List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones)); List <PhoneEmpDefault> listSorted = SortForEscalationView(listFiltered, phones); for (int i = 0; i < listSorted.Count; i++) { PhoneEmpDefault ped = listSorted[i]; Phone phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum)); escalationView.Items.Add(ped.EmpName); //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room. escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible)); //Extensions will always show for both locations unless the employee is not proximal. escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible); escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt); if (_mapCur.SiteNum != ped.SiteNum) { escalationView.DictColors.Add(ped.EmpName, SiteLinks.GetSiteColorBySiteNum(ped.SiteNum, escalationView.BackColor)); } } } catch { } finally { escalationView.EndUpdate(); } }
private void FillGrid() { if (_listAsapCommHists == null || datePicker.GetDateTimeFrom() < _prevDateFrom || datePicker.GetDateTimeTo() > _prevDateTo || comboClinic.ListSelectedClinicNums.Any(x => !x.In(_prevSelectedClinicNums))) { //The user is asking for data that we have not fetched yet. GetData(); } bool isClinicsEnabled = PrefC.HasClinicsEnabled; List <AsapComms.AsapCommHist> listHist = _listAsapCommHists.Where(x => x.AsapComm.DateTimeEntry .Between(datePicker.GetDateTimeFrom(), datePicker.GetDateTimeTo())) .Where(x => !isClinicsEnabled || x.AsapComm.ClinicNum.In(comboClinic.ListSelectedClinicNums)).ToList(); gridHistory.BeginUpdate(); gridHistory.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g(this, "Patient"), 120); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Status"), 120); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "SMS Send Time"), 140); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Email Send Time"), 140); gridHistory.Columns.Add(col); if (PrefC.HasClinicsEnabled) { col = new ODGridColumn(Lan.g(this, "Clinic"), 120); gridHistory.Columns.Add(col); } col = new ODGridColumn(Lan.g(this, "Original Appt Time"), 140); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Slot Start"), 140); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Slot Stop"), 140); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Date Entry"), 140); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "SMS Message Text"), 250); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Email Message Text"), 250); gridHistory.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Note"), 250); gridHistory.Columns.Add(col); gridHistory.Rows.Clear(); foreach (AsapComms.AsapCommHist asapHist in listHist) { ODGridRow row = new ODGridRow(); row.Cells.Add(asapHist.PatientName); row.Cells.Add(Lan.g(this, asapHist.AsapComm.ResponseStatus.GetDescription())); string smsSent; if (asapHist.AsapComm.SmsSendStatus == AutoCommStatus.SendSuccessful) { smsSent = asapHist.AsapComm.DateTimeSmsSent.ToString(); } else if (asapHist.AsapComm.SmsSendStatus == AutoCommStatus.SendNotAttempted) { smsSent = asapHist.AsapComm.DateTimeSmsScheduled.ToString(); } else { smsSent = ""; } row.Cells.Add(smsSent); string emailSent; if (asapHist.AsapComm.EmailSendStatus == AutoCommStatus.SendSuccessful) { emailSent = asapHist.AsapComm.DateTimeEmailSent.ToString(); } else { emailSent = ""; } row.Cells.Add(emailSent); if (PrefC.HasClinicsEnabled) { row.Cells.Add(ODMethodsT.Coalesce(Clinics.GetClinic(asapHist.AsapComm.ClinicNum)).Abbr); } row.Cells.Add(asapHist.AsapComm.DateTimeOrig.Year > 1880 ? asapHist.AsapComm.DateTimeOrig.ToString() : ""); row.Cells.Add(asapHist.DateTimeSlotStart.ToString()); row.Cells.Add(asapHist.DateTimeSlotEnd.ToString()); row.Cells.Add(asapHist.AsapComm.DateTimeEntry.ToString()); row.Cells.Add(asapHist.SMSMessageText); row.Cells.Add(asapHist.EmailMessageText); row.Cells.Add(asapHist.AsapComm.Note); row.Tag = asapHist; gridHistory.Rows.Add(row); } gridHistory.EndUpdate(); textFilled.Text = listHist.Select(x => x.AsapComm) .Where(x => x.ResponseStatus == AsapRSVPStatus.AcceptedAndMoved) .DistinctBy(x => x.FKey).Count().ToString(); textTextsSent.Text = listHist.Select(x => x.AsapComm) .Where(x => x.SmsSendStatus == AutoCommStatus.SendSuccessful) .DistinctBy(x => x.GuidMessageToMobile).Count().ToString(); }
///<summary>Validates that PrefName.EasyNoClinics is ok to be changed and changes it when necessary. Tells HQ about changes and re-syncs with new HQ clinic preference for this practice. ///If fails then restores checkEnableClinics to original value when form was opened.</summary> private bool IsClinicCheckBoxOk() { try { if (!_hasClinicsEnabledChanged) //No change. { return(true); } //Make sure signup info was retrieved from HQ. ValidateHqValidationComplete(); //Find any eServices that HQ says are enabled. var clinicsEnabled = _signupOut.EServices .FindAll(x => x.IsEnabled) .GroupBy(x => x.ClinicNum) .ToList(); //Build the prompt. string prompt = ""; foreach (var clinicEnabled in clinicsEnabled) { if (clinicEnabled.Key != 0) { prompt += ODMethodsT.Coalesce(Clinics.GetFirstOrDefault(x => x.ClinicNum == clinicEnabled.Key) , new Clinic() { Abbr = "Undefined Clinic" }).Abbr + "\r\n"; } else { prompt += Lan.g(this, "Practice") + "\r\n"; } //If bundle then don't show others. if (clinicEnabled.Any(x => x.EService == eServiceCode.Bundle)) { prompt += " - " + eServiceCode.Bundle.GetDescription() + "\r\n"; } else //Show all enabled eServices. { foreach (var eService in clinicEnabled.ToList()) { prompt += " - " + eService.EService.GetDescription() + "\r\n"; } } } //Prompt and take action when necessary. if (!string.IsNullOrEmpty(prompt)) { if (checkEnableClinics.Checked) //Will be switching clinics on. { prompt = Lan.g(this, "Your eServices will need to be reassigned to your clinics once you have created at least one clinic.") + "\r\n\r\n" + Lan.g(this, "Once have created at least one clinic, please visit the Signup Portal using eServices | Signup in order to make the appropriate changes to your service agreement.") + "\r\n\r\n" + Lan.g(this, "You are currently subscribed to the following eServices. Click OK to continue.") + "\r\n\r\n" + prompt; } else //Will be switching clinics off. { prompt = Lan.g(this, "Your eServices will all be transferred from individual clinics to your practice.") + "\r\n\r\n" + Lan.g(this, "Once you approve this change, please visit the Signup Portal using eServices | Signup in order to verify the changes to your service agreement are correct.") + "\r\n\r\n" + Lan.g(this, "You are currently subscribed to the following eServices. Click OK to approve this change.") + "\r\n\r\n" + prompt; } if (MessageBox.Show(prompt, "", MessageBoxButtons.OKCancel) != DialogResult.OK) { throw new Exception(Lan.g(this, "Clinic feature modification canceled")); } } //Turn clinics on/off locally and send the signal to other workstations. This must happen before we call HQ so we tell HQ the new value. Prefs.UpdateBool(PrefName.EasyNoClinics, !checkEnableClinics.Checked); DataValid.SetInvalid(InvalidType.Prefs); //This call will perform the changes to the local clinic pref at HQ. It will also re-sync local prefs and table infor HQ's info. WebServiceMainHQProxy.GetEServiceSetupFull(SignupPortalPermission.FullPermission, true); return(true); } catch (Exception ex) { //Change it back to what the db has. RestoreClinicCheckBox(); MessageBox.Show(ex.Message); return(false); } }