Exemple #1
0
        ///<summary>The proxy's working directory.</summary>
        public static string SendAndReceiveUpdateRequestXml()
        {
            List <string> listProgramsEnabled = Programs.GetWhere(x => x.Enabled && !string.IsNullOrWhiteSpace(x.ProgName))
                                                .Select(x => x.ProgName).ToList();
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(strbuild, settings)) {
                writer.WriteStartElement("UpdateRequest");
                writer.WriteStartElement("RegistrationKey");
                writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
                writer.WriteEndElement();
                writer.WriteStartElement("PracticeTitle");
                writer.WriteString(PrefC.GetString(PrefName.PracticeTitle));
                writer.WriteEndElement();
                writer.WriteStartElement("PracticePhone");
                writer.WriteString(PrefC.GetString(PrefName.PracticePhone));
                writer.WriteEndElement();
                writer.WriteStartElement("ProgramVersion");
                writer.WriteString(PrefC.GetString(PrefName.ProgramVersion));
                writer.WriteEndElement();
                writer.WriteStartElement("ClinicCount");
                writer.WriteString(PrefC.HasClinicsEnabled ? Clinics.GetCount(true).ToString() : "0");
                writer.WriteEndElement();
                writer.WriteStartElement("ListProgramsEnabled");
                new XmlSerializer(typeof(List <string>)).Serialize(writer, listProgramsEnabled);
                writer.WriteEndElement();
                writer.WriteStartElement("DateFormat");
                writer.WriteString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
                writer.WriteEndElement();
                writer.WriteEndElement();                //UpdateRequest
            }
            return(GetWebServiceInstance().RequestUpdate(strbuild.ToString()));
        }
Exemple #2
0
        ///<summary>Shows a message box on error.</summary>
        public static PayConnectService.transResponse ProcessCreditCard(PayConnectService.creditCardRequest request, long clinicNum,
                                                                        Action <string> showError)
        {
            try {
                Program prog = Programs.GetCur(ProgramName.PayConnect);
                PayConnectService.Credentials     cred = GetCredentials(prog, clinicNum);
                PayConnectService.MerchantService ms   = new PayConnectService.MerchantService();
                ms.Url = Introspection.GetOverride(Introspection.IntrospectionEntity.PayConnectRestURL, "https://webservices.dentalxchange.com/merchant/MerchantService?wsdl");
#if DEBUG
                ms.Url = "https://prelive.dentalxchange.com/merchant/MerchantService?wsdl";
#endif
                PayConnectService.transResponse response = ms.processCreditCard(cred, request);
                ms.Dispose();
                if (response.Status.code != 0 && response.Status.description.ToLower().Contains("duplicate"))
                {
                    showError(Lans.g("PayConnect", "Payment failed") + ". \r\n" + Lans.g("PayConnect", "Error message from") + " Pay Connect: \""
                              + response.Status.description + "\"\r\n"
                              + Lans.g("PayConnect", "Try using the Force Duplicate checkbox if a duplicate is intended."));
                }
                if (response.Status.code != 0 && response.Status.description.ToLower().Contains("invalid user"))
                {
                    showError(Lans.g("PayConnect", "Payment failed") + ".\r\n"
                              + Lans.g("PayConnect", "PayConnect username and password combination invalid.") + "\r\n"
                              + Lans.g("PayConnect", "Verify account settings by going to") + "\r\n"
                              + Lans.g("PayConnect", "Setup | Program Links | PayConnect. The PayConnect username and password are probably the same as the DentalXChange login ID and password."));
                }
                else if (response.Status.code != 0)               //Error
                {
                    showError(Lans.g("PayConnect", "Payment failed") + ". \r\n" + Lans.g("PayConnect", "Error message from") + " Pay Connect: \""
                              + response.Status.description + "\"");
                }
                return(response);
            }
            catch (Exception ex) {
                showError(Lans.g("PayConnect", "Payment failed") + ". \r\n" + Lans.g("PayConnect", "Error message") + ": \"" + ex.Message + "\"");
            }
            return(null);
        }
Exemple #3
0
        public static bool IsTransworldEnabled(long clinicNum)
        {
            //No need to check RemotingRole;no call to db.
            Program progCur = Programs.GetCur(ProgramName.Transworld);

            if (progCur == null || !progCur.Enabled)
            {
                return(false);
            }
            Dictionary <long, List <ProgramProperty> > dictAllProps = ProgramProperties.GetForProgram(progCur.ProgramNum)
                                                                      .GroupBy(x => x.ClinicNum)
                                                                      .ToDictionary(x => x.Key, x => x.ToList());

            if (dictAllProps.Count == 0)
            {
                return(false);
            }
            List <long> listDisabledClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                List <Clinic> listAllClinics = Clinics.GetDeepCopy();
                listDisabledClinicNums.AddRange(dictAllProps.Where(x => !TsiTransLogs.ValidateClinicSftpDetails(x.Value, false)).Select(x => x.Key));
                listDisabledClinicNums.AddRange(listAllClinics
                                                .FindAll(x => x.IsHidden || (listDisabledClinicNums.Contains(0) && !dictAllProps.ContainsKey(x.ClinicNum)))//if no props for HQ, skip other clinics without props
                                                .Select(x => x.ClinicNum)
                                                );
            }
            else
            {
                if (!TsiTransLogs.ValidateClinicSftpDetails(dictAllProps[0], false))
                {
                    listDisabledClinicNums.Add(0);
                }
            }
            return(!listDisabledClinicNums.Contains(clinicNum));
        }
        public static DataTable GetMissingXTransTable(DateTime dateStart, DateTime dateEnd)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetTable(MethodBase.GetCurrentMethod(), dateStart, dateEnd));
            }
            string command = "SELECT payment.PatNum,LName,FName,payment.DateEntry,payment.PayDate,payment.PayNote,payment.PayAmt "
                             + "FROM patient "
                             + "INNER JOIN payment ON payment.PatNum=patient.PatNum "
                             //only payments with the same PaymentType as the X-Charge PaymentType for the clinic
                             + "INNER JOIN ("
                             + "SELECT ClinicNum,PropertyValue AS PaymentType FROM programproperty "
                             + "WHERE ProgramNum=" + POut.Long(Programs.GetProgramNum(ProgramName.Xcharge)) + " AND PropertyDesc='PaymentType'"
                             + ") paytypes ON paytypes.ClinicNum=payment.ClinicNum AND paytypes.PaymentType=payment.PayType "
                             + "LEFT JOIN xchargetransaction ON xchargetransaction.PatNum=payment.PatNum "
                             + "AND " + DbHelper.DtimeToDate("TransactionDateTime") + "=payment.DateEntry "
                             + "AND (CASE WHEN xchargetransaction.ResultCode=5 THEN 0 ELSE xchargetransaction.Amount END)=payment.PayAmt "
                             + "AND xchargetransaction.ResultCode IN(0,5,10) "
                             + "WHERE payment.DateEntry BETWEEN " + POut.Date(dateStart) + " AND " + POut.Date(dateEnd) + " "
                             + "AND TransactionDateTime IS NULL "
                             + "ORDER BY payment.PayDate ASC,LName,FName";

            return(Db.GetTable(command));
        }
Exemple #5
0
 ///<summary>Used by Server.  Throws exception if bad username or passhash or if either are blank.  It uses cached user list, refreshing it if null.  This is used everywhere except in the log on screen.</summary>
 public static void CheckCredentials(Credentials cred)
 {
     //No need to check RemotingRole; no call to db.
                 #if DEBUG
     return;                    //skip checking credentials when in debug for faster testing.
                 #endif
     if (cred.Username == "" || cred.Password == "")
     {
         throw new ApplicationException("Invalid username or password.");
     }
     Userod userod = null;
     for (int i = 0; i < UserodC.Listt.Count; i++)
     {
         if (UserodC.Listt[i].UserName == cred.Username)
         {
             userod = UserodC.Listt[i];
             break;
         }
     }
     if (userod == null)
     {
         throw new ApplicationException("Invalid username or password.");
     }
     bool useEcwAlgorithm = Programs.IsEnabled(ProgramName.eClinicalWorks);
     if (useEcwAlgorithm)
     {
         if (userod.Password != cred.Password)
         {
             throw new ApplicationException("Invalid username or password.");
         }
     }
     else if (userod.Password != EncryptPassword(cred.Password))
     {
         throw new ApplicationException("Invalid username or password.");
     }
 }
Exemple #6
0
 ///<summary>Pass in a serialized dto.  It returns a dto which must be deserialized by the client.
 ///Set serverMapPath to the root directory of the OpenDentalServerConfig.xml.  Typically Server.MapPath(".") from a web service.
 ///Optional parameter because it is not necessary for Unit Tests (mock server).</summary>
 public static string ProcessDto(string dtoString, string serverMapPath = "")
 {
     try {
         #region Normalize DateTime
         if (!_isMiddleTierInitialized)
         {
             //If this fails, the exception will throw and be serialized and sent to the client.
             ODInitialize.Initialize();
             //Because Security._curUserT is a thread static field, we need to make sure that any new threads that are spawned have that field set.
             ODThread.AddInitializeHandler <Userod>(() => Security.CurUser.Copy(), user => Security.CurUser = user);
             //Same thing for PasswordTyped.
             ODThread.AddInitializeHandler <string>(() => Security.PasswordTyped, password => Security.PasswordTyped = password);
             //Ditto for CurComputerName
             ODThread.AddInitializeHandler <string>(() => Security.CurComputerName, computerName => Security.CurComputerName = computerName);
             //Calling CDT.Class1.Decrypt will cause CDT to verify the assembly and then save the encryption key. This needs to be done here because
             //if we later call CDT.Class1.Decrypt inside a thread, we won't we able to find OpenDentalServer.dll in the call stack.
             ODException.SwallowAnyException(() => CDT.Class1.Decrypt("odv2e$fakeciphertext", out _));
             _isMiddleTierInitialized = true;
         }
         #endregion
         #region Initialize Database Connection
         //Always attempt to set the database connection settings from the config file if they haven't been set yet.
         //We use to ONLY load in database settings when Security.LogInWeb was called but that is not good enough now that we have more services.
         //E.g. We do not want to manually call "Security.LogInWeb" from the CEMT when all we want is a single preference value.
         if (string.IsNullOrEmpty(DataConnection.GetServerName()) && string.IsNullOrEmpty(DataConnection.GetConnectionString()))
         {
             RemotingClient.RemotingRole = RemotingRole.ServerWeb;
             //the application virtual path is usually /OpenDentalServer, but may be different if hosting multiple databases on one IIS server
             string configFilePath = "";
             if (!string.IsNullOrWhiteSpace(HostingEnvironment.ApplicationVirtualPath) && HostingEnvironment.ApplicationVirtualPath.Length > 1)
             {
                 //There can be multiple config files within a physical path that is shared by multiple IIS ASP.NET applications.
                 //In order for the same physical path to host multiple applications, they each need a unique config file for db connection settings.
                 //Each application will have a unique ApplicationVirtualPath which we will use to identify the corresponding config.xml.
                 configFilePath = ODFileUtils.CombinePaths(serverMapPath, HostingEnvironment.ApplicationVirtualPath.Trim('/') + "Config.xml");
             }
             if (string.IsNullOrWhiteSpace(configFilePath) ||
                 !File.Exists(configFilePath))                           //returns false if the file doesn't exist, user doesn't have permission for file, path is blank or null
             {
                 //either configFilePath not set or file doesn't exist, default to OpenDentalServerConfig.xml
                 configFilePath = ODFileUtils.CombinePaths(serverMapPath, "OpenDentalServerConfig.xml");
             }
             Userods.LoadDatabaseInfoFromFile(configFilePath);
         }
         #endregion
         DataTransferObject dto            = DataTransferObject.Deserialize(dtoString);
         DtoInformation     dtoInformation = new DtoInformation(dto);
         if (dtoInformation.FullNameComponents.Length == 3 && dtoInformation.FullNameComponents[2].ToLower() == "hashpassword")
         {
             return(dtoInformation.GetHashPassword());
         }
         //Set Security.CurUser so that queries can be run against the db as if it were this user.
         Security.CurUser = Userods.CheckUserAndPassword(dto.Credentials.Username, dto.Credentials.Password
                                                         , Programs.UsingEcwTightOrFullMode());
         Security.PasswordTyped = dto.Credentials.Password;
         //Set the computer name so securitylog entries use the client's computer name instead of the middle tier server name
         //Older clients might not include ComputerName in the dto, so we need to make sure it's not null.
         Security.CurComputerName = dto.ComputerName ?? "";
         Type type = dto.GetType();
         #region DtoGetTable
         if (type == typeof(DtoGetTable))
         {
             DataTable dt = (DataTable)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(XmlConverter.TableToXml(dt));
         }
         #endregion
         #region DtoGetTableLow
         else if (type == typeof(DtoGetTableLow))
         {
             DataTable dt = Reports.GetTable((string)dtoInformation.ParamObjs[0]);
             return(XmlConverter.TableToXml(dt));
         }
         #endregion
         #region DtoGetDS
         else if (type == typeof(DtoGetDS))
         {
             DataSet ds = (DataSet)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(XmlConverter.DsToXml(ds));
         }
         #endregion
         #region DtoGetSerializableDictionary
         else if (type == typeof(DtoGetSerializableDictionary))
         {
             Object objResult  = dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             Type   returnType = dtoInformation.MethodInfo.ReturnType;
             return(XmlConverterSerializer.Serialize(returnType, objResult));
         }
         #endregion
         #region DtoGetLong
         else if (type == typeof(DtoGetLong))
         {
             long longResult = (long)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(longResult.ToString());
         }
         #endregion
         #region DtoGetInt
         else if (type == typeof(DtoGetInt))
         {
             int intResult = (int)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(intResult.ToString());
         }
         #endregion
         #region DtoGetDouble
         else if (type == typeof(DtoGetDouble))
         {
             double doubleResult = (double)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(doubleResult.ToString());
         }
         #endregion
         #region DtoGetVoid
         else if (type == typeof(DtoGetVoid))
         {
             dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return("0");
         }
         #endregion
         #region DtoGetObject
         else if (type == typeof(DtoGetObject))
         {
             if (dtoInformation.ClassName == "Security" && dtoInformation.MethodName == "LogInWeb")
             {
                 dtoInformation.Parameters[2] = new DtoObject(serverMapPath, typeof(string));                     //because we can't access this variable from within OpenDentBusiness.
                 RemotingClient.RemotingRole  = RemotingRole.ServerWeb;
                 //We just changed the number of parameters so we need to regenerate ParamObjs.
                 dtoInformation.ParamObjs = DtoObject.GenerateObjects(dtoInformation.Parameters);
             }
             Object objResult  = dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             Type   returnType = dtoInformation.MethodInfo.ReturnType;
             if (returnType.IsInterface)
             {
                 objResult  = new DtoObject(objResult, objResult?.GetType() ?? returnType);
                 returnType = typeof(DtoObject);
             }
             return(XmlConverterSerializer.Serialize(returnType, objResult));
         }
         #endregion
         #region DtoGetString
         else if (type == typeof(DtoGetString))
         {
             string strResult = (string)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(XmlConverter.XmlEscape(strResult));
         }
         #endregion
         #region DtoGetBool
         else if (type == typeof(DtoGetBool))
         {
             bool boolResult = (bool)dtoInformation.MethodInfo.Invoke(null, dtoInformation.ParamObjs);
             return(boolResult.ToString());
         }
         #endregion
         else
         {
             throw new NotSupportedException("Dto type not supported: " + type.FullName);
         }
     }
     catch (Exception e) {
         DtoException exception = new DtoException();
         if (e.InnerException == null)
         {
             exception = GetDtoException(e);
         }
         else
         {
             exception = GetDtoException(e.InnerException);
         }
         return(exception.Serialize());
     }
 }
        ///<summary>Safe to call on any program. Only returns true if the program is not enabled
        ///AND the program has a property of "Disable Advertising" = 1 OR "Disable Advertising HQ" = 1.
        ///This means that either the office has disabled the ad or HQ has disabled the ad.</summary>
        public static bool IsAdvertisingDisabled(ProgramName progName)
        {
            Program program = Programs.GetCur(progName);

            return(IsAdvertisingDisabled(program));
        }
