Пример #1
0
 ///<summary>Email statements allow variables to be present in the message body and subject, this method replaces those variables with the information from the patient passed in.  Simply pass in the string for the subject or body and the corresponding patient.</summary>
 private static string ReplaceVarsForEmail(string str, Patient pat, Statement stmt)
 {
     //No need to check RemotingRole; no call to db.
     str = ReplaceVarsForSms(str, pat, stmt);
     //These were not inluded in ReplaceVarsForSms because the last name is considered PHI.
     str = str.Replace("[nameFL]", pat.GetNameFL());
     str = str.Replace("[nameFLnoPref]", pat.GetNameFLnoPref());
     return(str);
 }
Пример #2
0
 ///<summary>Email statements allow variables to be present in the message body and subject, this method replaces those variables with the information from the patient passed in.  Simply pass in the string for the subject or body and the corresponding patient.</summary>
 private static string ReplaceVarsForEmail(string str, Patient pat)
 {
     //No need to check RemotingRole; no call to db.
     str = str.Replace("[monthlyCardsOnFile]", CreditCards.GetMonthlyCardsOnFile(pat.PatNum));
     str = str.Replace("[nameF]", pat.GetNameFirst());
     str = str.Replace("[nameFL]", pat.GetNameFL());
     str = str.Replace("[nameFLnoPref]", pat.GetNameFLnoPref());
     str = str.Replace("[namePref]", pat.Preferred);
     str = str.Replace("[PatNum]", pat.PatNum.ToString());
     str = str.Replace("[currentMonth]", DateTime.Now.ToString("MMMM"));
     return(str);
 }
Пример #3
0
        ///<summary>Follows the format of the Recall addrTable, used in the RecallList to duplicate functionality for mailing/emailing patients.</summary>
        public static DataTable GetAddrTable(List <Patient> listPats, List <Patient> listGuars, bool groupFamilies, ReactivationListSort sortBy)
        {
            DataTable      table           = Recalls.GetAddrTableStructure();
            List <Patient> listPatsOrGuars = listPats;         //Default to the list of patients passed in.

            //Utilize listGuars if groupFamilies is true so that family members do not get their own row.
            if (groupFamilies)
            {
                //This makes it so that we only return one family address even if the user has passed in every single member of the family.
                listPatsOrGuars = listGuars.FindAll(x => x.PatNum.In(listPats.Select(y => y.Guarantor)));
            }
            foreach (Patient pat in listPatsOrGuars)
            {
                Patient patCur = pat;              //Always the guarantor if grouping by family, otherwise a selected patient.
                Patient guar   = listGuars.FirstOrDefault(x => x.PatNum == pat.Guarantor);
                //Only include Patients that were selected, rather than all family members.
                List <Patient> listSelectedPatsInFam = listPats.Where(x => x.Guarantor == guar.PatNum).ToList();
                if (listSelectedPatsInFam.Count == 1)               //Selected patient may not be the guarantor.
                //So use first selected patient because this will result in an individual postcard, which should show the selected patient's name, not the
                //name of the guarantor.
                {
                    patCur = listSelectedPatsInFam.First();
                }
                DataRow row = table.NewRow();
                row["address"]           = patCur.Address + (!string.IsNullOrWhiteSpace(patCur.Address2)?Environment.NewLine + patCur.Address2:"");
                row["City"]              = patCur.City;
                row["clinicNum"]         = patCur.ClinicNum;
                row["dateDue"]           = DateTime.MinValue;                                              //This isn't used for reactivations, but it's here keep the table the same as recall addrTable
                row["email"]             = patCur.Email;
                row["emailPatNum"]       = patCur.PatNum;
                row["famList"]           = listSelectedPatsInFam.Count > 1 ? string.Join(",", listSelectedPatsInFam.Select(x => x.FName)) : "";
                row["guarLName"]         = guar.LName;
                row["numberOfReminders"] = Reactivations.GetNumReminders(patCur.PatNum);
                row["patientNameF"]      = patCur.GetNameFirstOrPreferred();
                row["patientNameFL"]     = patCur.GetNameFLnoPref();
                row["patNums"]           = patCur.PatNum;
                row["State"]             = patCur.State;
                row["Zip"] = patCur.Zip;
                table.Rows.Add(row);
            }
            return(table);
        }
