private void FillTabPatientPortal()
 {
     //Office may have set a customer URL
     textPatientFacingUrlPortal.Text = PrefC.GetString(PrefName.PatientPortalURL);
     //HQ provides this URL for this customer.
     WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService urlsFromHQ = WebServiceMainHQProxy.GetSignups <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(_signupOut, eServiceCode.PatientPortal).FirstOrDefault() ?? new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService()
     {
         HostedUrl = "", HostedUrlPayment = ""
     };
     textHostedUrlPortal.Text        = urlsFromHQ.HostedUrl;
     textHostedUrlPortalPayment.Text = urlsFromHQ.HostedUrlPayment;
     if (textPatientFacingUrlPortal.Text == "")            //Customer has not set their own URL so use the URL provided by OD.
     {
         textPatientFacingUrlPortal.Text = urlsFromHQ.HostedUrl;
     }
     textBoxNotificationSubject.Text = PrefC.GetString(PrefName.PatientPortalNotifySubject);
     textBoxNotificationBody.Text    = PrefC.GetString(PrefName.PatientPortalNotifyBody);
     _listPatPortalInviteRules       = ApptReminderRules.GetForTypes(ApptReminderType.PatientPortalInvite);
     if (PrefC.HasClinicsEnabled)
     {
         _clinicCurPPInvite = comboClinicsPPInvites.SelectedTag <Clinic>();
     }
     else
     {
         _clinicCurPPInvite                = Clinics.GetPracticeAsClinicZero();
         labelClinicPPInvites.Visible      = false;
         checkUseDefaultsPPInvites.Visible = false;
         checkIsPPInvitesEnabled.Visible   = false;
     }
     FillPatPortalInvites();
 }
예제 #2
0
        private void FillComboClinic()
        {
            //Not using ComboBoxClinicPicker because we need to add a blank "" for no selection logic when procedures have different clinics.
            comboClinic.Items.Clear();
            comboClinic.Items.Add("", null);
            comboClinic.SelectedIndex = 0;          //Selection is not changed if isAllProcsForSameClinic is false.
            bool isAllProcsForSameClinic = ProcList.Select(x => x.ClinicNum).Distinct().ToList().Count == 1;
            bool isListAlpha             = PrefC.GetBool(PrefName.ClinicListIsAlphabetical);

            _listClinics = Clinics.GetForUserod(Security.CurUser);
            if (isListAlpha)
            {
                _listClinics = _listClinics.OrderBy(x => x.Abbr).ToList();
            }
            else
            {
                _listClinics = _listClinics.OrderBy(x => x.ItemOrder).ToList();
            }
            _listClinics.Insert(0, Clinics.GetPracticeAsClinicZero(Lan.g(this, "None")));
            for (int i = 0; i < _listClinics.Count; i++)       //None mimics FormProcEdit
            {
                comboClinic.Items.Add(_listClinics[i].Abbr, _listClinics[i]);
                if (isAllProcsForSameClinic && _listClinics[i].ClinicNum == ProcList[0].ClinicNum)
                {
                    comboClinic.SetSelected(i + 1);
                }
            }
            if (isAllProcsForSameClinic && !_listClinics.Any(x => x.ClinicNum == ProcList[0].ClinicNum))
            {
                //All procedure clinics are the same but value is missing from our list.
                //We might eventaully check to see how many clincs from proc list do not exists in listClinics.
                comboClinic.SetSelectedKey <Clinic>(ProcList[0].ClinicNum, x => x.ClinicNum, x => Clinics.GetAbbr(x));         //selectedIndex -1
            }
        }
예제 #3
0
        private void FormWebSchedASAPSend_Load(object sender, EventArgs e)
        {
            Clinic      curClinic   = Clinics.GetClinic(_clinicNum) ?? Clinics.GetDefaultForTexting() ?? Clinics.GetPracticeAsClinicZero();
            List <long> listPatNums = (_listAppts.Select(x => x.PatNum).Union(_listRecalls.Select(x => x.PatNum))).Distinct().ToList();

            _listPatComms = Patients.GetPatComms(listPatNums, curClinic, isGetFamily: false);
            string textTemplate  = ClinicPrefs.GetPrefValue(PrefName.WebSchedAsapTextTemplate, _clinicNum);
            string emailTemplate = ClinicPrefs.GetPrefValue(PrefName.WebSchedAsapEmailTemplate, _clinicNum);
            string emailSubject  = ClinicPrefs.GetPrefValue(PrefName.WebSchedAsapEmailSubj, _clinicNum);

            textTextTemplate.Text = AsapComms.ReplacesTemplateTags(textTemplate, _clinicNum, _dtSlotStart);
            _emailText            = AsapComms.ReplacesTemplateTags(emailTemplate, _clinicNum, _dtSlotStart, isHtmlEmail: true);
            RefreshEmail();
            textEmailSubject.Text = AsapComms.ReplacesTemplateTags(emailSubject, _clinicNum, _dtSlotStart);
            if (SmsPhones.IsIntegratedTextingEnabled())
            {
                radioTextEmail.Checked = true;
            }
            else
            {
                radioEmail.Checked = true;
            }
            FillSendDetails();
            timerUpdateDetails.Start();
        }
