Пример #1
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_src))
     {
         dataset.AddElementWithValueString(_dst, dataset.GetValueString(_src));
     }
 }
Пример #2
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag) && dataset.GetValueString(_tag) == _match)
     {
         dataset.AddElementWithValueString(_tag, _value);
     }
 }
Пример #3
0
        public void Transform(DcmDataset dataset)
        {
            IDbConnection connection = null;

            try {
                if (_dbType == DatabaseType.Odbc)
                {
                    connection = new OdbcConnection(_connectionString);
                }
                else if (_dbType == DatabaseType.MsSql)
                {
                    connection = new SqlConnection(_connectionString);
                }

                using (IDbCommand command = connection.CreateCommand()) {
                    command.Connection  = connection;
                    command.CommandText = _query;

                    for (int i = 0; i < _params.Count; i++)
                    {
                        string       str = dataset.GetValueString(_params[i]);
                        SqlParameter prm = new SqlParameter(String.Format("@{0}", i), str);
                        command.Parameters.Add(prm);
                    }

                    connection.Open();

                    if (_output.Count == 0)
                    {
                        command.ExecuteNonQuery();
                    }
                    else
                    {
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                for (int i = 0; i < _output.Count; i++)
                                {
                                    string str = reader.GetString(i);
                                    dataset.AddElementWithValueString(_output[i], str);
                                }
                            }
                        }
                    }

                    connection.Close();

                    connection = null;
                }
            } finally {
                if (connection != null)
                {
                    if (connection.State == ConnectionState.Closed || connection.State == ConnectionState.Broken)
                    {
                        connection.Close();
                    }
                    connection.Dispose();
                }
            }
        }
Пример #4
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         dataset.AddElementWithValueString(_tag, value.ToLower());
     }
 }
Пример #5
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         dataset.AddElementWithValueString(_tag, _prefix + value);
     }
 }
Пример #6
0
 public bool Match(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         return(_regex.IsMatch(value));
     }
     return(false);
 }
Пример #7
0
 public bool Match(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         return(Wildcard.Match(_pattern, value));
     }
     return(false);
 }
Пример #8
0
 public bool Match(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         return(value.EndsWith(_value));
     }
     return(false);
 }
Пример #9
0
 public bool Match(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag).Trim();
         return(String.IsNullOrEmpty(value));
     }
     return(true);
 }
Пример #10
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         value = Regex.Replace(value, _pattern, _replacement);
         dataset.AddElementWithValueString(_tag, value);
     }
 }
Пример #11
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string   value = dataset.GetValueString(_tag);
         string[] parts = value.Split(_seperators);
         value = String.Format(_format, parts);
         dataset.AddElementWithValueString(_tag, value);
     }
 }
Пример #12
0
 public bool Match(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         foreach (string v in _values)
         {
             if (v == value)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #13
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         if (_totalLength < 0)
         {
             value = value.PadLeft(-_totalLength, _paddingChar);
         }
         else
         {
             value = value.PadRight(_totalLength, _paddingChar);
         }
         dataset.AddElementWithValueString(_tag, value);
     }
 }
Пример #14
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string   value = dataset.GetValueString(_tag);
         string[] parts = value.Split('\\');
         for (int i = 0; i < parts.Length; i++)
         {
             if (parts[i].Length > _length)
             {
                 parts[i] = parts[i].Substring(0, _length);
             }
         }
         value = String.Join("\\", parts);
         dataset.AddElementWithValueString(_tag, value);
     }
 }
Пример #15
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         if (_position == DicomTrimPosition.Both)
         {
             if (_trim != null)
             {
                 value = value.Trim(_trim);
             }
             else
             {
                 value = value.Trim();
             }
         }
         else if (_position == DicomTrimPosition.Start)
         {
             if (_trim != null)
             {
                 value = value.TrimStart(_trim);
             }
             else
             {
                 value = value.TrimStart();
             }
         }
         else
         {
             if (_trim != null)
             {
                 value = value.TrimEnd(_trim);
             }
             else
             {
                 value = value.TrimEnd();
             }
         }
         dataset.AddElementWithValueString(_tag, value);
     }
 }
Пример #16
0
 public void Transform(DcmDataset dataset)
 {
     if (dataset.Contains(_tag))
     {
         string value = dataset.GetValueString(_tag);
         if (_position == DicomTrimPosition.Start || _position == DicomTrimPosition.Both)
         {
             while (value.StartsWith(_trim))
             {
                 value = value.Substring(_trim.Length);
             }
         }
         if (_position == DicomTrimPosition.End || _position == DicomTrimPosition.Both)
         {
             while (value.EndsWith(_trim))
             {
                 value = value.Substring(0, value.Length - _trim.Length);
             }
         }
         dataset.AddElementWithValueString(_tag, value);
     }
 }