Exemple #8
0
        ///<summary>If ClientWeb, then this method is instead run on the server, and the result passed back to the client.  And since it's ClientWeb, FillCache will be run on the client.</summary>
        public static DataSet GetCacheDs(string itypesStr)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetDS(MethodBase.GetCurrentMethod(), itypesStr));
            }
            //so this part below only happens if direct or server------------------------------------------------
            List <int> itypes = new List <int>();

            string[] strArray = itypesStr.Split(',');
            for (int i = 0; i < strArray.Length; i++)
            {
                itypes.Add(PIn.Int(strArray[i]));
            }
            bool isAll = false;

            if (itypes.Contains((int)InvalidType.AllLocal))
            {
                isAll = true;
            }
            DataSet ds = new DataSet();

            if (itypes.Contains((int)InvalidType.AccountingAutoPays) || isAll)
            {
                ds.Tables.Add(AccountingAutoPays.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.AutoCodes) || isAll)
            {
                ds.Tables.Add(AutoCodes.RefreshCache());
                ds.Tables.Add(AutoCodeItems.RefreshCache());
                ds.Tables.Add(AutoCodeConds.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Automation) || isAll)
            {
                ds.Tables.Add(Automations.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.AutoNotes) || isAll)
            {
                ds.Tables.Add(AutoNotes.RefreshCache());
                ds.Tables.Add(AutoNoteControls.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Carriers) || isAll)
            {
                ds.Tables.Add(Carriers.RefreshCache());                //run on startup, after telephone reformat, after list edit.
            }
            if (itypes.Contains((int)InvalidType.ClaimForms) || isAll)
            {
                ds.Tables.Add(ClaimFormItems.RefreshCache());
                ds.Tables.Add(ClaimForms.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ClearHouses) || isAll)
            {
                ds.Tables.Add(Clearinghouses.RefreshCache());                //kh wants to add an EasyHideClearHouses to disable this
            }
            if (itypes.Contains((int)InvalidType.Computers) || isAll)
            {
                ds.Tables.Add(Computers.RefreshCache());
                ds.Tables.Add(Printers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Defs) || isAll)
            {
                ds.Tables.Add(Defs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.DentalSchools) || isAll)
            {
                ds.Tables.Add(SchoolClasses.RefreshCache());
                ds.Tables.Add(SchoolCourses.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.DictCustoms) || isAll)
            {
                ds.Tables.Add(DictCustoms.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Diseases) || isAll)
            {
                ds.Tables.Add(DiseaseDefs.RefreshCache());
                ds.Tables.Add(ICD9s.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.DisplayFields) || isAll)
            {
                ds.Tables.Add(DisplayFields.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ElectIDs) || isAll)
            {
                ds.Tables.Add(ElectIDs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Email) || isAll)
            {
                ds.Tables.Add(EmailAddresses.RefreshCache());
                ds.Tables.Add(EmailTemplates.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Employees) || isAll)
            {
                ds.Tables.Add(Employees.RefreshCache());
                ds.Tables.Add(PayPeriods.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Employers) || isAll)
            {
                ds.Tables.Add(Employers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Fees) || isAll)
            {
                ds.Tables.Add(Fees.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.FeeScheds) || isAll)
            {
                ds.Tables.Add(FeeScheds.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.HL7Defs) || isAll)
            {
                ds.Tables.Add(HL7Defs.RefreshCache());
                ds.Tables.Add(HL7DefMessages.RefreshCache());
                ds.Tables.Add(HL7DefSegments.RefreshCache());
                ds.Tables.Add(HL7DefFields.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.InsCats) || isAll)
            {
                ds.Tables.Add(CovCats.RefreshCache());
                ds.Tables.Add(CovSpans.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.InsFilingCodes) || isAll)
            {
                ds.Tables.Add(InsFilingCodes.RefreshCache());
                ds.Tables.Add(InsFilingCodeSubtypes.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Languages) || isAll)
            {
                if (CultureInfo.CurrentCulture.Name != "en-US")
                {
                    ds.Tables.Add(Lans.RefreshCache());
                }
            }
            if (itypes.Contains((int)InvalidType.Letters) || isAll)
            {
                ds.Tables.Add(Letters.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.LetterMerge) || isAll)
            {
                ds.Tables.Add(LetterMergeFields.RefreshCache());
                ds.Tables.Add(LetterMerges.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Operatories) || isAll)
            {
                ds.Tables.Add(Operatories.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.PatFields) || isAll)
            {
                ds.Tables.Add(PatFieldDefs.RefreshCache());
                ds.Tables.Add(ApptFieldDefs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Pharmacies) || isAll)
            {
                ds.Tables.Add(Pharmacies.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Prefs) || isAll)
            {
                ds.Tables.Add(Prefs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ProcButtons) || isAll)
            {
                ds.Tables.Add(ProcButtons.RefreshCache());
                ds.Tables.Add(ProcButtonItems.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ProcCodes) || isAll)
            {
                ds.Tables.Add(ProcedureCodes.RefreshCache());
                ds.Tables.Add(ProcCodeNotes.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Programs) || isAll)
            {
                ds.Tables.Add(Programs.RefreshCache());
                ds.Tables.Add(ProgramProperties.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ProviderIdents) || isAll)
            {
                ds.Tables.Add(ProviderIdents.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Providers) || isAll)
            {
                ds.Tables.Add(Providers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.QuickPaste) || isAll)
            {
                ds.Tables.Add(QuickPasteNotes.RefreshCache());
                ds.Tables.Add(QuickPasteCats.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.RecallTypes) || isAll)
            {
                ds.Tables.Add(RecallTypes.RefreshCache());
                ds.Tables.Add(RecallTriggers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ReplicationServers) || isAll)
            {
                ds.Tables.Add(ReplicationServers.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Security) || isAll)
            {
                ds.Tables.Add(Userods.RefreshCache());
                ds.Tables.Add(UserGroups.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Sheets) || isAll)
            {
                ds.Tables.Add(SheetDefs.RefreshCache());
                ds.Tables.Add(SheetFieldDefs.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Signals) || isAll)
            {
                ds.Tables.Add(SigElementDefs.RefreshCache());
                ds.Tables.Add(SigButDefs.RefreshCache());                //includes SigButDefElements.Refresh()
            }
            if (itypes.Contains((int)InvalidType.Sites) || isAll)
            {
                ds.Tables.Add(Sites.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Sops) || isAll)
            {
                ds.Tables.Add(Sops.RefreshCache());
            }
            //InvalidTypes.Tasks not handled here.
            if (itypes.Contains((int)InvalidType.TimeCardRules) || isAll)
            {
                ds.Tables.Add(TimeCardRules.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ToolBut) || isAll)
            {
                ds.Tables.Add(ToolButItems.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Vaccines) || isAll)
            {
                ds.Tables.Add(VaccineDefs.RefreshCache());
                ds.Tables.Add(DrugManufacturers.RefreshCache());
                ds.Tables.Add(DrugUnits.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Views) || isAll)
            {
                ds.Tables.Add(ApptViews.RefreshCache());
                ds.Tables.Add(ApptViewItems.RefreshCache());
                ds.Tables.Add(AppointmentRules.RefreshCache());
                ds.Tables.Add(ProcApptColors.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.Wiki) || isAll)
            {
                ds.Tables.Add(WikiListHeaderWidths.RefreshCache());
                ds.Tables.Add(WikiPages.RefreshCache());
            }
            if (itypes.Contains((int)InvalidType.ZipCodes) || isAll)
            {
                ds.Tables.Add(ZipCodes.RefreshCache());
            }
            return(ds);
        }
Exemple #9
0
 ///<summary>Returns true if more than 1 credit card processing program is enabled.</summary>
 public static bool HasMultipleCreditCardProgramsEnabled()
 {
     //No need to check RemotingRole; no call to db.
     return(new List <bool> {
         Programs.IsEnabled(ProgramName.Xcharge), Programs.IsEnabled(ProgramName.PayConnect), Programs.IsEnabled(ProgramName.PaySimple)
     }.Count(x => x == true) >= 2);
 }
Exemple #10
0
 ///<summary>True if we are in HQ and AvaTax is enabled.</summary>
 public static bool IsEnabled()
 {
     return(PrefC.IsODHQ && Programs.IsEnabled(ProgramName.AvaTax));
 }
Exemple #11
0
        ///<summary>only if ClientWeb</summary>
        public static void FillCache(DataSet ds, string itypesStr)
        {
            List <int> itypes = new List <int>();

            string[] strArray = itypesStr.Split(',');
            for (int i = 0; i < strArray.Length; i++)
            {
                itypes.Add(PIn.Int(strArray[i]));
            }
            bool isAll = false;

            if (itypes.Contains((int)InvalidType.AllLocal))
            {
                isAll = true;
            }
            if (itypes.Contains((int)InvalidType.AccountingAutoPays) || isAll)
            {
                AccountingAutoPays.FillCache(ds.Tables["AccountingAutoPay"]);
            }
            if (itypes.Contains((int)InvalidType.AutoCodes) || isAll)
            {
                AutoCodes.FillCache(ds.Tables["AutoCode"]);
                AutoCodeItems.FillCache(ds.Tables["AutoCodeItem"]);
                AutoCodeConds.FillCache(ds.Tables["AutoCodeCond"]);
            }
            if (itypes.Contains((int)InvalidType.Automation) || isAll)
            {
                Automations.FillCache(ds.Tables["Automation"]);
            }
            if (itypes.Contains((int)InvalidType.AutoNotes) || isAll)
            {
                AutoNotes.FillCache(ds.Tables["AutoNote"]);
                AutoNoteControls.FillCache(ds.Tables["AutoNoteControl"]);
            }
            if (itypes.Contains((int)InvalidType.Carriers) || isAll)
            {
                Carriers.FillCache(ds.Tables["Carrier"]);                //run on startup, after telephone reformat, after list edit.
            }
            if (itypes.Contains((int)InvalidType.ClaimForms) || isAll)
            {
                ClaimFormItems.FillCache(ds.Tables["ClaimFormItem"]);
                ClaimForms.FillCache(ds.Tables["ClaimForm"]);
            }
            if (itypes.Contains((int)InvalidType.ClearHouses) || isAll)
            {
                Clearinghouses.FillCache(ds.Tables["Clearinghouse"]);                //kh wants to add an EasyHideClearHouses to disable this
            }
            if (itypes.Contains((int)InvalidType.Computers) || isAll)
            {
                Computers.FillCache(ds.Tables["Computer"]);
                Printers.FillCache(ds.Tables["Printer"]);
            }
            if (itypes.Contains((int)InvalidType.Defs) || isAll)
            {
                Defs.FillCache(ds.Tables["Def"]);
            }
            if (itypes.Contains((int)InvalidType.DentalSchools) || isAll)
            {
                SchoolClasses.FillCache(ds.Tables["SchoolClass"]);
                SchoolCourses.FillCache(ds.Tables["SchoolCourse"]);
            }
            if (itypes.Contains((int)InvalidType.DictCustoms) || isAll)
            {
                DictCustoms.FillCache(ds.Tables["DictCustom"]);
            }
            if (itypes.Contains((int)InvalidType.Diseases) || isAll)
            {
                DiseaseDefs.FillCache(ds.Tables["DiseaseDef"]);
                ICD9s.FillCache(ds.Tables["ICD9"]);
            }
            if (itypes.Contains((int)InvalidType.DisplayFields) || isAll)
            {
                DisplayFields.FillCache(ds.Tables["DisplayField"]);
            }
            if (itypes.Contains((int)InvalidType.ElectIDs) || isAll)
            {
                ElectIDs.FillCache(ds.Tables["ElectID"]);
            }
            if (itypes.Contains((int)InvalidType.Email) || isAll)
            {
                EmailAddresses.FillCache(ds.Tables["EmailAddress"]);
                EmailTemplates.FillCache(ds.Tables["EmailTemplate"]);
            }
            if (itypes.Contains((int)InvalidType.Employees) || isAll)
            {
                Employees.FillCache(ds.Tables["Employee"]);
                PayPeriods.FillCache(ds.Tables["PayPeriod"]);
            }
            if (itypes.Contains((int)InvalidType.Employers) || isAll)
            {
                Employers.FillCache(ds.Tables["Employer"]);
            }
            if (itypes.Contains((int)InvalidType.Fees) || isAll)
            {
                Fees.FillCache(ds.Tables["Fee"]);
            }
            if (itypes.Contains((int)InvalidType.FeeScheds) || isAll)
            {
                FeeScheds.FillCache(ds.Tables["FeeSched"]);
            }
            if (itypes.Contains((int)InvalidType.HL7Defs) || isAll)
            {
                HL7Defs.FillCache(ds.Tables["HL7Def"]);
                HL7DefMessages.FillCache(ds.Tables["HL7DefMessage"]);
                HL7DefSegments.FillCache(ds.Tables["HL7DefSegment"]);
                HL7DefFields.FillCache(ds.Tables["HL7DefField"]);
            }
            if (itypes.Contains((int)InvalidType.InsCats) || isAll)
            {
                CovCats.FillCache(ds.Tables["CovCat"]);
                CovSpans.FillCache(ds.Tables["CovSpan"]);
            }
            if (itypes.Contains((int)InvalidType.InsFilingCodes) || isAll)
            {
                InsFilingCodes.FillCache(ds.Tables["InsFilingCode"]);
                InsFilingCodeSubtypes.FillCache(ds.Tables["InsFilingCodeSubtype"]);
            }
            if (itypes.Contains((int)InvalidType.Languages) || isAll)
            {
                Lans.FillCache(ds.Tables["Language"]);
            }
            if (itypes.Contains((int)InvalidType.Letters) || isAll)
            {
                Letters.FillCache(ds.Tables["Letter"]);
            }
            if (itypes.Contains((int)InvalidType.LetterMerge) || isAll)
            {
                LetterMergeFields.FillCache(ds.Tables["LetterMergeField"]);
                LetterMerges.FillCache(ds.Tables["LetterMerge"]);
            }
            if (itypes.Contains((int)InvalidType.Operatories) || isAll)
            {
                Operatories.FillCache(ds.Tables["Operatory"]);
            }
            if (itypes.Contains((int)InvalidType.PatFields) || isAll)
            {
                PatFieldDefs.FillCache(ds.Tables["PatFieldDef"]);
                ApptFieldDefs.FillCache(ds.Tables["ApptFieldDef"]);
            }
            if (itypes.Contains((int)InvalidType.Pharmacies) || isAll)
            {
                Pharmacies.FillCache(ds.Tables["Pharmacy"]);
            }
            if (itypes.Contains((int)InvalidType.Prefs) || isAll)
            {
                Prefs.FillCache(ds.Tables["Pref"]);
            }
            if (itypes.Contains((int)InvalidType.ProcButtons) || isAll)
            {
                ProcButtons.FillCache(ds.Tables["ProcButton"]);
                ProcButtonItems.FillCache(ds.Tables["ProcButtonItem"]);
            }
            if (itypes.Contains((int)InvalidType.ProcCodes) || isAll)
            {
                ProcedureCodes.FillCache(ds.Tables["ProcedureCode"]);
                ProcCodeNotes.FillCache(ds.Tables["ProcCodeNote"]);
            }
            if (itypes.Contains((int)InvalidType.Programs) || isAll)
            {
                Programs.FillCache(ds.Tables["Program"]);
                ProgramProperties.FillCache(ds.Tables["ProgramProperty"]);
            }
            if (itypes.Contains((int)InvalidType.ProviderIdents) || isAll)
            {
                ProviderIdents.FillCache(ds.Tables["ProviderIdent"]);
            }
            if (itypes.Contains((int)InvalidType.Providers) || isAll)
            {
                Providers.FillCache(ds.Tables["Provider"]);
            }
            if (itypes.Contains((int)InvalidType.QuickPaste) || isAll)
            {
                QuickPasteNotes.FillCache(ds.Tables["QuickPasteNote"]);
                QuickPasteCats.FillCache(ds.Tables["QuickPasteCat"]);
            }
            if (itypes.Contains((int)InvalidType.RecallTypes) || isAll)
            {
                RecallTypes.FillCache(ds.Tables["RecallType"]);
                RecallTriggers.FillCache(ds.Tables["RecallTrigger"]);
            }
            if (itypes.Contains((int)InvalidType.ReplicationServers) || isAll)
            {
                ReplicationServers.FillCache(ds.Tables["ReplicationServer"]);
            }
            if (itypes.Contains((int)InvalidType.Security) || isAll)
            {
                Userods.FillCache(ds.Tables["Userod"]);
                UserGroups.FillCache(ds.Tables["UserGroup"]);
            }
            if (itypes.Contains((int)InvalidType.Sheets) || isAll)
            {
                SheetDefs.FillCache(ds.Tables["SheetDef"]);
                SheetFieldDefs.FillCache(ds.Tables["SheetFieldDef"]);
            }
            if (itypes.Contains((int)InvalidType.Signals) || isAll)
            {
                SigElementDefs.FillCache(ds.Tables["SigElementDef"]);
                SigButDefs.FillCache(ds.Tables["SigButDef"]);                //includes SigButDefElements.Refresh()
            }
            if (itypes.Contains((int)InvalidType.Sites) || isAll)
            {
                Sites.FillCache(ds.Tables["Site"]);
            }
            if (itypes.Contains((int)InvalidType.Sops) || isAll)
            {
                Sops.FillCache(ds.Tables["Sop"]);
            }
            if (itypes.Contains((int)InvalidType.TimeCardRules) || isAll)
            {
                TimeCardRules.FillCache(ds.Tables["TimeCardRule"]);
            }
            //InvalidTypes.Tasks not handled here.
            if (itypes.Contains((int)InvalidType.ToolBut) || isAll)
            {
                ToolButItems.FillCache(ds.Tables["ToolButItem"]);
            }
            if (itypes.Contains((int)InvalidType.Vaccines) || isAll)
            {
                VaccineDefs.FillCache(ds.Tables["VaccineDef"]);
                DrugManufacturers.FillCache(ds.Tables["DrugManufacturer"]);
                DrugUnits.FillCache(ds.Tables["DrugUnit"]);
            }
            if (itypes.Contains((int)InvalidType.Views) || isAll)
            {
                ApptViews.FillCache(ds.Tables["ApptView"]);
                ApptViewItems.FillCache(ds.Tables["ApptViewItem"]);
                AppointmentRules.FillCache(ds.Tables["AppointmentRule"]);
                ProcApptColors.FillCache(ds.Tables["ProcApptColor"]);
            }
            if (itypes.Contains((int)InvalidType.Wiki) || isAll)
            {
                WikiListHeaderWidths.FillCache(ds.Tables["WikiListHeaderWidth"]);
                WikiPages.FillCache(ds.Tables["WikiPage"]);
            }
            if (itypes.Contains((int)InvalidType.ZipCodes) || isAll)
            {
                ZipCodes.FillCache(ds.Tables["ZipCode"]);
            }
        }
