/// <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); } }
/// <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); }
/// <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); }
/// <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); } }
/// <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); } }
/// <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); }
/// <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); }
/// <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); } }