예제 #4
0
        private void FillGridSmsUsage()
        {
            List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser);

            if (!PrefC.HasClinicsEnabled)              //No clinics so just get the practice as a clinic.
            {
                listClinics.Clear();
                listClinics.Add(Clinics.GetPracticeAsClinicZero());
            }
            var items = SmsPhones.GetSmsUsageLocal(listClinics.Select(x => x.ClinicNum).ToList(), dateTimePickerSms.Value,
                                                   WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutPhone.ToSmsPhones(_signupOut.Phones))
                        .Rows.Cast <DataRow>().Select(x => new {
                ClinicNum       = PIn.Long(x["ClinicNum"].ToString()),
                PhoneNumber     = x["PhoneNumber"].ToString(),
                CountryCode     = x["CountryCode"].ToString(),
                SentMonth       = PIn.Int(x["SentMonth"].ToString()),
                SentCharge      = PIn.Double(x["SentCharge"].ToString()),
                SentDiscount    = PIn.Double(x["SentDiscount"].ToString()),
                SentPreDiscount = PIn.Double(x["SentPreDiscount"].ToString()),
                RcvMonth        = PIn.Int(x["ReceivedMonth"].ToString()),
                RcvCharge       = PIn.Double(x["ReceivedCharge"].ToString())
            });
            bool doShowDiscount = items.Any(x => x.SentDiscount.IsGreaterThan(0));

            gridSmsSummary.BeginUpdate();
            gridSmsSummary.ListGridColumns.Clear();
            if (PrefC.HasClinicsEnabled)
            {
                gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Default"), 80)
                {
                    TextAlign = HorizontalAlignment.Center
                });
            }
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Location"), 170, HorizontalAlignment.Left));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Subscribed"), 80, HorizontalAlignment.Center));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Primary\r\nPhone Number"), 105, HorizontalAlignment.Center));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Country\r\nCode"), 60, HorizontalAlignment.Center));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Limit"), 80, HorizontalAlignment.Right));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Sent\r\nFor Month"), 70, HorizontalAlignment.Right));
            if (doShowDiscount)
            {
                gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Sent\r\nPre-Discount"), 80, HorizontalAlignment.Right));
                gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Sent\r\nDiscount"), 70, HorizontalAlignment.Right));
            }
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Sent\r\nCharges"), 70, HorizontalAlignment.Right));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Received\r\nFor Month"), 70, HorizontalAlignment.Right));
            gridSmsSummary.ListGridColumns.Add(new GridColumn(Lan.g(this, "Received\r\nCharges"), 70, HorizontalAlignment.Right));
            gridSmsSummary.ListGridRows.Clear();
            foreach (Clinic clinic in listClinics)
            {
                GridRow row = new GridRow();
                if (PrefC.HasClinicsEnabled)                  //Default texting clinic?
                {
                    row.Cells.Add(clinic.ClinicNum == PrefC.GetLong(PrefName.TextingDefaultClinicNum) ? "X" : "");
                }
                row.Cells.Add(clinic.Abbr);                 //Location.
                var dataRow = items.FirstOrDefault(x => x.ClinicNum == clinic.ClinicNum);
                if (dataRow == null)
                {
                    row.Cells.Add("No");                                         //subscribed
                    row.Cells.Add("");                                           //phone number
                    row.Cells.Add("");                                           //country code
                    row.Cells.Add((0f).ToString("c", new CultureInfo("en-US"))); //montly limit
                    row.Cells.Add("0");                                          //Sent Month
                    if (doShowDiscount)
                    {
                        row.Cells.Add((0f).ToString("c", new CultureInfo("en-US"))); //Sent Pre-Discount
                        row.Cells.Add((0f).ToString("c", new CultureInfo("en-US"))); //Sent Discount
                    }
                    row.Cells.Add((0f).ToString("c", new CultureInfo("en-US")));     //Sent Charge
                    row.Cells.Add("0");                                              //Rcvd Month
                    row.Cells.Add((0f).ToString("c", new CultureInfo("en-US")));     //Rcvd Charge
                }
                else
                {
                    row.Cells.Add(clinic.SmsContractDate.Year > 1800 ? Lan.g(this, "Yes") : Lan.g(this, "No"));
                    row.Cells.Add(dataRow.PhoneNumber);
                    row.Cells.Add(dataRow.CountryCode);
                    row.Cells.Add(clinic.SmsMonthlyLimit.ToString("c", new CultureInfo("en-US")));                   //Charge this month (Must always be in USD)
                    row.Cells.Add(dataRow.SentMonth.ToString());
                    if (doShowDiscount)
                    {
                        row.Cells.Add(dataRow.SentPreDiscount.ToString("c", new CultureInfo("en-US")));
                        row.Cells.Add(dataRow.SentDiscount.ToString("c", new CultureInfo("en-US")));
                    }
                    row.Cells.Add(dataRow.SentCharge.ToString("c", new CultureInfo("en-US")));
                    row.Cells.Add(dataRow.RcvMonth.ToString());
                    row.Cells.Add(dataRow.RcvCharge.ToString("c", new CultureInfo("en-US")));
                }
                row.Tag = clinic;
                gridSmsSummary.ListGridRows.Add(row);
            }
            if (listClinics.Count > 1)           //Total row if there is more than one clinic (Will not display for practice because practice will have no clinics.
            {
                GridRow row = new GridRow();
                row.Cells.Add("");
                row.Cells.Add("");
                row.Cells.Add("");
                row.Cells.Add("");
                row.Cells.Add(Lans.g(this, "Total"));
                row.Cells.Add(listClinics.Where(x => items.Any(y => y.ClinicNum == x.ClinicNum)).Sum(x => x.SmsMonthlyLimit).ToString("c", new CultureInfo("en-US")));
                row.Cells.Add(items.Sum(x => x.SentMonth).ToString());
                if (doShowDiscount)
                {
                    row.Cells.Add(items.Sum(x => x.SentPreDiscount).ToString("c", new CultureInfo("en-US")));
                    row.Cells.Add(items.Sum(x => x.SentDiscount).ToString("c", new CultureInfo("en-US")));
                }
                row.Cells.Add(items.Sum(x => x.SentCharge).ToString("c", new CultureInfo("en-US")));
                row.Cells.Add(items.Sum(x => x.RcvMonth).ToString());
                row.Cells.Add(items.Sum(x => x.RcvCharge).ToString("c", new CultureInfo("en-US")));
                row.ColorBackG = Color.LightYellow;
                gridSmsSummary.ListGridRows.Add(row);
            }
            gridSmsSummary.EndUpdate();
        }
        ///<summary>Fills the big main grid.</summary>
        private void FillGridMobileAppDevices()
        {
            gridMobileAppDevices.BeginUpdate();
            //Columns
            gridMobileAppDevices.ListGridColumns.Clear();
            gridMobileAppDevices.AddColumn("Device Name", 0);
            gridMobileAppDevices.AddColumn("Last Attempt", 0);
            gridMobileAppDevices.AddColumn("Last Login", 0);
            if (PrefC.HasClinicsEnabled)
            {
                gridMobileAppDevices.AddColumn("Clinic", 0);
            }
            gridMobileAppDevices.ListGridColumns.Add(new GridColumn("Enabled", 50, HorizontalAlignment.Center));
            if (_eClipboardAllowEdit)
            {
                gridMobileAppDevices.ListGridColumns.Add(new GridColumn("Delete", 45, HorizontalAlignment.Center));
            }
            //Rows
            gridMobileAppDevices.ListGridRows.Clear();
            List <MobileAppDevice> listDevicesToShow = MobileAppDevices.GetForUser(Security.CurUser);

            if (_clinicNumEClipboardTab > 0)
            {
                listDevicesToShow.RemoveAll(x => x.ClinicNum != _clinicNumEClipboardTab);
            }
            foreach (MobileAppDevice device in listDevicesToShow)
            {
                GridRow row = new GridRow();
                row.Cells.Add(device.DeviceName + "\r\n(" + device.UniqueID + ")");
                row.Cells.Add((device.LastAttempt.Year > 1880 ? device.LastAttempt.ToString() : ""));
                row.Cells.Add((device.LastLogin.Year > 1880 ? device.LastLogin.ToString() : ""));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add((device.ClinicNum == 0 ? Clinics.GetPracticeAsClinicZero() : Clinics.GetClinic(device.ClinicNum)).Abbr);
                }
                row.Cells.Add((device.IsAllowed ? "X" : ""));
                if (_eClipboardAllowEdit)
                {
                    #region Delete click handler
                    void DeleteClick(object sender, EventArgs e)
                    {
                        if (device.PatNum > 0)
                        {
                            MsgBox.Show("A patient is currently using this device. Please clear the patient from the device using the Kiosk Manager" +
                                        " or wait until the patient is no longer using the device.");
                            return;
                        }
                        if (!MsgBox.Show(MsgBoxButtons.YesNo, "This will immediately remove the device from the database and all other workstations." +
                                         " Continue?"))
                        {
                            return;
                        }
                        MobileAppDevices.Delete(device.MobileAppDeviceNum);
                        FillGridMobileAppDevices();
                    }

                    #endregion Delete click handler
                    GridCell cell = new GridCell("Delete");
                    cell.ColorBackG = Color.LightGray;
                    cell.ClickEvent = DeleteClick;
                    row.Cells.Add(cell);
                }
                row.Tag = device;
                gridMobileAppDevices.ListGridRows.Add(row);
            }
            gridMobileAppDevices.EndUpdate();
        }
 ///<summary>When viewing an existing message, the "Send" button text will be "Reply" and _webMailMode will be View.  Pressing the button will
 ///reload this form as a reply message.
 ///When composing a new message or replying to an existing message, the button text will be "Send" and _webMailMode will be
 ///either Compose or Reply.  Pressing the button will cause an attempt to send the secure and insecure message if applicable.</summary>
 private void butSend_Click(object sender, EventArgs e)
 {
     if (_webMailMode == WebMailMode.View)
     {
         _webMailMode = WebMailMode.Reply;
         FillFields();
         return;
     }
     if (!Security.IsAuthorized(Permissions.WebMailSend))
     {
         return;
     }
     VerifyInputs();
     if (!VerifyOutputs())
     {
         return;
     }
     if (!VerifyFromProvider())
     {
         return;
     }
     butSend.Enabled = false;
     //Insert the message. The patient will not see this as an actual email.
     //Rather, they must login to the patient portal (secured) and view the message that way.
     //This is how we get around sending the patient a secure message, which would be a hassle for all involved.
     _secureMessage                = new EmailMessage();
     _secureMessage.FromAddress    = textFrom.Text;
     _secureMessage.ToAddress      = textTo.Text;
     _secureMessage.PatNum         = _patCur.PatNum;
     _secureMessage.SentOrReceived = EmailSentOrReceived.WebMailSent;            //this is secure so mark as webmail sent
     _secureMessage.ProvNumWebMail = _provCur.ProvNum;
     _secureMessage.Subject        = textSubject.Text;
     _secureMessage.BodyText       = textBody.Text;
     _secureMessage.MsgDateTime    = DateTime.Now;
     _secureMessage.PatNumSubj     = GetPatNumSubj();
     if (_allowSendNotificationMessage)
     {
         _insecureMessage             = new EmailMessage();
         _insecureMessage.FromAddress = _emailAddressSender.SenderAddress;
         _insecureMessage.ToAddress   = _patCur.Email;
         _insecureMessage.PatNum      = _patCur.PatNum;
         _insecureMessage.Subject     = SubjectInsecure;
         Clinic clinic = Clinics.GetClinic(_patCur.ClinicNum) ?? Clinics.GetPracticeAsClinicZero();
         _insecureMessage.BodyText       = Clinics.ReplaceOffice(BodyTextInsecure, clinic, isHtmlEmail: true, doReplaceDisclaimer: true);
         _insecureMessage.SentOrReceived = EmailSentOrReceived.Sent;               //this is not secure so just mark as regular sent
         //Send an insecure notification email to the patient.
         _insecureMessage.MsgDateTime = DateTime.Now;
         _insecureMessage.PatNumSubj  = GetPatNumSubj();
         try {
             EmailMessages.PrepHtmlEmail(_insecureMessage);
             EmailMessages.SendEmailUnsecure(_insecureMessage, _emailAddressSender);
             //Insert the notification email into the emailmessage table so we have a record that it was sent.
             EmailMessages.Insert(_insecureMessage);
         }
         catch (Exception ex) {
             MessageBox.Show(this, "An error occurred sending the message. Please try again later or contact support.");
             Logger.openlog.LogMB(this, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message, Logger.Severity.ERROR);
             butSend.Enabled = true;
             return;
         }
     }
     _secureMessage.Attachments = _listAttachments;
     EmailMessages.Insert(_secureMessage);
     SecurityLogs.MakeLogEntry(Permissions.WebMailSend, 0, Lan.g(this, "Web Mail sent"));
     MsgBox.Show(this, "Message Sent");
     DialogResult = DialogResult.OK;
 }
