Пример #1
0
        private StringCollection GetColumnFriendlyNames
        (
            string tableKey,
            XmlNode ColumnGroupXMLNode
        )
        {
            try
            {
                WorklistCatalog  catalog;
                StringCollection ColumnFriendlyNameStringCollection;


                catalog = new WorklistCatalog( );
                ColumnFriendlyNameStringCollection = new StringCollection( );

                foreach (XmlNode ColumnChildNode in ColumnGroupXMLNode.ChildNodes)
                {
                    string strColumnKeyValue;


                    strColumnKeyValue = ColumnChildNode.Attributes.GetNamedItem(Constants.ResInfo.TablesWithRelatedPNColumns.ColumnFieldKeyName).Value;

                    ColumnFriendlyNameStringCollection.Add(catalog.GetEntityElementDisplayName(tableKey, strColumnKeyValue));
                }

                return(ColumnFriendlyNameStringCollection);
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.Assert(false);

                throw exception;
            }
        }
Пример #2
0
        //private bool IsElementVRValueValid
        //(
        //   PrimitiveStandardElement InforamtionPrimitiveStandardElementNode,
        //   DataColumnChangeEventArgs e
        //)
        //{
        //   try
        //   {
        //      if ( e.Column.DataType != typeof ( DateTime ) )
        //      {
        //         ArrayList ValueArrayList ;


        //         ValueArrayList = new ArrayList ( ) ;

        //         ValueArrayList.Add ( e.ProposedValue.ToString ( ) ) ;

        //         InforamtionPrimitiveStandardElementNode.Value = ValueArrayList ;

        //         return DatasetServices.IsElementValueValid ( InforamtionPrimitiveStandardElementNode ) ;
        //      }
        //      else
        //      {
        //         return true ;
        //      }

        //   }
        //   catch ( Exception exception )
        //   {
        //      System.Diagnostics.Debug.Assert ( false ) ;

        //      throw exception ;
        //   }
        //}


        //private bool IsValueWithinAllowableValues
        //(
        //   PrimitiveStandardElement InformationNode,
        //   object Value
        //)
        //{
        //   try
        //   {
        //      DicomTag tag ;


        //      tag = DicomTagTable.Instance.Find ( InformationNode.Tag ) ;

        //      foreach ( DataRow ElementDataRow in __AllowableValuesDataSet.Tables [ 0 ].Rows )
        //      {
        //         if ( ElementDataRow [ Constants.AllowableValuesTableColumns.TAG ].ToString ( ) == tag.Name )
        //         {
        //            ArrayList AllowableValuesArrayList ;


        //            AllowableValuesArrayList = new ArrayList ( ) ;

        //            AllowableValuesArrayList.AddRange ( ElementDataRow [ Constants.AllowableValuesTableColumns.VALUES ].ToString ( ).Split ( Constants.SpecialCharacters.VALUES_SEPARATOR.ToCharArray ( ) ) ) ;

        //            return AllowableValuesArrayList.Contains ( Value ) ;
        //         }
        //      }

        //      return true ;
        //   }
        //   catch ( Exception exception )
        //   {
        //      System.Diagnostics.Debug.Assert ( false ) ;

        //      throw exception ;
        //   }
        //}


        private void ValidateRow(DataRowChangeEventArgs EvntArgs)
        {
            try
            {
                if ((EvntArgs.Row.RowState == DataRowState.Deleted) /*||
                                                                     * ( EvntArgs.Row.RowState == DataRowState.Detached )*/)
                {
                    return;
                }

                switch (EvntArgs.Action)
                {
                case DataRowAction.Add:
                case DataRowAction.Change:
                case DataRowAction.Commit:
                {
                    XmlElement      RootElement;
                    XmlNodeList     TableKeyNodeList;
                    WorklistCatalog catalog;


                    EvntArgs.Row.RowError = string.Empty;

                    RootElement = __PersonNameXMLDocument.DocumentElement;

                    TableKeyNodeList = RootElement.SelectNodes(Constants.ResInfo.TablesWithRelatedPNColumns.TableNodePath);
                    catalog          = new WorklistCatalog( );

                    foreach (XmlNode TableKeyNode in TableKeyNodeList)
                    {
                        string tablekey;
                        string tableName;

                        tablekey  = TableKeyNode.Attributes.GetNamedItem(Constants.ResInfo.TablesWithRelatedPNColumns.TableFieldKeyName).Value;
                        tableName = catalog.GetEntityName(tablekey);

                        //if ( tableName == EvntArgs.Row.Table.TableName )
                        //{
                        //   ArrayList        PersonFullNameArrayList ;
                        //   ArrayList        ValidationRowsArrayList ;
                        //   StringCollection ColumnNamesStringCollection ;


                        //   ValidationRowsArrayList = new ArrayList ( ) ;

                        //   foreach ( XmlNode ColumnGroupXMLNode in TableKeyNode.ChildNodes )
                        //   {
                        //      ColumnNamesStringCollection = GetColumnNames ( ColumnGroupXMLNode ) ;

                        //      if ( 0 != ColumnNamesStringCollection.Count )
                        //      {
                        //         bool                     fValidationResult = false ;
                        //         PrimitiveStandardElement StandardElement ;
                        //         string                   strPNValue ;


                        //         ValidationRowsArrayList.Add ( EvntArgs.Row ) ;

                        //         PersonFullNameArrayList = DatasetServices.GetPersonNameValue ( ValidationRowsArrayList,
                        //                                                                        ColumnNamesStringCollection ) ;

                        //         StandardElement = GetPrimitiveElementBasedOnTableColumnName ( EvntArgs.Row.Table.TableName,
                        //                                                                       EvntArgs.Row.Table.Columns [ ColumnNamesStringCollection [ 0 ] ].ColumnName ) ;

                        //         StandardElement.Value = PersonFullNameArrayList ;

                        //         strPNValue = ( PersonFullNameArrayList.Count != 0 ) ? PersonFullNameArrayList [ 0 ].ToString ( ) : string.Empty ;

                        //         fValidationResult = DatasetServices.IsElementValueValid ( StandardElement ) ;

                        //         if ( ! fValidationResult ||
                        //            ! IsValuValidWithDICOMType ( EvntArgs.Row.Table.TableName,
                        //                                         EvntArgs.Row.Table.Columns [ ColumnNamesStringCollection [ 0 ] ].ColumnName,
                        //                                         strPNValue )  )
                        //         {
                        //            string           strValidationMsg = string.Empty ;
                        //            StringCollection ColumnFriendlyNames ;


                        //            ColumnFriendlyNames = GetColumnFriendlyNames ( tablekey, ColumnGroupXMLNode ) ;

                        //            if ( 0 != ColumnFriendlyNames.Count )
                        //            {
                        //               strValidationMsg = ColumnFriendlyNames [ 0 ] ;

                        //               for ( int nColumnIndex = 1; nColumnIndex < ColumnFriendlyNames.Count; nColumnIndex++ )
                        //               {
                        //                  strValidationMsg += String.Concat ( ", ", ColumnFriendlyNames [ nColumnIndex ] ) ;
                        //               }
                        //            }

                        //            strValidationMsg =  string.Format ( Constants.Messages.RowErrorMessages.PersonNameError,
                        //                                                strValidationMsg ) ;
                        //            EvntArgs.Row.RowError = strValidationMsg ;

                        //            OnRowValidationErrorDetection (  strValidationMsg,
                        //                                             EvntArgs ) ;
                        //         }
                        //      }
                        //   }

                        //   break ;
                        //}
                    }
                }

                break;

                default:
                {
                    return;
                }
                }
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.Assert(false);

                throw exception;
            }
        }