Exemple #12
0
        public static List <DisplayField> GetDefaultList(DisplayFieldCategory category)
        {
            //No need to check RemotingRole; no call to db.
            List <DisplayField> list = new List <DisplayField>();

            if (category == DisplayFieldCategory.None)
            {
                list.Add(new DisplayField("Date", 67, category));
                //list.Add(new DisplayField("Time",40));
                list.Add(new DisplayField("Th", 27, category));
                list.Add(new DisplayField("Surf", 40, category));
                list.Add(new DisplayField("Dx", 28, category));
                list.Add(new DisplayField("Description", 218, category));
                list.Add(new DisplayField("Stat", 25, category));
                list.Add(new DisplayField("Prov", 42, category));
                list.Add(new DisplayField("Amount", 48, category));
                list.Add(new DisplayField("ADA Code", 62, category));
                list.Add(new DisplayField("User", 62, category));
                list.Add(new DisplayField("Signed", 55, category));
                //list.Add(new DisplayField("Priority",65,category));
                //list.Add(new DisplayField("Date TP",67,category));
                //list.Add(new DisplayField("Date Entry",67,category));
                //list.Add(new DisplayField("Prognosis",60,category));
                //list.Add(new DisplayField("Length",40,category));
                //if(Programs.UsingOrion){
                //list.Add(new DisplayField("DPC",33,category));
                //list.Add(new DisplayField("Schedule By",72,category));
                //list.Add(new DisplayField("Stop Clock",67,category));
                //list.Add(new DisplayField("Stat 2",36,category));
                //list.Add(new DisplayField("On Call",45,category));
                //list.Add(new DisplayField("Effective Comm",90,category));
                //list.Add(new DisplayField("End Time",56,category));
                //list.Add(new DisplayField("Quadrant",55,category));
                //list.Add(new DisplayField("DPCpost",52,category));
                //}
            }
            else if (category == DisplayFieldCategory.PatientSelect)
            {
                list.Add(new DisplayField("LastName", 75, category));
                list.Add(new DisplayField("First Name", 75, category));
                //list.Add(new DisplayField("MI",25,category));
                list.Add(new DisplayField("Pref Name", 60, category));
                list.Add(new DisplayField("Age", 30, category));
                list.Add(new DisplayField("SSN", 65, category));
                list.Add(new DisplayField("Hm Phone", 90, category));
                list.Add(new DisplayField("Wk Phone", 90, category));
                list.Add(new DisplayField("PatNum", 80, category));
                //list.Add(new DisplayField("ChartNum",60,category));
                list.Add(new DisplayField("Address", 100, category));
                list.Add(new DisplayField("Status", 65, category));
                //list.Add(new DisplayField("Bill Type",90,category));
                //list.Add(new DisplayField("City",80,category));
                //list.Add(new DisplayField("State",55,category));
                //list.Add(new DisplayField("Pri Prov",85,category));
                //list.Add(new DisplayField("Birthdate",70,category));
                //list.Add(new DisplayField("Site",90,category));
            }
            else if (category == DisplayFieldCategory.PatientInformation)
            {
                list.Add(new DisplayField("Last", 0, category));
                list.Add(new DisplayField("First", 0, category));
                list.Add(new DisplayField("Middle", 0, category));
                list.Add(new DisplayField("Preferred", 0, category));
                list.Add(new DisplayField("Title", 0, category));
                list.Add(new DisplayField("Salutation", 0, category));
                list.Add(new DisplayField("Status", 0, category));
                list.Add(new DisplayField("Gender", 0, category));
                list.Add(new DisplayField("Position", 0, category));
                list.Add(new DisplayField("Birthdate", 0, category));
                list.Add(new DisplayField("Age", 0, category));
                list.Add(new DisplayField("SS#", 0, category));
                list.Add(new DisplayField("Address", 0, category));
                list.Add(new DisplayField("Address2", 0, category));
                list.Add(new DisplayField("City", 0, category));
                list.Add(new DisplayField("State", 0, category));
                list.Add(new DisplayField("Zip", 0, category));
                list.Add(new DisplayField("Hm Phone", 0, category));
                list.Add(new DisplayField("Wk Phone", 0, category));
                list.Add(new DisplayField("Wireless Ph", 0, category));
                list.Add(new DisplayField("E-mail", 0, category));
                list.Add(new DisplayField("Contact Method", 0, category));
                list.Add(new DisplayField("ABC0", 0, category));
                //list.Add(new DisplayField("Chart Num",0,category));
                list.Add(new DisplayField("Billing Type", 0, category));
                //list.Add(new DisplayField("Ward",0,category));
                //list.Add(new DisplayField("AdmitDate",0,category));
                list.Add(new DisplayField("Primary Provider", 0, category));
                list.Add(new DisplayField("Sec. Provider", 0, category));
                list.Add(new DisplayField("Language", 0, category));
                //list.Add(new DisplayField("Clinic",0,category));
                //list.Add(new DisplayField("ResponsParty",0,category));
                list.Add(new DisplayField("Referrals", 0, category));
                list.Add(new DisplayField("Addr/Ph Note", 0, category));
                list.Add(new DisplayField("PatFields", 0, category));
                //list.Add(new DisplayField("Guardians",0,category));
                //list.Add(new DisplayField("Arrive Early",0,category));
                //list.Add(new DisplayField("Super Head",0,category));
            }
            else if (category == DisplayFieldCategory.AccountModule)
            {
                list.Add(new DisplayField("Date", 65, category));
                list.Add(new DisplayField("Patient", 100, category));
                list.Add(new DisplayField("Prov", 40, category));
                //list.Add(new DisplayField("Clinic",50,category));
                list.Add(new DisplayField("Code", 46, category));
                list.Add(new DisplayField("Tth", 26, category));
                list.Add(new DisplayField("Description", 270, category));
                list.Add(new DisplayField("Charges", 60, category));
                list.Add(new DisplayField("Credits", 60, category));
                list.Add(new DisplayField("Balance", 60, category));
            }
            else if (category == DisplayFieldCategory.RecallList)
            {
                list.Add(new DisplayField("Due Date", 75, category));
                list.Add(new DisplayField("Patient", 120, category));
                list.Add(new DisplayField("Age", 30, category));
                list.Add(new DisplayField("Type", 60, category));
                list.Add(new DisplayField("Interval", 50, category));
                list.Add(new DisplayField("#Remind", 55, category));
                list.Add(new DisplayField("LastRemind", 75, category));
                list.Add(new DisplayField("Contact", 120, category));
                list.Add(new DisplayField("Status", 130, category));
                list.Add(new DisplayField("Note", 215, category));
                //list.Add(new DisplayField("BillingType",100,category));
            }
            else if (category == DisplayFieldCategory.ChartPatientInformation)
            {
                list.Add(new DisplayField("Age", 0, category));
                list.Add(new DisplayField("ABC0", 0, category));
                list.Add(new DisplayField("Billing Type", 0, category));
                list.Add(new DisplayField("Referred From", 0, category));
                list.Add(new DisplayField("Date First Visit", 0, category));
                list.Add(new DisplayField("Prov. (Pri, Sec)", 0, category));
                list.Add(new DisplayField("Pri Ins", 0, category));
                list.Add(new DisplayField("Sec Ins", 0, category));
                if (PrefC.GetBool(PrefName.DistributorKey))
                {
                    list.Add(new DisplayField("Registration Keys", 0, category));
                    list.Add(new DisplayField("Ehr Provider Keys", 0, category));
                }
                //different default list for eCW:
                if (!Programs.UsingEcwTight())
                {
                    list.Add(new DisplayField("Premedicate", 0, category));
                    list.Add(new DisplayField("Problems", 0, category));
                    list.Add(new DisplayField("Med Urgent", 0, category));
                    list.Add(new DisplayField("Medical Summary", 0, category));
                    list.Add(new DisplayField("Service Notes", 0, category));
                    list.Add(new DisplayField("Medications", 0, category));
                    list.Add(new DisplayField("Allergies", 0, category));
                }
                //list.Add(new DisplayField("PatFields",0,category));
                //list.Add(new DisplayField("Birthdate",0,category));
                //list.Add(new DisplayField("City",0,category));
                //list.Add(new DisplayField("AskToArriveEarly",0,category));
                //list.Add(new DisplayField("Super Head",0,category));
            }
            else if (category == DisplayFieldCategory.ProcedureGroupNote)
            {
                list.Add(new DisplayField("Date", 67, category));
                list.Add(new DisplayField("Th", 27, category));
                list.Add(new DisplayField("Surf", 40, category));
                list.Add(new DisplayField("Description", 203, category));
                list.Add(new DisplayField("Stat", 25, category));
                list.Add(new DisplayField("Prov", 42, category));
                list.Add(new DisplayField("Amount", 48, category));
                list.Add(new DisplayField("ADA Code", 62, category));
                //if(Programs.UsingOrion){
                //  list.Add(new DisplayField("Stat 2",36,category));
                //  list.Add(new DisplayField("On Call",45,category));
                //  list.Add(new DisplayField("Effective Comm",90,category));
                //  list.Add(new DisplayField("Repair",45,category));
                //	list.Add(new DisplayField("DPCpost",52,category));
                //}
            }
            else if (category == DisplayFieldCategory.TreatmentPlanModule)
            {
                list.Add(new DisplayField("Done", 50, category));
                list.Add(new DisplayField("Priority", 50, category));
                list.Add(new DisplayField("Tth", 40, category));
                list.Add(new DisplayField("Surf", 45, category));
                list.Add(new DisplayField("Code", 50, category));
                list.Add(new DisplayField("Description", 235, category));
                list.Add(new DisplayField("Fee", 50, category));
                list.Add(new DisplayField("Pri Ins", 50, category));
                list.Add(new DisplayField("Sec Ins", 50, category));
                list.Add(new DisplayField("Discount", 55, category));
                list.Add(new DisplayField("Pat", 50, category));
                //list.Add(new DisplayField("Prognosis",60,category));
                //list.Add(new DisplayField("Dx",28,category));
            }
            else if (category == DisplayFieldCategory.OrthoChart)
            {
                //Ortho chart has no default columns.  User must explicitly set up columns.
            }
            return(list);
        }