예제 #7
0
 private void FormTsiHistory_Load(object sender, EventArgs e)
 {
     SetFilterControlsAndAction(() => FillGrid(),
                                datePicker, checkShowPatNums);
     #region Fill Clinics
     _listClinics = new List <Clinic>();
     if (PrefC.HasClinicsEnabled)
     {
         _listClinics.AddRange(
             Clinics.GetForUserod(Security.CurUser, true).OrderBy(x => x.ClinicNum != 0).ThenBy(x => x.ItemOrder)
             );
     }
     else              //clinics disabled
     {
         _listClinics.Add(Clinics.GetPracticeAsClinicZero(Lan.g(this, "Unassigned")));
     }
     #endregion Fill Clinics
     #region Fill Client IDs
     comboBoxMultiClientIDs.Items.Add(Lan.g(this, "All"));
     comboBoxMultiClientIDs.SetSelected(0, true);
     _listClientIDs = new List <string>();
     long progNum = Programs.GetProgramNum(ProgramName.Transworld);
     if (progNum > 0)
     {
         _listClientIDs = ProgramProperties.GetWhere(x => x.ProgramNum == progNum && x.PropertyDesc.In("ClientIdAccelerator", "ClientIdCollection"))
                          .Select(x => x.PropertyValue).Distinct().ToList();
     }
     _listClientIDs.ForEach(x => comboBoxMultiClientIDs.Items.Add(x));
     #endregion Fill Client IDs
     #region Fill Trans Types
     _listTransTypes = Enum.GetValues(typeof(TsiTransType)).OfType <TsiTransType>().ToList();
     comboBoxMultiTransTypes.Items.Add(Lan.g(this, "All"));
     comboBoxMultiTransTypes.SetSelected(0, true);
     _listTransTypes.ForEach(x => comboBoxMultiTransTypes.Items.Add(x.GetDescription()));
     #endregion Fill Trans Types
     #region Fill Account Statuses
     _listAcctStatuses = new[] { "Active", "Suspended", "Inactive" }.ToList();
     comboBoxMultiAcctStatuses.Items.Add(Lan.g(this, "All"));
     comboBoxMultiAcctStatuses.SetSelected(0, true);
     _listAcctStatuses.ForEach(x => comboBoxMultiAcctStatuses.Items.Add(x));
     #endregion Fill Account Statuses
     #region Get Selected Family PatNums
     _listSelectedFamPatNums = new List <long>();
     if (FormOpenDental.CurPatNum > 0)
     {
         Family fam = Patients.GetFamily(FormOpenDental.CurPatNum);
         textPatient.Text        = fam.GetNameInFamLF(FormOpenDental.CurPatNum);
         _listSelectedFamPatNums = fam.ListPats.Select(x => x.PatNum).ToList();
     }
     #endregion Get Selected Family PatNums
     #region Get All TsiTransLogs
     _listTsiTransLogsAll = TsiTransLogs.GetAll();
     #endregion Get All TsiTransLogs
     #region Add ClientIDs No Longer In Use
     List <string> listLogClientIDs = _listTsiTransLogsAll.Select(x => x.ClientId).Distinct().Where(x => !_listClientIDs.Contains(x)).ToList();
     foreach (string clientIDCur in listLogClientIDs)
     {
         _listClientIDs.Add(clientIDCur);
         comboBoxMultiClientIDs.Items.Add(clientIDCur + " (no longer used)");
     }
     #endregion Add ClientIDs No Longer In Use
     _dictPatLims = Patients.GetLimForPats(_listTsiTransLogsAll.Select(x => x.PatNum).Distinct().ToList() /*,true*/).ToDictionary(x => x.PatNum);
     datePicker.SetDateTimeFrom(DateTime.Today.AddDays(-1)); //Set start to yesterday
     datePicker.SetDateTimeTo(DateTime.Today);               //Set stop date to today to limit the number of messages that load immediately
     _selectedLog = null;
     FillGrid();
 }