예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FnsConfigurationMgr"/> class.
 /// </summary>
 /// <param name="configFile">The config file.</param>
 public FnsConfigurationMgr(string configFile)
 {
     try
     {
         _registryDns = new ArrayList(10);
         if (configFile.Length <= 0)
         {
             return;
         }
         var addFnsBinDirPRefix = (configFile.Length == 0) || (configFile.Length > 0 && configFile.IndexOf("\\", StringComparison.Ordinal) == -1);
         if (addFnsBinDirPRefix)
         {
             var binDir = GeneralUtility.GetFnsRegistryKeyString("", "FNSBinDir");
             _configFilename = binDir.Length > 0 ? String.Format("{0}{1}", binDir, configFile) : configFile;
         }
         else
         {
             _configFilename = configFile;
         }
         _appSettings = null;
     }
     catch (Exception ex)
     {
         ErrorLog.LogWarning(ex.Message, ToString());
     }
 }
예제 #2
0
        /// <summary>
        /// GetHtmlTransform
        /// </summary>
        /// <param name="xmlFileName">Name of the XML file.</param>
        /// <param name="xslFileName">Name of the XSL file.</param>
        /// <returns></returns>
        static public string GetStringXslTransform(string xmlFileName, string xslFileName)
        {
            var results = String.Empty;

            try
            {
                if (xmlFileName.Length > 0 && xslFileName.Length > 0)
                {
                    {
                        //Enabledocumentfunction, enablescript
                        var settings = new XsltSettings(true, true);
                        var xslt     = new XslCompiledTransform();
                        xslt.Load(xslFileName, settings, new XmlUrlResolver());
                        var       sw        = new StringWriter();
                        XmlWriter xmlWriter = new XmlTextWriter(sw);

                        try
                        {
                            xslt.Transform(xmlFileName, xmlWriter);
                        }
                        catch (Exception ex)
                        {
                            ErrorLog.LogWarning("XslTransform() Warning: " + ex.Message, ServiceName);
                        }
                        sw.Close();
                        results = sw.GetStringBuilder().ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError("GetHtmlTransform() ERROR: " + ex.Message, ServiceName);
            }
            return(results);
        }
예제 #3
0
        /// <summary>
        /// Resets the claim response.
        /// </summary>
        /// <param name="rqId">The request id.</param>
        /// <param name="instance">The database instance.</param>
        /// <returns></returns>
        static public bool ResetClaimResponse(string rqId, string instance)
        {
            if (rqId.Length == 0)
            {
                ErrorLog.LogWarning("ResetClaimResponse must have valid rquid", ServiceName);
                return(false);
            }
            var claimLog = new ClaimSubmissionLog {
                RquId = rqId, Instance = instance
            };

            return(claimLog.ResetResponse());
        }
예제 #4
0
 /// <summary>
 /// Determines whether [is valid phone] [the specified phone].
 /// </summary>
 /// <param name="phone">The phone.</param>
 /// <returns>
 ///   <c>true</c> if [is valid phone] [the specified phone]; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsValidPhone(string phone)
 {
     try
     {
         if (string.IsNullOrEmpty(phone))
         {
             return(false);
         }
         var r = new Regex(@"((?:\(?[2-9](?(?=1)1[02-9]|(?(?=0)0[1-9]|\d{2}))\)?\D{0,3})(?:\(?[2-9](?(?=1)1[02-9]|\d{2})\)?\D{0,3})\d{4})");
         return(r.IsMatch(phone));
     }
     catch (Exception ex)
     {
         ErrorLog.LogWarning(ex.Message, "IsValidPhone");
         return(false);
     }
 }
예제 #5
0
        static internal void Log2ClaimSubmissionLog(ClaimSubmissionLogger.LoggerPackage package)
        {
            if (string.IsNullOrEmpty(package.RquId))
            {
                ErrorLog.LogWarning("LogResponseBody must have valid rquid", ServiceName);
                return;
            }

            var claimLog = new ClaimSubmissionLog
            {
                RquId     = package.RquId,
                Instance  = package.Instance,
                TimeStamp = package.TimeStamp.ToString(DatabaseInstance.DatabaseDateFormat)
            };
            var results = package.Prefix == ClaimSubmissionLogger.LogType.Request
          ? claimLog.SetRequest(package.Document)
          : claimLog.SetResponse(package.Document);

            ErrorLog.DebugLog(String.Format("claimLog.SetResponse returned {0}", results), ServiceName);
        }
예제 #6
0
        /// <summary>
        /// Determines whether [has response body] [the specified rq id].
        /// </summary>
        /// <param name="rqId">The rq id.</param>
        /// <param name="instance">The database instance.</param>
        /// <returns></returns>
        static public string HasResponseBody(string rqId, string instance)
        {
            var results = string.Empty;

            if (rqId.Length == 0)
            {
                ErrorLog.LogWarning("HasResponseBody must have valid rquid", ServiceName);
                return(results);
            }
            var claimLog = new ClaimSubmissionLog {
                RquId = rqId, Instance = instance
            };

            results = claimLog.GetResponse();

            ErrorLog.DebugLog(
                results.Length > 0
          ? "claimLog.HasResponseBody returned results"
          : "claimLog.HasResponseBody returned no results", ServiceName);

            return(results);
        }
예제 #7
0
        /// <summary>
        /// Evaluates the specified name.
        /// </summary>
        /// <returns></returns>
        public string Execute()
        {
            var results = string.Empty;

            try
            {
                ConstructEvaluator();
                if (_compiled != null)
                {
                    var mi    = _compiled.GetType().GetMethod(_name);
                    var parms = new Object[] { _parameter };
                    results = mi.Invoke(_compiled, parms) as string;
                }
            }
            catch (Exception ex)
            {
                _lastError = (ex.InnerException != null)
                    ? ex.InnerException.Message
                    : ex.Message;

                ErrorLog.LogWarning(_lastError, ToString());
            }
            return(results);
        }