Exemple #13
0
        ///<summary>only if ClientWeb</summary>
        public static void FillCache(DataSet ds, params InvalidType[] arrayITypes)
        {
            List <InvalidType> listITypes = arrayITypes.ToList();
            bool isAll = false;

            if (listITypes.Contains(InvalidType.AllLocal))
            {
                isAll = true;
            }
            //All Internal OD Tables that are cached go here
            if (PrefC.IsODHQ)
            {
                if (listITypes.Contains(InvalidType.JobPermission) || isAll)
                {
                    ds.Tables.Add(JobPermissions.RefreshCache());
                }
                if (listITypes.Contains(InvalidType.PhoneComps) || isAll)
                {
                    PhoneComps.FillCacheFromTable(ds.Tables["PhoneComp"]);
                }
            }
            if (listITypes.Contains(InvalidType.AccountingAutoPays) || isAll)
            {
                AccountingAutoPays.FillCacheFromTable(ds.Tables["AccountingAutoPay"]);
            }
            //if(listITypes.Contains(InvalidType.AlertItems) || isAll) {//THIS IS NOT CACHED. But is used to make server run the alert logic in OpenDentalService.
            //	AlertSubs.FillCache(ds.Tables["AlertItem"]);
            //}
            if (listITypes.Contains(InvalidType.AlertCategories) || isAll)
            {
                AlertCategories.FillCacheFromTable(ds.Tables["AlertCategory"]);
            }
            if (listITypes.Contains(InvalidType.AlertCategoryLinks) || isAll)
            {
                AlertCategoryLinks.FillCacheFromTable(ds.Tables["AlertCategoryLink"]);
            }
            if (listITypes.Contains(InvalidType.AppointmentTypes) || isAll)
            {
                AppointmentTypes.FillCacheFromTable(ds.Tables["AppointmentType"]);
            }
            if (listITypes.Contains(InvalidType.AutoCodes) || isAll)
            {
                AutoCodes.FillCacheFromTable(ds.Tables["AutoCode"]);
                AutoCodeItems.FillCacheFromTable(ds.Tables["AutoCodeItem"]);
                AutoCodeConds.FillCacheFromTable(ds.Tables["AutoCodeCond"]);
            }
            if (listITypes.Contains(InvalidType.Automation) || isAll)
            {
                Automations.FillCacheFromTable(ds.Tables["Automation"]);
            }
            if (listITypes.Contains(InvalidType.AutoNotes) || isAll)
            {
                AutoNotes.FillCacheFromTable(ds.Tables["AutoNote"]);
                AutoNoteControls.FillCacheFromTable(ds.Tables["AutoNoteControl"]);
            }
            if (listITypes.Contains(InvalidType.Carriers) || isAll)
            {
                Carriers.FillCacheFromTable(ds.Tables["Carrier"]);                //run on startup, after telephone reformat, after list edit.
            }
            if (listITypes.Contains(InvalidType.ClaimForms) || isAll)
            {
                ClaimFormItems.FillCacheFromTable(ds.Tables["ClaimFormItem"]);
                ClaimForms.FillCacheFromTable(ds.Tables["ClaimForm"]);
            }
            if (listITypes.Contains(InvalidType.ClearHouses) || isAll)
            {
                Clearinghouses.FillCacheFromTable(ds.Tables["Clearinghouse"]);
            }
            if (listITypes.Contains(InvalidType.ClinicErxs) || isAll)
            {
                ClinicErxs.FillCacheFromTable(ds.Tables["ClinicErx"]);
            }
            if (listITypes.Contains(InvalidType.ClinicPrefs) || isAll)
            {
                ClinicPrefs.FillCacheFromTable(ds.Tables["ClinicPref"]);
            }
            if (listITypes.Contains(InvalidType.Computers) || isAll)
            {
                Computers.FillCacheFromTable(ds.Tables["Computer"]);
                Printers.FillCacheFromTable(ds.Tables["Printer"]);
            }
            if (listITypes.Contains(InvalidType.Defs) || isAll)
            {
                Defs.FillCacheFromTable(ds.Tables["Def"]);
            }
            if (listITypes.Contains(InvalidType.DentalSchools) || isAll)
            {
                SchoolClasses.FillCacheFromTable(ds.Tables["SchoolClass"]);
                SchoolCourses.FillCacheFromTable(ds.Tables["SchoolCourse"]);
            }
            if (listITypes.Contains(InvalidType.DictCustoms) || isAll)
            {
                DictCustoms.FillCacheFromTable(ds.Tables["DictCustom"]);
            }
            if (listITypes.Contains(InvalidType.Diseases) || isAll)
            {
                DiseaseDefs.FillCacheFromTable(ds.Tables["DiseaseDef"]);
                ICD9s.FillCacheFromTable(ds.Tables["ICD9"]);
            }
            if (listITypes.Contains(InvalidType.DisplayFields) || isAll)
            {
                DisplayFields.FillCacheFromTable(ds.Tables["DisplayField"]);
            }
            if (listITypes.Contains(InvalidType.DisplayReports) || isAll)
            {
                DisplayReports.FillCacheFromTable(ds.Tables["DisplayReport"]);
            }
            if (listITypes.Contains(InvalidType.Ebills) || isAll)
            {
                Ebills.FillCacheFromTable(ds.Tables["Ebill"]);
            }
            if (listITypes.Contains(InvalidType.ElectIDs) || isAll)
            {
                ElectIDs.FillCacheFromTable(ds.Tables["ElectID"]);
            }
            if (listITypes.Contains(InvalidType.Email) || isAll)
            {
                EmailAddresses.FillCacheFromTable(ds.Tables["EmailAddress"]);
                EmailTemplates.FillCacheFromTable(ds.Tables["EmailTemplate"]);
            }
            if (listITypes.Contains(InvalidType.Employees) || isAll)
            {
                Employees.FillCacheFromTable(ds.Tables["Employee"]);
                PayPeriods.FillCacheFromTable(ds.Tables["PayPeriod"]);
            }
            if (listITypes.Contains(InvalidType.Employers) || isAll)
            {
                Employers.FillCacheFromTable(ds.Tables["Employer"]);
            }
            if (listITypes.Contains(InvalidType.Fees) || isAll)
            {
                Fees.FillCacheFromTable(ds.Tables["Fee"]);
            }
            if (listITypes.Contains(InvalidType.FeeScheds) || isAll)
            {
                FeeScheds.FillCacheFromTable(ds.Tables["FeeSched"]);
            }
            if (listITypes.Contains(InvalidType.HL7Defs) || isAll)
            {
                HL7Defs.FillCacheFromTable(ds.Tables["HL7Def"]);
                HL7DefMessages.FillCacheFromTable(ds.Tables["HL7DefMessage"]);
                HL7DefSegments.FillCacheFromTable(ds.Tables["HL7DefSegment"]);
                HL7DefFields.FillCacheFromTable(ds.Tables["HL7DefField"]);
            }
            if (listITypes.Contains(InvalidType.InsCats) || isAll)
            {
                CovCats.FillCacheFromTable(ds.Tables["CovCat"]);
                CovSpans.FillCacheFromTable(ds.Tables["CovSpan"]);
            }
            if (listITypes.Contains(InvalidType.InsFilingCodes) || isAll)
            {
                InsFilingCodes.FillCacheFromTable(ds.Tables["InsFilingCode"]);
                InsFilingCodeSubtypes.FillCacheFromTable(ds.Tables["InsFilingCodeSubtype"]);
            }
            if (listITypes.Contains(InvalidType.Languages) || isAll)
            {
                Lans.FillCacheFromTable(ds.Tables["Language"]);
            }
            if (listITypes.Contains(InvalidType.Letters) || isAll)
            {
                Letters.FillCacheFromTable(ds.Tables["Letter"]);
            }
            if (listITypes.Contains(InvalidType.LetterMerge) || isAll)
            {
                LetterMergeFields.FillCacheFromTable(ds.Tables["LetterMergeField"]);
                LetterMerges.FillCacheFromTable(ds.Tables["LetterMerge"]);
            }
            if (listITypes.Contains(InvalidType.Medications) || isAll)
            {
                Medications.FillCacheFromTable(ds.Tables["Medication"]);
            }
            if (listITypes.Contains(InvalidType.Operatories) || isAll)
            {
                Operatories.FillCacheFromTable(ds.Tables["Operatory"]);
            }
            if (listITypes.Contains(InvalidType.OrthoChartTabs) || isAll)
            {
                OrthoChartTabs.FillCacheFromTable(ds.Tables["OrthoChartTab"]);
                OrthoChartTabLinks.FillCacheFromTable(ds.Tables["OrthoChartTabLink"]);
            }
            if (listITypes.Contains(InvalidType.PatFields) || isAll)
            {
                PatFieldDefs.FillCacheFromTable(ds.Tables["PatFieldDef"]);
                ApptFieldDefs.FillCacheFromTable(ds.Tables["ApptFieldDef"]);
            }
            if (listITypes.Contains(InvalidType.Pharmacies) || isAll)
            {
                Pharmacies.FillCacheFromTable(ds.Tables["Pharmacy"]);
            }
            if (listITypes.Contains(InvalidType.Prefs) || isAll)
            {
                Prefs.FillCacheFromTable(ds.Tables["Pref"]);
            }
            if (listITypes.Contains(InvalidType.ProcButtons) || isAll)
            {
                ProcButtons.FillCacheFromTable(ds.Tables["ProcButton"]);
                ProcButtonItems.FillCacheFromTable(ds.Tables["ProcButtonItem"]);
            }
            if (listITypes.Contains(InvalidType.ProcCodes) || isAll)
            {
                ProcedureCodes.FillCacheFromTable(ds.Tables["ProcedureCode"]);
                ProcCodeNotes.FillCacheFromTable(ds.Tables["ProcCodeNote"]);
            }
            if (listITypes.Contains(InvalidType.Programs) || isAll)
            {
                Programs.FillCacheFromTable(ds.Tables["Program"]);
                ProgramProperties.FillCacheFromTable(ds.Tables["ProgramProperty"]);
            }
            if (listITypes.Contains(InvalidType.ProviderErxs) || isAll)
            {
                ProviderErxs.FillCacheFromTable(ds.Tables["ProviderErx"]);
            }
            if (listITypes.Contains(InvalidType.ProviderIdents) || isAll)
            {
                ProviderIdents.FillCacheFromTable(ds.Tables["ProviderIdent"]);
            }
            if (listITypes.Contains(InvalidType.Providers) || isAll)
            {
                Providers.FillCacheFromTable(ds.Tables["Provider"]);
                //Refresh the clinics as well because InvalidType.Providers has a comment that says "also includes clinics".  Also, there currently isn't an itype for Clinics.
                Clinics.FillCacheFromTable(ds.Tables["clinic"]);                //Case must match the table name in Clinics.RefrechCache().
            }
            if (listITypes.Contains(InvalidType.QuickPaste) || isAll)
            {
                QuickPasteNotes.FillCacheFromTable(ds.Tables["QuickPasteNote"]);
                QuickPasteCats.FillCacheFromTable(ds.Tables["QuickPasteCat"]);
            }
            if (listITypes.Contains(InvalidType.RecallTypes) || isAll)
            {
                RecallTypes.FillCacheFromTable(ds.Tables["RecallType"]);
                RecallTriggers.FillCacheFromTable(ds.Tables["RecallTrigger"]);
            }
            if (listITypes.Contains(InvalidType.ReplicationServers) || isAll)
            {
                ReplicationServers.FillCacheFromTable(ds.Tables["ReplicationServer"]);
            }
            //if(itypes.Contains(InvalidType.RequiredFields) || isAll) {
            //	RequiredFields.FillCache(ds.Tables["RequiredField"]);
            //}
            if (listITypes.Contains(InvalidType.Security) || isAll)
            {
                Userods.FillCacheFromTable(ds.Tables["Userod"]);
                UserGroups.FillCacheFromTable(ds.Tables["UserGroup"]);
                UserGroupAttaches.FillCacheFromTable(ds.Tables["UserGroupAttach"]);
            }
            if (listITypes.Contains(InvalidType.Sheets) || isAll)
            {
                SheetDefs.FillCacheFromTable(ds.Tables["SheetDef"]);
                SheetFieldDefs.FillCacheFromTable(ds.Tables["SheetFieldDef"]);
            }
            if (listITypes.Contains(InvalidType.SigMessages) || isAll)
            {
                SigElementDefs.FillCacheFromTable(ds.Tables["SigElementDef"]);
                SigButDefs.FillCacheFromTable(ds.Tables["SigButDef"]);
            }
            if (listITypes.Contains(InvalidType.Sites) || isAll)
            {
                Sites.FillCacheFromTable(ds.Tables["Site"]);
                if (PrefC.IsODHQ)
                {
                    SiteLinks.FillCacheFromTable(ds.Tables["SiteLink"]);
                }
            }
            if (listITypes.Contains(InvalidType.SmsBlockPhones) || isAll)
            {
                SmsBlockPhones.FillCacheFromTable(ds.Tables["SmsBlockPhone"]);
            }
            if (listITypes.Contains(InvalidType.SmsPhones) || isAll)
            {
                SmsPhones.FillCacheFromTable(ds.Tables["SmsPhone"]);
            }
            if (listITypes.Contains(InvalidType.Sops) || isAll)
            {
                Sops.FillCacheFromTable(ds.Tables["Sop"]);
            }
            if (listITypes.Contains(InvalidType.StateAbbrs) || isAll)
            {
                StateAbbrs.FillCacheFromTable(ds.Tables["StateAbbr"]);
            }
            if (listITypes.Contains(InvalidType.TimeCardRules) || isAll)
            {
                TimeCardRules.FillCacheFromTable(ds.Tables["TimeCardRule"]);
            }
            //InvalidTypes.Tasks not handled here.
            if (listITypes.Contains(InvalidType.ToolBut) || isAll)
            {
                ToolButItems.FillCacheFromTable(ds.Tables["ToolButItem"]);
            }
            if (listITypes.Contains(InvalidType.UserClinics) || isAll)
            {
                UserClinics.FillCacheFromTable(ds.Tables["UserClinic"]);
            }
            if (listITypes.Contains(InvalidType.UserQueries) || isAll)
            {
                UserQueries.FillCacheFromTable(ds.Tables["UserQuery"]);
            }
            if (listITypes.Contains(InvalidType.Vaccines) || isAll)
            {
                VaccineDefs.FillCacheFromTable(ds.Tables["VaccineDef"]);
                DrugManufacturers.FillCacheFromTable(ds.Tables["DrugManufacturer"]);
                DrugUnits.FillCacheFromTable(ds.Tables["DrugUnit"]);
            }
            if (listITypes.Contains(InvalidType.Views) || isAll)
            {
                ApptViews.FillCacheFromTable(ds.Tables["ApptView"]);
                ApptViewItems.FillCacheFromTable(ds.Tables["ApptViewItem"]);
                AppointmentRules.FillCacheFromTable(ds.Tables["AppointmentRule"]);
                ProcApptColors.FillCacheFromTable(ds.Tables["ProcApptColor"]);
            }
            if (listITypes.Contains(InvalidType.Wiki) || isAll)
            {
                WikiListHeaderWidths.FillCacheFromTable(ds.Tables["WikiListHeaderWidth"]);
                WikiPages.FillCache(ds.Tables["WikiPage"]);
            }
            if (listITypes.Contains(InvalidType.ZipCodes) || isAll)
            {
                ZipCodes.FillCacheFromTable(ds.Tables["ZipCode"]);
            }
        }