Пример #4
0
		///<summary>Email statements allow variables to be present in the message body and subject, this method replaces those variables with the information from the patient passed in.  Simply pass in the string for the subject or body and the corresponding patient.</summary>
		private static string ReplaceVarsForEmail(string str,Patient pat) {
			//No need to check RemotingRole; no call to db.
			str=str.Replace("[monthlyCardsOnFile]",CreditCards.GetMonthlyCardsOnFile(pat.PatNum));
			str=str.Replace("[nameF]",pat.GetNameFirst());
			str=str.Replace("[nameFL]",pat.GetNameFL());
			str=str.Replace("[nameFLnoPref]",pat.GetNameFLnoPref());
			str=str.Replace("[namePref]",pat.Preferred);
			str=str.Replace("[PatNum]",pat.PatNum.ToString());
			str=str.Replace("[currentMonth]",DateTime.Now.ToString("MMMM"));
			return str;
		}
Пример #5
0
 ///<summary>Make a payment using HPF directly.  Throws exceptions.</summary>
 public static void MakePaymentWithAlias(Patient pat, string payNote, double amount, CreditCard cc)
 {
     if (pat == null)
     {
         throw new ODException("No Patient Found", ODException.ErrorCodes.NoPatientFound);
     }
     if (amount < 0.00 || amount > 99999.99)
     {
         throw new ODException("Invalid Amount", ODException.ErrorCodes.OtkArgsInvalid);
     }
     if (string.IsNullOrEmpty(payNote))
     {
         throw new ODException("Invalid PayNote", ODException.ErrorCodes.OtkArgsInvalid);
     }
     if (cc == null)
     {
         throw new ODException("No Credit Card Found", ODException.ErrorCodes.OtkArgsInvalid);
     }
     if (string.IsNullOrEmpty(cc.PayConnectToken))
     {
         throw new ODException("Invalid CC Alias", ODException.ErrorCodes.OtkArgsInvalid);
     }
     //request a PayConnect token, if a token was already saved PayConnect will return the same token,
     //otherwise replace CCNumberMasked with the returned token if the sale successful
     PayConnectService.creditCardRequest payConnectRequest = PayConnect.BuildSaleRequest(
         (decimal)amount, cc.PayConnectToken, cc.CCExpiration.Year, cc.CCExpiration.Month,
         pat.GetNameFLnoPref(), "", cc.Zip, null,
         PayConnectService.transType.SALE, "", true);
     //clinicNumCur could be 0, and the practice level or 'Headquarters' PayConnect credentials would be used for this charge
     PayConnectService.transResponse payConnectResponse = PayConnect.ProcessCreditCard(payConnectRequest, pat.ClinicNum,
                                                                                       x => throw new ODException(x));
     if (payConnectRequest != null && payConnectResponse.Status.code == 0)         //Success
     {
         string receipt = BuildReceiptString(payConnectRequest.TransType, payConnectResponse.RefNumber, payConnectRequest.NameOnCard, payConnectRequest.CardNumber,
                                             payConnectRequest.MagData, payConnectResponse.AuthCode, payConnectResponse.Status.description, payConnectResponse.Messages.ToList(), payConnectRequest.Amount,
                                             0, pat.ClinicNum);
         DateTime dateTimeProcessed = DateTime.Now;
         string   formattedNote     = Lans.g("PayConnect", "Amount:") + " " + amount.ToString("f") + "\r\n"
                                      + Lans.g("PayConnect", "Card Number:") + " " + cc.CCNumberMasked + "\r\n"
                                      + Lans.g("PayConnect", "Transaction ID:") + " " + payConnectRequest.RefNumber + "\r\n"
                                      + Lans.g("PayConnect", "Processed:") + " " + dateTimeProcessed.ToShortDateString() + " " + dateTimeProcessed.ToShortTimeString() + "\r\n"
                                      + Lans.g("PayConnect", "Note:") + " " + payNote;
         long payNum = Payments.InsertFromPayConnect(pat.PatNum, pat.PriProv, pat.ClinicNum, amount, formattedNote, receipt, CreditCardSource.PayConnectPortal);
         PayConnectResponseWeb responseWeb = new PayConnectResponseWeb()
         {
             Amount            = amount,
             PatNum            = pat.PatNum,
             ProcessingStatus  = PayConnectWebStatus.Completed,
             PayNote           = payNote,
             CCSource          = cc.CCSource,
             IsTokenSaved      = true,
             PayNum            = payNum,
             DateTimeCompleted = MiscData.GetNowDateTime(),
             RefNumber         = payConnectResponse.RefNumber,
             TransType         = PayConnectService.transType.SALE,
             PaymentToken      = cc.PayConnectToken,
         };
         //Insert a new payconnectresponse row for historical record in the transaction window.
         PayConnectResponseWebs.Insert(responseWeb);
     }
     else              //Failed
     {
         throw new ODException("Unable to process payment for this credit card: " + (payConnectResponse == null ? "Unknown error" : payConnectResponse.Status.description));
     }
 }