/// <summary>
        /// Set a <see cref="ISearchCondition{T}"/> for DICOM string based (wildcard matching) value.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="val"></param>
        private static void SetStringCondition(ISearchCondition <string> cond, string val)
        {
            if (val.Length == 0)
            {
                return;
            }

            if (val.Contains("*") || val.Contains("?"))
            {
                //TODO Remove when paging is implemented on queries
                int charCount = 0;
                foreach (char c in val)
                {
                    if (c != '*' && c != '?')
                    {
                        charCount++;
                    }
                }
                if (charCount < 4)
                {
                    throw new ArgumentException("Wildcard parameters require at least 4 characters.");
                }

                String value = val.Replace("%", "[%]").Replace("_", "[_]");
                value = value.Replace('*', '%');
                value = value.Replace('?', '_');
                cond.Like(value);
            }
            else
            {
                cond.EqualTo(val);
            }
        }
示例#2
0
        /// <summary>
        /// Set a <see cref="ISearchCondition{T}"/> for DICOM string based (wildcard matching) value.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="val"></param>
        public static void SetGuiStringCondition(ISearchCondition <string> cond, string val)
        {
            if (string.IsNullOrEmpty(val) || SearchValueOnlyWildcard(val, true))
            {
                return;
            }

            String value = val.Replace('*', '%');

            value = value.Replace('?', '_');
            cond.Like(value);
        }
示例#3
0
        /// <summary>
        /// Set a <see cref="ISearchCondition{T}"/> for DICOM string based (wildcard matching) value.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="val"></param>
        public static void SetStringCondition(ISearchCondition<string> cond, string val)
        {
            if (val.Length == 0 || SearchValueOnlyWildcard(val, false))
                return;

            if (val.Contains("*") || val.Contains("?"))
            {
                String value = val.Replace("%", "[%]").Replace("_", "[_]");
                value = value.Replace('*', '%');
                value = value.Replace('?', '_');
                cond.Like(value);
            }
            else
                cond.EqualTo(val);
        }
示例#4
0
        /// <summary>
        /// Set a <see cref="ISearchCondition{T}"/> for DICOM string based (wildcard matching) value.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="val"></param>
        private static void SetStringCondition(ISearchCondition <string> cond, string val)
        {
            if (val.Length == 0)
            {
                return;
            }

            if (val.Contains("*") || val.Contains("?"))
            {
                String value = val.Replace("%", "[%]").Replace("_", "[_]");
                value = value.Replace('*', '%');
                value = value.Replace('?', '_');
                cond.Like(value);
            }
            else
            {
                cond.EqualTo(val);
            }
        }
示例#5
0
        /// <summary>
        /// Set a xPath based <see cref="ISearchCondition{T}"/> for an <see cref="XmlDocument"/> column.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="xPath"></param>
        /// <param name="match"></param>
        public static void SetXmlStringCondition(ISearchCondition <XmlDocument> cond, string xPath, string match)
        {
            var doc = new XmlDocument();

            var xPathElem = doc.CreateElement("Select");

            doc.AppendChild(xPathElem);

            var equalElem = doc.CreateElement("XPath");

            xPathElem.AppendChild(equalElem);

            var attribElem = doc.CreateAttribute("path");

            attribElem.Value = xPath;
            xPathElem.Attributes.Append(attribElem);

            if (match.Contains("*") || match.Contains("?"))
            {
                var value = match.Replace("%", "[%]").Replace("_", "[_]");
                value = value.Replace('*', '%');
                value = value.Replace('?', '_');

                attribElem       = doc.CreateAttribute("value");
                attribElem.Value = value;
                xPathElem.Attributes.Append(attribElem);

                cond.Like(doc);
            }
            else
            {
                attribElem       = doc.CreateAttribute("value");
                attribElem.Value = match;
                xPathElem.Attributes.Append(attribElem);

                cond.EqualTo(doc);
            }
        }
示例#6
0
        /// <summary>
        /// Set a <see cref="ISearchCondition{T}"/> for DICOM string based (wildcard matching) value.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="val"></param>
        private static void SetStringCondition(ISearchCondition<string> cond, string val)
        {
            if (val.Length == 0)
                return;

            if (val.Contains("*") || val.Contains("?"))
            {
                //TODO Remove when paging is implemented on queries
                int charCount = 0;
                foreach (char c in val)
                    if (c != '*' && c != '?')
                        charCount++;
                if (charCount < 4)
                    throw new ArgumentException("Wildcard parameters require at least 4 characters.");

                String value = val.Replace("%", "[%]").Replace("_", "[_]");
                value = value.Replace('*', '%');
                value = value.Replace('?', '_');
                cond.Like(value);
            }
            else
                cond.EqualTo(val);
        }
示例#7
0
        /// <summary>
        /// Set a <see cref="ISearchCondition{T}"/> for DICOM string based (wildcard matching) value.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="val"></param>
        public static void SetGuiStringCondition(ISearchCondition<string> cond, string val)
        {
            if ( string.IsNullOrEmpty(val) || SearchValueOnlyWildcard(val, true))
                return;

            String value = val.Replace('*', '%');
            value = value.Replace('?', '_');
            cond.Like(value);
        }
示例#8
0
        /// <summary>
        /// Set a xPath based <see cref="ISearchCondition{T}"/> for an <see cref="XmlDocument"/> column.
        /// </summary>
        /// <param name="cond"></param>
        /// <param name="xPath"></param>
        /// <param name="match"></param>
        public static void SetXmlStringCondition(ISearchCondition<XmlDocument> cond, string xPath, string match)
        {
            var doc = new XmlDocument();

            var xPathElem = doc.CreateElement("Select");
            doc.AppendChild(xPathElem);

            var equalElem = doc.CreateElement("XPath");
            xPathElem.AppendChild(equalElem);

            var attribElem = doc.CreateAttribute("path");
            attribElem.Value = xPath;
            xPathElem.Attributes.Append(attribElem);

            if (match.Contains("*") || match.Contains("?"))
            {
                var value = match.Replace("%", "[%]").Replace("_", "[_]");
                value = value.Replace('*', '%');
                value = value.Replace('?', '_');

                attribElem = doc.CreateAttribute("value");
                attribElem.Value = value;
                xPathElem.Attributes.Append(attribElem);

                cond.Like(doc);
            }
            else
            {
                attribElem = doc.CreateAttribute("value");
                attribElem.Value = match;
                xPathElem.Attributes.Append(attribElem);

                cond.EqualTo(doc);
            }
        }