Exemple #14
0
        ///<summary>For each enabled bridge, if the bridge uses a file to transmit patient data to the other software, then we need to remove the files or clear the files when OD is exiting.
        ///Required for EHR 2014 module d.7 (as stated by proctor).</summary>
        public static void ScrubExportedPatientData()
        {
            //List all program links here. If there is nothing to do for that link, then create a comment stating so.
            string path = "";

            //Apixia:
            ScrubFileForProperty(ProgramName.Apixia, "System path to Apixia Digital Imaging ini file", "", true);         //C:\Program Files\Digirex\Switch.ini
            //Apteryx: Has no file paths containing outgoing patient data from Open Dental.
            //BioPAK: Has no file paths containing outgoing patient data from Open Dental.
            //CallFire: Has no file paths containing outgoing patient data from Open Dental.
            //Camsight: Has no file paths containing outgoing patient data from Open Dental.
            //CaptureLink: Has no file paths containing outgoing patient data from Open Dental.
            //Cerec: Has no file paths containing outgoing patient data from Open Dental.
            //CliniView: Has no file paths containing outgoing patient data from Open Dental.
            //ClioSoft: Has no file paths containing outgoing patient data from Open Dental.
            //DBSWin:
            ScrubFileForProperty(ProgramName.DBSWin, "Text file path", "", true);         //C:\patdata.txt
            //DentalEye: Has no file paths containing outgoing patient data from Open Dental.
            //DentalStudio: Has no file paths containing outgoing patient data from Open Dental.
            //DentForms: Has no file paths containing outgoing patient data from Open Dental.
            //DentX: Has no file paths containing outgoing patient data from Open Dental.
            //Dexis:
            ScrubFileForProperty(ProgramName.Dexis, "InfoFile path", "", true);         //InfoFile.txt
            //Digora: Has no file paths containing outgoing patient data from Open Dental.
            //Divvy: Has no file paths containing outgoing patient data from Open Dental.
            //Dolphin:
            ScrubFileForProperty(ProgramName.Dolphin, "Filename", "", true);         //C:\Dolphin\Import\Import.txt
            //DrCeph: Has no file paths containing outgoing patient data from Open Dental.
            //Dxis: Has no file paths containing outgoing patient data from Open Dental.
            //EasyNotesPro: Has no file paths containing outgoing patient data from Open Dental.
            //eClinicalWorks: HL7 files are created, but eCW is supposed to consume and delete them.
            //EvaSoft: Has no file paths containing outgoing patient data from Open Dental.
            //EwooEZDent:
            Program program = Programs.GetCur(ProgramName.EwooEZDent);

            if (program.Enabled)
            {
                path = Programs.GetProgramPath(program);
                if (File.Exists(path))
                {
                    string dir     = Path.GetDirectoryName(path);
                    string linkage = CodeBase.ODFileUtils.CombinePaths(dir, "linkage.xml");
                    if (File.Exists(linkage))
                    {
                        try {
                            File.Delete(linkage);
                        }
                        catch {
                            //Another instance of OD might be closing at the same time, in which case the delete will fail. Could also be a permission issue or a concurrency issue. Ignore.
                        }
                    }
                }
            }
            //FloridaProbe: Has no file paths containing outgoing patient data from Open Dental.
            //Guru: Has no file paths containing outgoing patient data from Open Dental.
            //HouseCalls:
            ScrubFileForProperty(ProgramName.HouseCalls, "Export Path", "Appt.txt", true);         //C:\HouseCalls\Appt.txt
            //IAP: Has no file paths containing outgoing patient data from Open Dental.
            //iCat:
            ScrubFileForProperty(ProgramName.iCat, "XML output file path", "", true);         //C:\iCat\Out\pm.xml
            //ImageFX: Has no file paths containing outgoing patient data from Open Dental.
            //Lightyear: Has no file paths containing outgoing patient data from Open Dental.
            //MediaDent:
            ScrubFileForProperty(ProgramName.MediaDent, "Text file path", "", true);         //C:\MediadentInfo.txt
            //MiPACS: Has no file paths containing outgoing patient data from Open Dental.
            //Mountainside: Has no file paths containing outgoing patient data from Open Dental.
            //NewCrop: Has no file paths containing outgoing patient data from Open Dental.
            //Orion: Has no file paths containing outgoing patient data from Open Dental.
            //OrthoPlex: Has no file paths containing outgoing patient data from Open Dental.
            //Owandy: Has no file paths containing outgoing patient data from Open Dental.
            //PayConnect: Has no file paths containing outgoing patient data from Open Dental.
            //Patterson:
            ScrubFileForProperty(ProgramName.Patterson, "System path to Patterson Imaging ini", "", true);         //C:\Program Files\PDI\Shared files\Imaging.ini
            //PerioPal: Has no file paths containing outgoing patient data from Open Dental.
            //Planmeca: Has no file paths containing outgoing patient data from Open Dental.
            //PracticeWebReports: Has no file paths containing outgoing patient data from Open Dental.
            //Progeny: Has no file paths containing outgoing patient data from Open Dental.
            //PT: Per our website "The files involved get deleted immediately after they are consumed."
            //PTupdate: Per our website "The files involved get deleted immediately after they are consumed."
            //RayMage: Has no file paths containing outgoing patient data from Open Dental.
            //Schick: Has no file paths containing outgoing patient data from Open Dental.
            //Sirona:
            program = Programs.GetCur(ProgramName.Sirona);
            if (program.Enabled)
            {
                path = Programs.GetProgramPath(program);
                //read file C:\sidexis\sifiledb.ini
                string iniFile = Path.GetDirectoryName(path) + "\\sifiledb.ini";
                if (File.Exists(iniFile))
                {
                    string sendBox = ReadValueFromIni("FromStation0", "File", iniFile);
                    if (File.Exists(sendBox))
                    {
                        File.WriteAllText(sendBox, "");                       //Clear the sendbox instead of deleting.
                    }
                }
            }
            //Sopro: Has no file paths containing outgoing patient data from Open Dental.
            //TigerView:
            ScrubFileForProperty(ProgramName.TigerView, "Tiger1.ini path", "", false);         //C:\Program Files\PDI\Shared files\Imaging.ini.  TigerView complains if the file is not present.
            //Trojan: Has no file paths containing outgoing patient data from Open Dental.
            //Trophy: Has no file paths containing outgoing patient data from Open Dental.
            //TrophyEnhanced: Has no file paths containing outgoing patient data from Open Dental.
            //Tscan: Has no file paths containing outgoing patient data from Open Dental.
            //UAppoint: Has no file paths containing outgoing patient data from Open Dental.
            //Vipersoft: Has no file paths containing outgoing patient data from Open Dental.
            //VixWin: Has no file paths containing outgoing patient data from Open Dental.
            //VixWinBase41: Has no file paths containing outgoing patient data from Open Dental.
            //VixWinOld: Has no file paths containing outgoing patient data from Open Dental.
            //Xcharge: Has no file paths containing outgoing patient data from Open Dental.
            ScrubFileForProperty(ProgramName.XDR, "InfoFile path", "", true);         //C:\XDRClient\Bin\infofile.txt
        }
Exemple #15
0
 ///<summary>Pass in a serialized dto.  It returns a dto which must be deserialized by the client.
 ///Set serverMapPath to the root directory of the OpenDentalServerConfig.xml.  Typically Server.MapPath(".") from a web service.
 ///Optional parameter because it is not necessary for Unit Tests (mock server).</summary>
 public static string ProcessDto(string dtoString, string serverMapPath = "")
 {
                 #if DEBUG
     //System.Threading.Thread.Sleep(100);//to test slowness issues with web service.
                 #endif
     DataTransferObject dto = DataTransferObject.Deserialize(dtoString);
     try {
         string[] methNameComps = GetComponentsFromDtoMeth(dto.MethodName);
         if (methNameComps.Length == 3 && methNameComps[2].ToLower() == "hashpassword")
         {
             return(GetHashPassword(dto));
         }
         //Always attempt to set the database connection settings from the config file if they haven't been set yet.
         //We use to ONLY load in database settings when Security.LogInWeb was called but that is not good enough now that we have more services.
         //E.g. We do not want to manually call "Security.LogInWeb" from the CEMT when all we want is a single preference value.
         if (string.IsNullOrEmpty(DataConnection.GetServerName()) && string.IsNullOrEmpty(DataConnection.GetConnectionString()))
         {
             RemotingClient.RemotingRole = RemotingRole.ServerWeb;
             //the application virtual path is usually /OpenDentalServer, but may be different if hosting multiple databases on one IIS server
             string configFilePath = "";
             if (!string.IsNullOrWhiteSpace(HostingEnvironment.ApplicationVirtualPath) && HostingEnvironment.ApplicationVirtualPath.Length > 1)
             {
                 //There can be multiple config files within a physical path that is shared by multiple IIS ASP.NET applications.
                 //In order for the same physical path to host multiple applications, they each need a unique config file for db connection settings.
                 //Each application will have a unique ApplicationVirtualPath which we will use to identify the corresponding config.xml.
                 configFilePath = ODFileUtils.CombinePaths(serverMapPath, HostingEnvironment.ApplicationVirtualPath.Trim('/') + "Config.xml");
             }
             if (string.IsNullOrWhiteSpace(configFilePath) ||
                 !File.Exists(configFilePath))                           //returns false if the file doesn't exist, user doesn't have permission for file, path is blank or null
             {
                 //either configFilePath not set or file doesn't exist, default to OpenDentalServerConfig.xml
                 configFilePath = ODFileUtils.CombinePaths(serverMapPath, "OpenDentalServerConfig.xml");
             }
             Userods.LoadDatabaseInfoFromFile(configFilePath);
         }
         //Set Security.CurUser so that queries can be run against the db as if it were this user.
         Security.CurUser = Userods.CheckUserAndPassword(dto.Credentials.Username
                                                         , dto.Credentials.Password
                                                         , Programs.IsEnabled(ProgramName.eClinicalWorks));
         Security.PasswordTyped = dto.Credentials.Password;
         Type type = dto.GetType();
         #region DtoGetTable
         if (type == typeof(DtoGetTable))
         {
             DtoGetTable dtoGetTable        = (DtoGetTable)dto;
             string[]    fullNameComponents = GetComponentsFromDtoMeth(dtoGetTable.MethodName);
             string      assemblyName       = fullNameComponents[0];       //OpenDentBusiness or else a plugin name
             string      className          = fullNameComponents[1];
             string      methodName         = fullNameComponents[2];
             Type        classType          = null;
             Assembly    ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetTable.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetTable.MethodName);
             }
             object[]  paramObjs = DtoObject.GenerateObjects(parameters);
             DataTable dt        = (DataTable)methodInfo.Invoke(null, paramObjs);
             String    response  = XmlConverter.TableToXml(dt);
             return(response);
         }
         #endregion
         #region DtoGetTableLow
         else if (type == typeof(DtoGetTableLow))
         {
             DtoGetTableLow dtoGetTableLow = (DtoGetTableLow)dto;
             DtoObject[]    parameters     = dtoGetTableLow.Params;
             object[]       paramObjs      = DtoObject.GenerateObjects(parameters);
             DataTable      dt             = Reports.GetTable((string)paramObjs[0]);
             String         response       = XmlConverter.TableToXml(dt);
             return(response);
         }
         #endregion
         #region DtoGetDS
         else if (type == typeof(DtoGetDS))
         {
             DtoGetDS dtoGetDS           = (DtoGetDS)dto;
             string[] fullNameComponents = GetComponentsFromDtoMeth(dtoGetDS.MethodName);
             string   assemblyName       = fullNameComponents[0];          //OpenDentBusiness or else a plugin name
             string   className          = fullNameComponents[1];
             string   methodName         = fullNameComponents[2];
             Type     classType          = null;
             Assembly ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetDS.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetDS.MethodName);
             }
             object[] paramObjs = DtoObject.GenerateObjects(parameters);
             DataSet  ds        = (DataSet)methodInfo.Invoke(null, paramObjs);
             String   response  = XmlConverter.DsToXml(ds);
             return(response);
         }
         #endregion
         #region DtoGetSerializableDictionary
         else if (type == typeof(DtoGetSerializableDictionary))
         {
             DtoGetSerializableDictionary dtoGetSD = (DtoGetSerializableDictionary)dto;
             string[] fullNameComponents           = GetComponentsFromDtoMeth(dtoGetSD.MethodName);
             string   assemblyName = fullNameComponents[0];                //OpenDentBusiness or else a plugin name
             string   className    = fullNameComponents[1];
             string   methodName   = fullNameComponents[2];
             Type     classType    = null;
             Assembly ass          = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetSD.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetSD.MethodName);
             }
             object[] paramObjs  = DtoObject.GenerateObjects(parameters);
             Object   objResult  = methodInfo.Invoke(null, paramObjs);
             Type     returnType = methodInfo.ReturnType;
             return(XmlConverter.Serialize(returnType, objResult));
         }
         #endregion
         #region DtoGetLong
         else if (type == typeof(DtoGetLong))
         {
             DtoGetLong dtoGetLong         = (DtoGetLong)dto;
             string[]   fullNameComponents = GetComponentsFromDtoMeth(dtoGetLong.MethodName);
             string     assemblyName       = fullNameComponents[0];        //OpenDentBusiness or else a plugin name
             string     className          = fullNameComponents[1];
             string     methodName         = fullNameComponents[2];
             Type       classType          = null;
             Assembly   ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetLong.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetLong.MethodName);
             }
             object[] paramObjs  = DtoObject.GenerateObjects(parameters);
             long     longResult = (long)methodInfo.Invoke(null, paramObjs);
             return(longResult.ToString());
         }
         #endregion
         #region DtoGetInt
         else if (type == typeof(DtoGetInt))
         {
             DtoGetInt dtoGetInt          = (DtoGetInt)dto;
             string[]  fullNameComponents = GetComponentsFromDtoMeth(dtoGetInt.MethodName);
             string    assemblyName       = fullNameComponents[0];         //OpenDentBusiness or else a plugin name
             string    className          = fullNameComponents[1];
             string    methodName         = fullNameComponents[2];
             Type      classType          = null;
             Assembly  ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetInt.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetInt.MethodName);
             }
             object[] paramObjs = DtoObject.GenerateObjects(parameters);
             int      intResult = (int)methodInfo.Invoke(null, paramObjs);
             return(intResult.ToString());
         }
         #endregion
         #region DtoGetDouble
         else if (type == typeof(DtoGetDouble))
         {
             DtoGetDouble dtoGetDouble       = (DtoGetDouble)dto;
             string[]     fullNameComponents = GetComponentsFromDtoMeth(dtoGetDouble.MethodName);
             string       assemblyName       = fullNameComponents[0];      //OpenDentBusiness or else a plugin name
             string       className          = fullNameComponents[1];
             string       methodName         = fullNameComponents[2];
             Type         classType          = null;
             Assembly     ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetDouble.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetDouble.MethodName);
             }
             object[] paramObjs    = DtoObject.GenerateObjects(parameters);
             double   doubleResult = (double)methodInfo.Invoke(null, paramObjs);
             return(doubleResult.ToString());
         }
         #endregion
         #region DtoGetVoid
         else if (type == typeof(DtoGetVoid))
         {
             DtoGetVoid dtoGetVoid         = (DtoGetVoid)dto;
             string[]   fullNameComponents = GetComponentsFromDtoMeth(dtoGetVoid.MethodName);
             string     assemblyName       = fullNameComponents[0];        //OpenDentBusiness or else a plugin name
             string     className          = fullNameComponents[1];
             string     methodName         = fullNameComponents[2];
             Type       classType          = null;
             Assembly   ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetVoid.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetVoid.MethodName);
             }
             object[] paramObjs = DtoObject.GenerateObjects(parameters);
             methodInfo.Invoke(null, paramObjs);
             return("0");
         }
         #endregion
         #region DtoGetObject
         else if (type == typeof(DtoGetObject))
         {
             DtoGetObject dtoGetObject       = (DtoGetObject)dto;
             string[]     fullNameComponents = GetComponentsFromDtoMeth(dtoGetObject.MethodName);
             string       assemblyName       = fullNameComponents[0];      //OpenDentBusiness or else a plugin name
             string       className          = fullNameComponents[1];
             string       methodName         = fullNameComponents[2];
             //if(className != "Security" || methodName != "LogInWeb") {//because credentials will be checked inside that method
             //	Userods.CheckCredentials(dtoGetObject.Credentials);//will throw exception if fails.
             //}
             Type     classType = null;
             Assembly ass       = Plugins.GetAssembly(assemblyName);
             //if(className!="Security" || methodName!="LogInWeb") {//Do this for everything except Security.LogInWeb, because Plugins.GetAssembly will fail in that case.
             //	ass=Plugins.GetAssembly(assemblyName);
             //}
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetObject.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetObject.MethodName);
             }
             if (className == "Security" && methodName == "LogInWeb")
             {
                 parameters[2] = new DtoObject(serverMapPath, typeof(string));                     //because we can't access this variable from within OpenDentBusiness.
                 RemotingClient.RemotingRole = RemotingRole.ServerWeb;
             }
             object[] paramObjs  = DtoObject.GenerateObjects(parameters);
             Object   objResult  = methodInfo.Invoke(null, paramObjs);
             Type     returnType = methodInfo.ReturnType;
             if (returnType.IsInterface)
             {
                 objResult  = new DtoObject(objResult, objResult?.GetType() ?? returnType);
                 returnType = typeof(DtoObject);
             }
             return(XmlConverter.Serialize(returnType, objResult));
         }
         #endregion
         #region DtoGetString
         else if (type == typeof(DtoGetString))
         {
             DtoGetString dtoGetString       = (DtoGetString)dto;
             string[]     fullNameComponents = GetComponentsFromDtoMeth(dtoGetString.MethodName);
             string       assemblyName       = fullNameComponents[0];      //OpenDentBusiness or else a plugin name
             string       className          = fullNameComponents[1];
             string       methodName         = fullNameComponents[2];
             Type         classType          = null;
             Assembly     ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetString.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetString.MethodName);
             }
             object[] paramObjs = DtoObject.GenerateObjects(parameters);
             string   strResult = (string)methodInfo.Invoke(null, paramObjs);
             strResult = XmlConverter.XmlEscape(strResult);
             return(strResult);
         }
         #endregion
         #region DtoGetBool
         else if (type == typeof(DtoGetBool))
         {
             DtoGetBool dtoGetBool         = (DtoGetBool)dto;
             string[]   fullNameComponents = GetComponentsFromDtoMeth(dtoGetBool.MethodName);
             string     assemblyName       = fullNameComponents[0];        //OpenDentBusiness or else a plugin name
             string     className          = fullNameComponents[1];
             string     methodName         = fullNameComponents[2];
             Type       classType          = null;
             Assembly   ass = Plugins.GetAssembly(assemblyName);
             if (ass == null)
             {
                 classType = Type.GetType(assemblyName                      //actually, the namespace which we require to be same as assembly by convention
                                          + "." + className + "," + assemblyName);
             }
             else                                     //plugin was found
             {
                 classType = ass.GetType(assemblyName //actually, the namespace which we require to be same as assembly by convention
                                         + "." + className);
             }
             DtoObject[] parameters = dtoGetBool.Params;
             Type[]      paramTypes = DtoObject.GenerateTypes(parameters, assemblyName);
             MethodInfo  methodInfo = classType.GetMethod(methodName, paramTypes);
             if (methodInfo == null)
             {
                 throw new ApplicationException("Method not found with " + parameters.Length.ToString() + " parameters: " + dtoGetBool.MethodName);
             }
             object[] paramObjs  = DtoObject.GenerateObjects(parameters);
             bool     boolResult = (bool)methodInfo.Invoke(null, paramObjs);
             return(boolResult.ToString());
         }
         #endregion
         else
         {
             throw new NotSupportedException("Dto type not supported: " + type.FullName);
         }
     }
     catch (Exception e) {
         DtoException exception = new DtoException();
         exception.ExceptionType = e.GetType().BaseType.Name;              //Since the exception was down converted to a regular exception, we need the BaseType.
         if (e.InnerException == null)
         {
             exception.Message = e.Message;
         }
         else
         {
             exception.Message = e.InnerException.Message;
         }
         return(exception.Serialize());
     }
 }
Exemple #16
0
        ///<summary>Tries each of the phone numbers provided in the list one at a time until it succeeds.</summary>
        public static bool SendData(Patient pat, long clinicNum)
        {
            List <string> listPhoneNumbers = new List <string>()
            {
                pat.WirelessPhone, pat.HmPhone
            };
            string firstName    = pat.FName;
            string lastName     = pat.LName;
            string emailIn      = pat.Email;
            string isTestString = "false";
            string locationId   = ProgramProperties.GetPropValForClinicOrDefault(Programs.GetProgramNum(ProgramName.Podium), PropertyDescs.LocationID, clinicNum);
            int    statusCode   = -100;         //Set default to a failure, negative because http status codes are 1xx-5xx

#if DEBUG
            isTestString = "true";
#endif
            for (int i = 0; i < listPhoneNumbers.Count; i++)
            {
                string phoneNumber = new string(listPhoneNumbers[i].Where(x => char.IsDigit(x)).ToArray());
                if (phoneNumber == "")
                {
                    continue;
                }
                string apiUrl   = "https://podium.co/api/v2/review_invitations";
                string apiToken = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.Podium), PropertyDescs.APIToken);             //I might be able to use _programNum here if static is per class like I think it is
                if (string.IsNullOrEmpty(locationId))
                {
                    return(false);
                }
                try {
                    using (WebClientEx client = new WebClientEx()) {
                        client.Headers[HttpRequestHeader.Accept]        = "application/json";
                        client.Headers[HttpRequestHeader.ContentType]   = "application/json";
                        client.Headers[HttpRequestHeader.Authorization] = "Token token=\"" + apiToken + "\"";
                        client.Encoding = UnicodeEncoding.UTF8;
                        string bodyJson = string.Format(@"
						{{
							""locationId"": ""{0}"",
							""lastName"": ""{3}"",
							""firstName"": ""{2}"",
							""email"": ""{4}"",
							""phoneNumber"": ""{1}"",
							""integrationName"": ""opendental"",
							""test"": {5}
						}}"                        , locationId, phoneNumber, firstName, lastName, emailIn, isTestString);
                        //Post with Authorization headers and a body comprised of a JSON serialized anonymous type.
                        client.UploadString(apiUrl, "POST", bodyJson);
                        statusCode = (int)(client.StatusCode);
                        if (statusCode.Between(200, 299))
                        {
                            MakeCommlog(pat, phoneNumber, statusCode);
                            return(true);
                        }
                    }
                }
                catch (WebException we) {
                    if (we.Response.GetType() == typeof(HttpWebResponse))
                    {
                        statusCode = (int)((HttpWebResponse)we.Response).StatusCode;
                    }
                }
                catch (Exception) {
                    //Do nothing because a verbose commlog will be made below if all phone numbers fail.
                }
            }
            MakeCommlog(pat, "", statusCode);
            //explicitly failed or did not succeed.
            return(false);
            //Sample Request:

            //Accept: 'application/json's
            //Content-Type: 'application/json'
            //Authorization: 'Token token="my_dummy_token"'
            //Body:
            //{
            //	"location_id": "54321",
            //	"phone_number": "1234567890",
            //	"customer": {
            //		"first_name": "Johnny",
            //		"last_name": "Appleseed",
            //		"email": "*****@*****.**"
            //	},
            //	"test": true
            //}
            //NOTE:  There will never be a value after "customer": although it was initially interpreted that there would be a "new" flag there.
        }
Exemple #17
0
 ///<summary>Returns serialized DbInfo object as JSON string of database info from both the preference table and non preferernce table info.
 ///Every unique bit of information is individually try / caught so that we return as much information as possible.</summary>
 private string GetDbInfoJSON(long patNum, string moduleName)
 {
     _info = new BugSubmission.SubmissionInfo();
     ODException.SwallowAnyException(() => {
         //This list is not in a separate method because we want to ensure that future development related to bug submissions don't try to make assumptions
         //on which preferences are in an object at any given time.
         //Ex.  Let's say in version 17.4, the list doesn't contain the payplan version preference, but 17.5 does.
         //If we called the method that retrieves the used preferences from WebServiceMainHQ which in this example is on version 17.5,
         // it would think all bugsubmission rows contain the payplan version preference when that is not the case.
         List <PrefName> listPrefs = new List <PrefName>()
         {
             PrefName.AtoZfolderUsed,
             PrefName.ClaimSnapshotEnabled,
             PrefName.ClaimSnapshotRunTime,
             PrefName.ClaimSnapshotTriggerType,
             PrefName.CorruptedDatabase,
             PrefName.DataBaseVersion,
             PrefName.EasyNoClinics,
             PrefName.LanguageAndRegion,
             PrefName.MySqlVersion,
             PrefName.PayPlansVersion,
             PrefName.ProcessSigsIntervalInSecs,
             PrefName.ProgramVersionLastUpdated,
             PrefName.ProgramVersion,
             PrefName.RandomPrimaryKeys,
             PrefName.RegistrationKey,
             PrefName.RegistrationKeyIsDisabled,
             PrefName.ReplicationFailureAtServer_id,
             PrefName.ReportingServerCompName,
             PrefName.ReportingServerDbName,
             PrefName.ReportingServerMySqlUser,
             PrefName.ReportingServerMySqlPassHash,
             PrefName.ReportingServerURI,
             PrefName.SecurityLogOffAfterMinutes,
             PrefName.WebServiceServerName
         };
         foreach (PrefName pref in listPrefs)
         {
             _info.DictPrefValues[pref] = Prefs.GetOne(pref).ValueString;
         }
     });
     ODException.SwallowAnyException(() => { _info.CountClinics = Clinics.GetCount(); });
     ODException.SwallowAnyException(() => { _info.EnabledPlugins = Programs.GetWhere(x => x.Enabled && !string.IsNullOrWhiteSpace(x.PluginDllName)).Select(x => x.ProgName).ToList(); });
     ODException.SwallowAnyException(() => { _info.ClinicNumCur = Clinics.ClinicNum; });
     ODException.SwallowAnyException(() => { _info.UserNumCur = Security.CurUser.UserNum; });
     ODException.SwallowAnyException(() => { _info.PatientNumCur = patNum; });
     ODException.SwallowAnyException(() => { _info.IsOfficeOnReplication = (ReplicationServers.GetCount() > 0 ? true : false); });
     ODException.SwallowAnyException(() => { _info.IsOfficeUsingMiddleTier = (RemotingClient.RemotingRole == RemotingRole.ClientWeb ? true : false); });
     ODException.SwallowAnyException(() => { _info.WindowsVersion = MiscData.GetOSVersionInfo(); });
     ODException.SwallowAnyException(() => { _info.CompName = Security.CurComputerName; });
     ODException.SwallowAnyException(() => {
         List <UpdateHistory> listHist = UpdateHistories.GetPreviousUpdateHistories(2);                        //Ordered by newer versions first.
         _info.PreviousUpdateVersion   = listHist.Count == 2 ? listHist[1].ProgramVersion : "";                //Show the previous version they updated from
         _info.PreviousUpdateTime      = listHist.Count > 0 ? listHist[0].DateTimeUpdated : DateTime.MinValue; //Show when they updated to the current version.
     });
     ODException.SwallowAnyException(() => { _info.ModuleNameCur = moduleName; });
     ODException.SwallowAnyException(() => { _info.DatabaseName = DataConnection.GetDatabaseName(); });
     ODException.SwallowAnyException(() => { _info.OpenDentBusinessVersion = MiscData.GetAssemblyVersion(); });
     ODException.SwallowAnyException(() => { _info.OpenDentBusinessMiddleTierVersion = MiscData.GetAssemblyVersionForMiddleTier(); });
     return(JsonConvert.SerializeObject(_info, new JsonSerializerSettings {
         NullValueHandling = NullValueHandling.Ignore
     }));
 }
Exemple #18
0
 protected override void FillCacheIfNeeded()
 {
     Programs.GetTableFromCache(false);
 }
Exemple #19
0
        private static void MakeCommlog(Patient pat, string phoneNumber, int statusCode)
        {
            string commText = "";

            //Status code meanings:
            //		-100: Patient had no phone number
            //		-200: Patient can't text and had no email
            //		2XX: Successfully sent message
            //		422: Message has already been sent for patient
            //		Anything else: Failure of some sort.
            switch (statusCode / 100)           //Get general http status codes e.g. -100=-1, 203=2
            {
            case -1:                            //Failure, no phone number
                commText = Lans.g("Podium", "Podium review invitation request failed because there was no phone number.  Error code:") + " " + statusCode;
                break;

            case -2:                            //Failure, no email
                commText = Lans.g("Podium", "Podium review invitation request failed because the patient doesn't accept texts "
                                  + "and there was no email address.  Error code:") + " " + statusCode;
                break;

            case 2:                     //Success https://httpstatusdogs.com/200-ok
                commText = Lans.g("Podium", "Podium review invitation request successfully sent.");
                break;

            case 4:                     //Client side communication failure https://httpstatusdogs.com/400-bad-request
                if (statusCode == 422)  //422 is Unprocessable Entity, which is sent in this case when a phone number has received an invite already.
                {
                    commText = Lans.g("Podium", "The request failed because an identical request was previously sent.");
                }
                else
                {
                    commText = Lans.g("Podium", "The request failed to reach Podium with error code:") + " " + statusCode;
                }
                break;

            case 5:                     //Server side internal failure. https://httpstatusdogs.com/500-internal-server-error
                commText = Lans.g("Podium", "The request was rejected by the Podium server with error code:") + " " + statusCode;
                break;

            default:                            //General Failure
                commText = Lans.g("Podium", "The request failed to send with error code:") + " " + statusCode;
                break;
            }
            if (!string.IsNullOrEmpty(commText))
            {
                commText += "\r\n";
            }
            commText += Lans.g("Podium", "The information sent in the request was") + ": \r\n"
                        + Lans.g("Podium", "First name") + ": \"" + pat.FName + "\", "
                        + Lans.g("Podium", "Last name") + ": \"" + pat.LName + "\", "
                        + Lans.g("Podium", "Email") + ": \"" + pat.Email + "\"";
            if (phoneNumber != "")           //If "successful".
            {
                commText += ", " + Lans.g("Podium", "Phone number") + ": \"" + phoneNumber + "\"";
            }
            else
            {
                string        wirelessPhone = new string(pat.WirelessPhone.Where(x => char.IsDigit(x)).ToArray());
                string        homePhone = new string(pat.HmPhone.Where(x => char.IsDigit(x)).ToArray());
                List <string> phonesTried = new List <string> {
                    wirelessPhone, homePhone
                }.FindAll(x => x != "");
                string phoneNumbersTried = ", " + Lans.g("Podium", "No valid phone number found.");
                if (pat.TxtMsgOk == YN.No || (pat.TxtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)))             //Used email
                {
                    phoneNumbersTried = "";
                }
                else if (phonesTried.Count > 0)
                {
                    phoneNumbersTried = ", " + Lans.g("Podium", "Phone numbers tried") + ": " + string.Join(", ", phonesTried);
                }
                commText += phoneNumbersTried;
            }
            long    programNum = Programs.GetProgramNum(ProgramName.Podium);
            Commlog commlogCur = new Commlog();

            commlogCur.CommDateTime   = DateTime.Now;
            commlogCur.DateTimeEnd    = DateTime.Now;
            commlogCur.PatNum         = pat.PatNum;
            commlogCur.UserNum        = 0;   //run from server, no valid CurUser
            commlogCur.CommSource     = CommItemSource.ProgramLink;
            commlogCur.ProgramNum     = programNum;
            commlogCur.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
            commlogCur.Note           = commText;
            commlogCur.Mode_          = CommItemMode.Text;
            commlogCur.SentOrReceived = CommSentOrReceived.Sent;
            Commlogs.Insert(commlogCur);
        }
Exemple #20
0
 ///<summary>Returns a list of toolbutitems for the specified toolbar. Used when laying out toolbars.</summary>
 public static List <ToolButItem> GetForToolBar(ToolBarsAvail toolbar)
 {
     //No need to check RemotingRole; no call to db.
     return(GetWhere(x => x.ToolBar == toolbar && Programs.IsEnabled(x.ProgramNum)));
 }
Exemple #21
0
        ///<summary>If ClientWeb, then this method is instead run on the server, and the result passed back to the client.  And since it's ClientWeb, FillCache will be run on the client.</summary>
        public static DataSet GetCacheDs(bool doRefreshServerCache, params InvalidType[] arrayITypes)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetDS(MethodBase.GetCurrentMethod(), doRefreshServerCache, arrayITypes));
            }
            Logger.LogToPath("", LogPath.Signals, LogPhase.Start, "InvalidType(s): " + string.Join(" - ", arrayITypes.OrderBy(x => x.ToString())));
            List <InvalidType> listITypes = arrayITypes.ToList();
            //so this part below only happens if direct or server------------------------------------------------
            bool isAll = false;

            if (listITypes.Contains(InvalidType.AllLocal))
            {
                isAll = true;
            }
            DataSet ds = new DataSet();

            //All Internal OD Tables that are cached go here
            if (PrefC.IsODHQ)
            {
                if (listITypes.Contains(InvalidType.JobPermission) || isAll)
                {
                    ds.Tables.Add(JobPermissions.RefreshCache());
                }
                if (listITypes.Contains(InvalidType.PhoneComps) || isAll)
                {
                    ds.Tables.Add(PhoneComps.GetTableFromCache(doRefreshServerCache));
                }
            }
            //All cached public tables go here
            if (listITypes.Contains(InvalidType.AccountingAutoPays) || isAll)
            {
                ds.Tables.Add(AccountingAutoPays.GetTableFromCache(doRefreshServerCache));
            }
            //if(listITypes.Contains(InvalidType.AlertItems) || isAll) {//THIS IS NOT CACHED. But is used to make server run the alert logic in OpenDentalService.
            //	ds.Tables.Add(AlertItems.RefreshCache());
            //}
            if (listITypes.Contains(InvalidType.AlertCategories) || isAll)
            {
                ds.Tables.Add(AlertCategories.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AlertCategoryLinks) || isAll)
            {
                ds.Tables.Add(AlertCategoryLinks.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AppointmentTypes) || isAll)
            {
                ds.Tables.Add(AppointmentTypes.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AutoCodes) || isAll)
            {
                ds.Tables.Add(AutoCodes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AutoCodeItems.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AutoCodeConds.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Automation) || isAll)
            {
                ds.Tables.Add(Automations.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.AutoNotes) || isAll)
            {
                ds.Tables.Add(AutoNotes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AutoNoteControls.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Carriers) || isAll)
            {
                ds.Tables.Add(Carriers.GetTableFromCache(doRefreshServerCache));                //run on startup, after telephone reformat, after list edit.
            }
            if (listITypes.Contains(InvalidType.ClaimForms) || isAll)
            {
                ds.Tables.Add(ClaimFormItems.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ClaimForms.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ClearHouses) || isAll)
            {
                ds.Tables.Add(Clearinghouses.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ClinicErxs) || isAll)
            {
                ds.Tables.Add(ClinicErxs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ClinicPrefs) || isAll)
            {
                ds.Tables.Add(ClinicPrefs.GetTableFromCache(doRefreshServerCache));
            }
            //InvalidType.Clinics see InvalidType.Providers
            if (listITypes.Contains(InvalidType.Computers) || isAll)
            {
                ds.Tables.Add(Computers.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(Printers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Defs) || isAll)
            {
                ds.Tables.Add(Defs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DentalSchools) || isAll)
            {
                ds.Tables.Add(SchoolClasses.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(SchoolCourses.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DictCustoms) || isAll)
            {
                ds.Tables.Add(DictCustoms.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Diseases) || isAll)
            {
                ds.Tables.Add(DiseaseDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ICD9s.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DisplayFields) || isAll)
            {
                ds.Tables.Add(DisplayFields.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.DisplayReports) || isAll)
            {
                ds.Tables.Add(DisplayReports.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Ebills) || isAll)
            {
                ds.Tables.Add(Ebills.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.EhrCodes))
            {
                EhrCodes.UpdateList();                //Unusual pattern for an unusual "table".  Not really a table, but a mishmash of hard coded partial code systems that are needed for CQMs.
            }
            if (listITypes.Contains(InvalidType.ElectIDs) || isAll)
            {
                ds.Tables.Add(ElectIDs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Email) || isAll)
            {
                ds.Tables.Add(EmailAddresses.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(EmailTemplates.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(EmailAutographs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Employees) || isAll)
            {
                ds.Tables.Add(Employees.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(PayPeriods.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Employers) || isAll)
            {
                ds.Tables.Add(Employers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Fees) || isAll)
            {
                //Fee Cache follows an unusual pattern. This fills the cache with the HQ fees, and whatever clinics happen to be currently cached.
                ds.Tables.Add(Fees.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.FeeScheds) || isAll)
            {
                ds.Tables.Add(FeeScheds.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.HL7Defs) || isAll)
            {
                ds.Tables.Add(HL7Defs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(HL7DefMessages.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(HL7DefSegments.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(HL7DefFields.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.InsCats) || isAll)
            {
                ds.Tables.Add(CovCats.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(CovSpans.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.InsFilingCodes) || isAll)
            {
                ds.Tables.Add(InsFilingCodes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(InsFilingCodeSubtypes.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Languages) || isAll)
            {
                if (CultureInfo.CurrentCulture.Name != "en-US")
                {
                    ds.Tables.Add(Lans.GetTableFromCache(doRefreshServerCache));
                }
            }
            if (listITypes.Contains(InvalidType.Letters) || isAll)
            {
                ds.Tables.Add(Letters.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.LetterMerge) || isAll)
            {
                ds.Tables.Add(LetterMergeFields.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(LetterMerges.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Medications) || isAll)
            {
                ds.Tables.Add(Medications.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Operatories) || isAll)
            {
                ds.Tables.Add(Operatories.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.OrthoChartTabs) || isAll)
            {
                ds.Tables.Add(OrthoChartTabs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(OrthoChartTabLinks.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.PatFields) || isAll)
            {
                ds.Tables.Add(PatFieldDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ApptFieldDefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Pharmacies) || isAll)
            {
                ds.Tables.Add(Pharmacies.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Prefs) || isAll)
            {
                ds.Tables.Add(Prefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProcButtons) || isAll)
            {
                ds.Tables.Add(ProcButtons.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProcButtonItems.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProcCodes) || isAll)
            {
                ds.Tables.Add(ProcedureCodes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProcCodeNotes.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Programs) || isAll)
            {
                ds.Tables.Add(Programs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProgramProperties.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProviderErxs) || isAll)
            {
                ds.Tables.Add(ProviderErxs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ProviderIdents) || isAll)
            {
                ds.Tables.Add(ProviderIdents.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Providers) || isAll)
            {
                ds.Tables.Add(Providers.GetTableFromCache(doRefreshServerCache));
                //Refresh the clinics as well because InvalidType.Providers has a comment that says "also includes clinics".  Also, there currently isn't an itype for Clinics.
                ds.Tables.Add(Clinics.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.QuickPaste) || isAll)
            {
                ds.Tables.Add(QuickPasteNotes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(QuickPasteCats.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.RecallTypes) || isAll)
            {
                ds.Tables.Add(RecallTypes.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(RecallTriggers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ReplicationServers) || isAll)
            {
                ds.Tables.Add(ReplicationServers.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.RequiredFields) || isAll)
            {
                ds.Tables.Add(RequiredFields.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(RequiredFieldConditions.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Security) || isAll)
            {
                ds.Tables.Add(Userods.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(UserGroups.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(GroupPermissions.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(UserGroupAttaches.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Sheets) || isAll)
            {
                ds.Tables.Add(SheetDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(SheetFieldDefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.SigMessages) || isAll)
            {
                ds.Tables.Add(SigElementDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(SigButDefs.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Sites) || isAll)
            {
                ds.Tables.Add(Sites.GetTableFromCache(doRefreshServerCache));
                if (PrefC.IsODHQ)
                {
                    ds.Tables.Add(SiteLinks.GetTableFromCache(doRefreshServerCache));
                }
            }
            if (listITypes.Contains(InvalidType.SmsBlockPhones) || isAll)
            {
                ds.Tables.Add(SmsBlockPhones.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.SmsPhones) || isAll)
            {
                ds.Tables.Add(SmsPhones.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Sops) || isAll)               //InvalidType.Sops is currently never used 11/14/2014
            {
                ds.Tables.Add(Sops.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.StateAbbrs) || isAll)
            {
                ds.Tables.Add(StateAbbrs.GetTableFromCache(doRefreshServerCache));
            }
            //InvalidTypes.Tasks not handled here.
            if (listITypes.Contains(InvalidType.TimeCardRules) || isAll)
            {
                ds.Tables.Add(TimeCardRules.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.ToolBut) || isAll)
            {
                ds.Tables.Add(ToolButItems.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.UserClinics) || isAll)
            {
                ds.Tables.Add(UserClinics.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.UserQueries) || isAll)
            {
                ds.Tables.Add(UserQueries.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Vaccines) || isAll)
            {
                ds.Tables.Add(VaccineDefs.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(DrugManufacturers.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(DrugUnits.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Views) || isAll)
            {
                ds.Tables.Add(ApptViews.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ApptViewItems.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(AppointmentRules.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(ProcApptColors.GetTableFromCache(doRefreshServerCache));
            }
            if (listITypes.Contains(InvalidType.Wiki) || isAll)
            {
                ds.Tables.Add(WikiListHeaderWidths.GetTableFromCache(doRefreshServerCache));
                ds.Tables.Add(WikiPages.RefreshCache());
            }
            if (listITypes.Contains(InvalidType.ZipCodes) || isAll)
            {
                ds.Tables.Add(ZipCodes.GetTableFromCache(doRefreshServerCache));
            }
            Logger.LogToPath("", LogPath.Signals, LogPhase.End);
            return(ds);
        }
        ///<summary>Called by local practice db to query HQ for EService setup info. Must remain very lite and versionless. Will be used by signup portal.
        ///If HasClinics==true then any SignupOut.EServices entries where ClinicNum==0 are invalid and should be ignored.
        ///If HasClinics==false then SignupOut.EServices should only pay attention items where ClinicNum==0.
        ///This list is kept completely unfiltered by ClinicNum for forward compatibility reasons.
        ///The ClinicNum 0 items are always used by the Signup portal to determine default signup preferences.
        ///However, these items are only used for validation and billing in the case where HasClinics==true.</summary>
        public static EServiceSetup.SignupOut GetEServiceSetupFull(SignupPortalPermission permission, bool isSwitchClinicPref = false)
        {
            //Clinics will be stored in this order at HQ to allow signup portal to display them in proper order.
            List <Clinic> clinics = Clinics.GetDeepCopy().OrderBy(x => x.ItemOrder).ToList();

            if (PrefC.GetBool(PrefName.ClinicListIsAlphabetical))
            {
                clinics = clinics.OrderBy(x => x.Abbr).ToList();
            }
#if DEBUG
            bool isMockChanged = false;
            if (WebServiceMainHQProxy.MockWebServiceMainHQ == null)
            {
                WebServiceMainHQProxy.MockWebServiceMainHQ = new WebServiceMainHQMockDemo();
                isMockChanged = true;
            }
#endif
            EServiceSetup.SignupOut signupOut = ReadXml <EServiceSetup.SignupOut>
                                                (
                WebSerializer.DeserializePrimitiveOrThrow <string>
                (
                    GetWebServiceMainHQInstance().EServiceSetup
                    (
                        CreateWebServiceHQPayload
                        (
                            WriteXml(new EServiceSetup.SignupIn()
            {
                MethodNameInt = (int)EServiceSetup.SetupMethod.GetSignupOutFull,
                HasClinics    = PrefC.HasClinicsEnabled,
                //ClinicNum is not currently used as input.
                ClinicNum                 = 0,
                ProgramVersionStr         = PrefC.GetString(PrefName.ProgramVersion),
                SignupPortalPermissionInt = (int)permission,
                Clinics = clinics
                          .Select(x => new EServiceSetup.SignupIn.ClinicLiteIn()
                {
                    ClinicNum   = x.ClinicNum,
                    ClinicTitle = x.Abbr,
                    IsHidden    = x.IsHidden,
                }).ToList(),
                IsSwitchClinicPref = isSwitchClinicPref,
            }), eServiceCode.Undefined
                        )
                    )
                )
                                                );
#if DEBUG
            if (isMockChanged)
            {
                WebServiceMainHQProxy.MockWebServiceMainHQ = null;
            }
#endif
            //We just got the latest sync info from HQ so update the local db to reflect what HQ says is true.
            #region Reconcile Phones
            List <SmsPhone> listPhonesHQ = signupOut.Phones.Select(x => new SmsPhone()
            {
                ClinicNum        = x.ClinicNum,
                CountryCode      = x.CountryCode,
                DateTimeActive   = x.DateTimeActive,
                DateTimeInactive = x.DateTimeInactive,
                InactiveCode     = x.InactiveCode,
                PhoneNumber      = x.PhoneNumber,
            }).ToList();
            SmsPhones.UpdateOrInsertFromList(listPhonesHQ);
            #endregion
            #region Reconcile practice and clinics
            List <EServiceSetup.SignupOut.SignupOutSms> smsSignups = GetSignups <EServiceSetup.SignupOut.SignupOutSms>(signupOut, eServiceCode.IntegratedTexting);
            bool isCacheInvalid = false;
            bool isSmsEnabled   = false;
            if (PrefC.HasClinicsEnabled)              //Clinics are ON so loop through all clinics and reconcile with HQ.
            {
                List <Clinic> listClinicsAll = Clinics.GetDeepCopy();
                foreach (Clinic clinicDb in listClinicsAll)
                {
                    WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms clinicSignup =
                        smsSignups.FirstOrDefault(x => x.ClinicNum == clinicDb.ClinicNum) ?? new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms()
                    {
                        //Not found so turn it off.
                        SmsContractDate = DateTime.MinValue,
                        MonthlySmsLimit = 0,
                        IsEnabled       = false,
                    };
                    Clinic clinicNew = clinicDb.Copy();
                    clinicNew.SmsContractDate = clinicSignup.SmsContractDate;
                    clinicNew.SmsMonthlyLimit = clinicSignup.MonthlySmsLimit;
                    isCacheInvalid           |= Clinics.Update(clinicNew, clinicDb);
                    isSmsEnabled |= clinicSignup.IsEnabled;
                }
            }
            else               //Clinics are off so ClinicNum 0 is the practice clinic.
            {
                WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms practiceSignup =
                    smsSignups.FirstOrDefault(x => x.ClinicNum == 0) ?? new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms()
                {
                    //Not found so turn it off.
                    SmsContractDate = DateTime.MinValue,
                    MonthlySmsLimit = 0,
                    IsEnabled       = false,
                };
                isCacheInvalid
                    |= Prefs.UpdateDateT(PrefName.SmsContractDate, practiceSignup.SmsContractDate)
                       | Prefs.UpdateLong(PrefName.TextingDefaultClinicNum, 0)
                       | Prefs.UpdateDouble(PrefName.SmsMonthlyLimit, practiceSignup.MonthlySmsLimit);
                isSmsEnabled |= practiceSignup.IsEnabled;
            }
            #endregion
            #region Reconcile CallFire
            //Turn off CallFire if SMS has been activated.
            //This only happens the first time SMS is turned on and CallFire is still activated.
            if (isSmsEnabled && Programs.IsEnabled(ProgramName.CallFire))
            {
                Program callfire = Programs.GetCur(ProgramName.CallFire);
                if (callfire != null)
                {
                    callfire.Enabled = false;
                    Programs.Update(callfire);
                    Signalods.Insert(new Signalod()
                    {
                        IType = InvalidType.Providers
                    });
                    signupOut.Prompts.Add("Call Fire has been disabled. Cancel Integrated Texting and access program properties to retain Call Fire.");
                }
            }
            #endregion
            #region eConfirmations
            if (Prefs.UpdateBool(PrefName.ApptConfirmAutoSignedUp, IsEServiceActive(signupOut, eServiceCode.ConfirmationRequest)))
            {
                //HQ does not match the local pref. Make it match with HQ.
                isCacheInvalid = true;
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Automated appointment eConfirmations automatically changed by HQ.  Local pref set to "
                                          + IsEServiceActive(signupOut, eServiceCode.ConfirmationRequest).ToString() + ".");
            }
            #endregion
            if (isCacheInvalid)              //Something changed in the db. Alert other workstations and change this workstation immediately.
            {
                Signalods.Insert(new Signalod()
                {
                    IType = InvalidType.Prefs
                });
                Prefs.RefreshCache();
                Signalods.Insert(new Signalod()
                {
                    IType = InvalidType.Providers
                });
                Providers.RefreshCache();
                Clinics.RefreshCache();
            }
            return(signupOut);
        }
Exemple #23
0
        ///<summary>Sends an SFTP message to TSI to suspend the account for the guarantor passed in.  Returns empty string if successful.
        ///Returns a translated error message that should be displayed to the user if anything goes wrong.</summary>
        public static string SuspendGuar(Patient guar)
        {
            PatAging patAging = Patients.GetAgingListFromGuarNums(new List <long>()
            {
                guar.PatNum
            }).FirstOrDefault();

            if (patAging == null)           //this would only happen if the patient was not in the db??, just in case
            {
                return(Lans.g("TsiTransLogs", "An error occurred when trying to send a suspend message to TSI."));
            }
            long    clinicNum = (PrefC.HasClinicsEnabled?guar.ClinicNum:0);
            Program prog      = Programs.GetCur(ProgramName.Transworld);

            if (prog == null)           //shouldn't be possible, the program link should always exist, just in case
            {
                return(Lans.g("TsiTransLogs", "The Transworld program link does not exist.  Contact support."));
            }
            Dictionary <long, List <ProgramProperty> > dictAllProps = ProgramProperties.GetForProgram(prog.ProgramNum)
                                                                      .GroupBy(x => x.ClinicNum)
                                                                      .ToDictionary(x => x.Key, x => x.ToList());

            if (dictAllProps.Count == 0)           //shouldn't be possible, there should always be a set of props for ClinicNum 0 even if disabled, just in case
            {
                return(Lans.g("TsiTransLogs", "The Transworld program link is not setup properly."));
            }
            if (PrefC.HasClinicsEnabled && !dictAllProps.ContainsKey(clinicNum) && dictAllProps.ContainsKey(0))
            {
                clinicNum = 0;
            }
            string clinicDesc = clinicNum == 0?"Headquarters":Clinics.GetDesc(clinicNum);

            if (!dictAllProps.ContainsKey(clinicNum) ||
                !ValidateClinicSftpDetails(dictAllProps[clinicNum], true))                    //the props should be valid, but this will test the connection using the props
            {
                return(Lans.g("TsiTransLogs", "The Transworld program link is not enabled") + " "
                       + (PrefC.HasClinicsEnabled?(Lans.g("TsiTransLogs", "for the guarantor's clinic") + ", " + clinicDesc + ", "):"")
                       + Lans.g("TsiTransLogs", "or is not setup properly."));
            }
            List <ProgramProperty> listProps = dictAllProps[clinicNum];
            long newBillType = PrefC.GetLong(PrefName.TransworldPaidInFullBillingType);

            if (newBillType == 0 || Defs.GetDef(DefCat.BillingTypes, newBillType) == null)
            {
                return(Lans.g("TsiTransLogs", "The default paid in full billing type is not set.  An automated suspend message cannot be sent until the "
                              + "default paid in full billing type is set in the Transworld program link")
                       + (PrefC.HasClinicsEnabled?(" " + Lans.g("TsiTransLogs", "for the guarantor's clinic") + ", " + clinicDesc):"") + ".");
            }
            string clientId = "";

            if (patAging.ListTsiLogs.Count > 0)
            {
                clientId = patAging.ListTsiLogs[0].ClientId;
            }
            if (string.IsNullOrEmpty(clientId))
            {
                clientId = listProps.Find(x => x.PropertyDesc == "ClientIdAccelerator")?.PropertyValue;
            }
            if (string.IsNullOrEmpty(clientId))
            {
                clientId = listProps.Find(x => x.PropertyDesc == "ClientIdCollection")?.PropertyValue;
            }
            if (string.IsNullOrEmpty(clientId))
            {
                return(Lans.g("TsiTransLogs", "There is no client ID in the Transworld program link")
                       + (PrefC.HasClinicsEnabled?(" " + Lans.g("TsiTransLogs", "for the guarantor's clinic") + ", " + clinicDesc):"") + ".");
            }
            string sftpAddress = listProps.Find(x => x.PropertyDesc == "SftpServerAddress")?.PropertyValue ?? "";
            int    sftpPort;

            if (!int.TryParse(listProps.Find(x => x.PropertyDesc == "SftpServerPort")?.PropertyValue ?? "", out sftpPort))
            {
                sftpPort = 22;              //default to port 22
            }
            string userName     = listProps.Find(x => x.PropertyDesc == "SftpUsername")?.PropertyValue ?? "";
            string userPassword = listProps.Find(x => x.PropertyDesc == "SftpPassword")?.PropertyValue ?? "";

            if (new[] { sftpAddress, userName, userPassword }.Any(x => string.IsNullOrEmpty(x)))
            {
                return(Lans.g("TsiTransLogs", "The SFTP address, username, or password for the Transworld program link") + " "
                       + (PrefC.HasClinicsEnabled?(Lans.g("TsiTransLogs", "for the guarantor's clinic") + ", " + clinicDesc + ", "):"") + Lans.g("TsiTransLogs", "is blank."));
            }
            string msg = TsiMsgConstructor.GenerateUpdate(patAging.PatNum, clientId, TsiTransType.SS, 0.00, patAging.AmountDue);

            try {
                byte[]          fileContents = Encoding.ASCII.GetBytes(TsiMsgConstructor.GetUpdateFileHeader() + "\r\n" + msg);
                TaskStateUpload state        = new Sftp.Upload(sftpAddress, userName, userPassword, sftpPort)
                {
                    Folder        = "/xfer/incoming",
                    FileName      = "TsiUpdates_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".txt",
                    FileContent   = fileContents,
                    HasExceptions = true
                };
                state.Execute(false);
            }
            catch (Exception ex) {
                return(Lans.g("TsiTransLogs", "There was an error sending the update message to Transworld")
                       + (PrefC.HasClinicsEnabled?(" " + Lans.g("TsiTransLogs", "using the program properties for the guarantor's clinic") + ", " + clinicDesc):"") + ".\r\n"
                       + ex.Message);
            }
            //Upload was successful
            TsiTransLog log = new TsiTransLog()
            {
                PatNum    = patAging.PatNum,
                UserNum   = Security.CurUser.UserNum,
                TransType = TsiTransType.SS,
                //TransDateTime=DateTime.Now,//set on insert, not editable by user
                //DemandType=TsiDemandType.Accelerator,//only valid for placement msgs
                //ServiceCode=TsiServiceCode.Diplomatic,//only valid for placement msgs
                ClientId       = clientId,
                TransAmt       = 0.00,
                AccountBalance = patAging.AmountDue,
                FKeyType       = TsiFKeyType.None, //only used for account trans updates
                FKey           = 0,                //only used for account trans updates
                RawMsgText     = msg,
                ClinicNum      = clinicNum
                                 //,TransJson=""//only valid for placement msgs
            };

            TsiTransLogs.Insert(log);
            //update family billing type to the paid in full billing type pref
            Patients.UpdateFamilyBillingType(newBillType, patAging.PatNum);
            return("");
        }
Exemple #24
0
        ///<summary>If this is middle tier, pass in null.</summary>
        public static void LoadAllPlugins(Form host)
        {
            //No need to check RemotingRole; no call to db.
            List <PluginContainer> listPlugins = new List <PluginContainer>();

            //Loop through all programs that are enabled with a plug-in dll name set.
            foreach (Program program in Programs.GetWhere(x => x.Enabled && !string.IsNullOrEmpty(x.PluginDllName)))
            {
                string dllPath = ODFileUtils.CombinePaths(Application.StartupPath, program.PluginDllName);
                if (RemotingClient.RemotingRole == RemotingRole.ServerWeb)
                {
                    dllPath = ODFileUtils.CombinePaths(System.Web.HttpContext.Current.Server.MapPath(null), program.PluginDllName);
                }
                //Check for the versioning trigger.
                //For example, the plug-in might be entered as MyPlugin[VersionMajMin].dll. The bracketed section will be removed when loading the dll.
                //So it will look for MyPlugin.dll as the dll to load. However, before it loads, it will look for a similar dll with a version number.
                //For example, if using version 14.3.23, it would look for MyPlugin14.3.dll.
                //If that file is found, it would replace MyPlugin.dll with the contents of MyPlugin14.3.dll, and then it would load MyPlugin.dll as normal.
                if (dllPath.Contains("[VersionMajMin]"))
                {
                    Version vers = new Version(Application.ProductVersion);
                    string  dllPathWithVersion = dllPath.Replace("[VersionMajMin]", vers.Major.ToString() + "." + vers.Minor.ToString());
                    dllPath = dllPath.Replace("[VersionMajMin]", "");                 //now stripped clean
                    if (File.Exists(dllPathWithVersion))
                    {
                        File.Copy(dllPathWithVersion, dllPath, true);
                    }
                    else
                    {
                        //try the Plugins folder
                        if (PrefC.AtoZfolderUsed != DataStorageType.InDatabase)                       //must have an AtoZ folder to check
                        {
                            string dllPathVersionCentral = FileAtoZ.CombinePaths(ImageStore.GetPreferredAtoZpath(), "Plugins",
                                                                                 program.PluginDllName.Replace("[VersionMajMin]", vers.Major.ToString() + "." + vers.Minor.ToString()));
                            if (FileAtoZ.Exists(dllPathVersionCentral))
                            {
                                FileAtoZ.Copy(dllPathVersionCentral, dllPath, FileAtoZSourceDestination.AtoZToLocal, doOverwrite: true);
                            }
                        }
                    }
                }
                //We now know the exact name of the dll for the plug-in.  Check to see if it is present.
                if (!File.Exists(dllPath))
                {
                    continue;                    //Nothing to do.
                }
                //The dll was found, try and load it in.
                PluginBase plugin  = null;
                Assembly   ass     = null;
                string     assName = "";
                try {
                    ass     = Assembly.LoadFile(dllPath);
                    assName = Path.GetFileNameWithoutExtension(dllPath);
                    string typeName = assName + ".Plugin";
                    Type   type     = ass.GetType(typeName);
                    plugin      = (PluginBase)Activator.CreateInstance(type);
                    plugin.Host = host;
                }
                catch (Exception ex) {
                    //Never try and show message boxes when on the middle tier, there is no UI.  We should instead log to a file or the event viewer.
                    if (RemotingClient.RemotingRole != RemotingRole.ServerWeb)
                    {
                        //Notify the user that their plug-in is not loaded.
                        MessageBox.Show("Error loading Plugin:" + program.PluginDllName + "\r\n" + ex.Message);
                    }
                    continue;                    //Don't add it to plugin list.
                }
                //The plug-in was successfully loaded and will start getting hook notifications.  Add it to the list of loaded plug-ins.
                PluginContainer container = new PluginContainer();
                container.Plugin     = plugin;
                container.ProgramNum = program.ProgramNum;
                container.Assemb     = ass;
                container.Name       = assName;
                listPlugins.Add(container);
            }
            ListPlugins = listPlugins;
        }