Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

937 lines
22 KiB

  1. using System;
  2. using System.Web;
  3. using System.Data;
  4. using System.IO;
  5. using System.Xml;
  6. using System.Xml.Schema;
  7. using System.Collections;
  8. using System.Web.Services;
  9. using System.Data.SqlClient;
  10. using System.Xml.Serialization;
  11. using System.Web.Services.Protocols;
  12. using UDDI;
  13. using UDDI.API;
  14. using UDDI.Diagnostics;
  15. using UDDI.API.Binding;
  16. using UDDI.API.Service;
  17. using UDDI.API.Business;
  18. using UDDI.API.ServiceType;
  19. namespace UDDI.API.Extensions
  20. {
  21. public class Constants
  22. {
  23. public const string Namespace = "urn:uddi-microsoft-com:api_v2_extensions";
  24. }
  25. [XmlRoot( "resources", Namespace=UDDI.API.Extensions.Constants.Namespace )]
  26. public class Resources
  27. {
  28. [XmlElement( "tModelDetail", Namespace=UDDI.API.Constants.Namespace )]
  29. public TModelDetail TModelDetail;
  30. [XmlArray( "categorizationSchemes" ), XmlArrayItem( "categorizationScheme" )]
  31. public CategorizationSchemeCollection CategorizationSchemes = new CategorizationSchemeCollection();
  32. [XmlElement( "businessDetail", Namespace=UDDI.API.Constants.Namespace )]
  33. public BusinessDetail BusinessDetail;
  34. [XmlElement( "serviceDetail", Namespace=UDDI.API.Constants.Namespace )]
  35. public ServiceDetail ServiceDetail;
  36. [XmlElement( "bindingDetail", Namespace=UDDI.API.Constants.Namespace )]
  37. public BindingDetail BindingDetail;
  38. public Resources()
  39. {
  40. }
  41. public static void Validate( Stream strm )
  42. {
  43. Debug.VerifySetting( "InstallRoot" );
  44. string installRoot = Config.GetString( "InstallRoot" );
  45. string apiSchema = installRoot + "uddi_v2.xsd";
  46. string resourceSchema = installRoot + "extensions.xsd";
  47. Debug.Verify( File.Exists( apiSchema ), "TUDDI_ERROR_FATALERROR_UDDISCHEMANOTFOUND" );
  48. Debug.Verify( File.Exists( resourceSchema ), "UDDI_ERROR_FATALERROR_UDDIRESOURCESCHEMANOTFOUND" );
  49. XmlSchemaCollection xsc = new XmlSchemaCollection();
  50. xsc.Add( UDDI.API.Constants.Namespace, apiSchema );
  51. xsc.Add( UDDI.API.Extensions.Constants.Namespace, resourceSchema );
  52. //
  53. // Rewind stream (to be safe) and validate
  54. //
  55. strm.Seek( 0, SeekOrigin.Begin );
  56. //
  57. // Construct a validating reader to verify the document is kosher
  58. //
  59. XmlTextReader reader = new XmlTextReader( strm );
  60. XmlValidatingReader vreader = new XmlValidatingReader( reader );
  61. vreader.Schemas.Add( xsc );
  62. while( vreader.Read()){}
  63. //
  64. // Rewind stream again, so someone else can use it
  65. //
  66. strm.Seek( 0, SeekOrigin.Begin );
  67. }
  68. public void Save()
  69. {
  70. UDDI.Diagnostics.Debug.Enter();
  71. if( null != TModelDetail )
  72. {
  73. Debug.Write( SeverityType.Info, CategoryType.Data, "Importing tModels..." );
  74. foreach( TModel tm in TModelDetail.TModels )
  75. {
  76. tm.AuthorizedName = null;
  77. tm.Save();
  78. }
  79. }
  80. if( null != CategorizationSchemes )
  81. {
  82. Debug.Write( SeverityType.Info, CategoryType.Data, "Importing Categorization schemes..." );
  83. foreach( CategorizationScheme cs in CategorizationSchemes )
  84. {
  85. cs.Save();
  86. }
  87. }
  88. if( null != BusinessDetail )
  89. {
  90. Debug.Write( SeverityType.Info, CategoryType.Data, "Importing Providers..." );
  91. foreach( BusinessEntity be in BusinessDetail.BusinessEntities )
  92. {
  93. be.AuthorizedName = null;
  94. be.Save();
  95. }
  96. }
  97. if( null != ServiceDetail )
  98. {
  99. Debug.Write( SeverityType.Info, CategoryType.Data, "Importing Services..." );
  100. foreach( BusinessService bs in ServiceDetail.BusinessServices )
  101. {
  102. bs.Save();
  103. }
  104. }
  105. if( null != BindingDetail )
  106. {
  107. Debug.Write( SeverityType.Info, CategoryType.Data, "Importing bindings..." );
  108. foreach( BindingTemplate bind in BindingDetail.BindingTemplates )
  109. {
  110. bind.Save();
  111. }
  112. }
  113. }
  114. }
  115. [SoapDocumentService( ParameterStyle=SoapParameterStyle.Bare, RoutingStyle=SoapServiceRoutingStyle.RequestElement )]
  116. [WebService( Namespace=UDDI.API.Extensions.Constants.Namespace )]
  117. public class CategoryMessages
  118. {
  119. public CategoryMessages(){}
  120. [WebMethod, SoapDocumentMethod( Action="\"\"", RequestElementName="get_relatedCategories" )]
  121. [UDDIExtension( messageType="get_relatedCategories" )]
  122. public CategoryList GetRelatedCategories( GetRelatedCategories message )
  123. {
  124. Debug.Enter();
  125. CategoryList list = null;
  126. try
  127. {
  128. list = message.Get();
  129. }
  130. catch( Exception e )
  131. {
  132. DispositionReport.Throw( e );
  133. }
  134. Debug.Leave();
  135. return list;
  136. }
  137. }
  138. [XmlType( Namespace=UDDI.API.Extensions.Constants.Namespace )]
  139. [XmlRoot( "get_relatedCategories", Namespace=UDDI.API.Extensions.Constants.Namespace )]
  140. public class GetRelatedCategories
  141. {
  142. public GetRelatedCategories(){}
  143. [XmlIgnore]
  144. public CategoryCollection Categories = new CategoryCollection();
  145. [XmlElement( "category" )]
  146. public Category[] CategoriesSerialize
  147. {
  148. get
  149. {
  150. return Categories.ToArray();
  151. }
  152. set
  153. {
  154. Categories.CopyTo( value );
  155. }
  156. }
  157. public CategoryList Get()
  158. {
  159. //
  160. // For each category retrieve
  161. // the request stuff ( root, children, parents )
  162. //
  163. CategoryList list = new CategoryList();
  164. foreach( Category cat in Categories )
  165. {
  166. CategoryInfo info = new CategoryInfo( cat.TModelKey, cat.KeyValue );
  167. info.Get( cat.RelationshipQualifiers );
  168. list.CategoryInfos.Add( info );
  169. }
  170. return list;
  171. }
  172. }
  173. public class CategorizationScheme
  174. {
  175. //
  176. // TODO: Must tModel element must be optional with tModelKey element
  177. //
  178. private int CategorizationSchemeFlag = 1;
  179. [XmlAttribute( "checked" )]
  180. public XmlBoolType Checked
  181. {
  182. get { return ( 1 == CategorizationSchemeFlag ) ? XmlBoolType.True : XmlBoolType.False; }
  183. set
  184. {
  185. if( XmlBoolType.True == value )
  186. CategorizationSchemeFlag = 1;
  187. else
  188. CategorizationSchemeFlag = 0;//changed from 2 to 0 to correctly implement bit flags
  189. }
  190. }
  191. [XmlElement( "tModel", Namespace=UDDI.API.Constants.Namespace )]
  192. public TModel TModel = null;
  193. [XmlElement( "tModelKey" )]
  194. public string TModelKey
  195. {
  196. get
  197. {
  198. return tModelKey;
  199. }
  200. set
  201. {
  202. if( null == value )
  203. tModelKey = null;
  204. else
  205. tModelKey = value.Trim();
  206. }
  207. }
  208. private string tModelKey = "";
  209. [XmlElement( "categoryValue" )]
  210. public CategoryValueCollection CategoryValues
  211. {
  212. get
  213. {
  214. if( null == categoryvalues )
  215. categoryvalues = new CategoryValueCollection();
  216. return categoryvalues;
  217. }
  218. set
  219. {
  220. categoryvalues = value;
  221. }
  222. }
  223. private CategoryValueCollection categoryvalues;
  224. public CategorizationScheme(){}
  225. public void Delete()
  226. {
  227. Debug.Enter();
  228. SqlCommand cmd = new SqlCommand( "net_taxonomy_delete", ConnectionManager.GetConnection() );
  229. cmd.CommandType = CommandType.StoredProcedure;
  230. cmd.Transaction = ConnectionManager.GetTransaction();
  231. cmd.Parameters.Add( new SqlParameter( "@tModelKey", SqlDbType.UniqueIdentifier ) ).Direction = ParameterDirection.Input;
  232. SqlParameterAccessor paramacc = new SqlParameterAccessor( cmd.Parameters );
  233. paramacc.SetGuidFromKey( "@tModelKey", tModelKey );
  234. cmd.ExecuteNonQuery();
  235. Debug.Leave();
  236. }
  237. public void Save()
  238. {
  239. string tmodelkey;
  240. Debug.Enter();
  241. Debug.Write( SeverityType.Info, CategoryType.Data, "Importing categorization scheme..." );
  242. if( null != TModel )
  243. {
  244. TModel.AuthorizedName = null;
  245. TModel.Save();
  246. }
  247. else
  248. {
  249. TModel = new TModel( TModelKey );
  250. TModel.Get();
  251. }
  252. //
  253. // If the TModel Provided is categorized with 'Browsing Intended'
  254. // Set the flag (0x0002)
  255. //
  256. //if( TModel.CategoryBag.Contains( new KeyedReference( "Browsing Intended","1","uuid:BE37F93E-87B4-4982-BF6D-992A8E44EDAB" ) ) )
  257. foreach( KeyedReference kr in TModel.CategoryBag )
  258. {
  259. if( kr.KeyValue=="1" && kr.TModelKey.ToUpper()=="UUID:BE37F93E-87B4-4982-BF6D-992A8E44EDAB" )
  260. CategorizationSchemeFlag = CategorizationSchemeFlag | 0x0002;
  261. }
  262. //
  263. // Store the TModelKey
  264. //
  265. tmodelkey = TModel.TModelKey;
  266. //
  267. // Save the categorization scheme
  268. //
  269. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  270. sp.ProcedureName = "net_taxonomy_save";
  271. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  272. sp.Parameters.Add( "@flag", SqlDbType.Int );
  273. sp.Parameters.Add( "@taxonomyID", SqlDbType.BigInt, ParameterDirection.InputOutput );
  274. sp.Parameters.SetGuidFromKey( "@tModelKey", tmodelkey );
  275. sp.Parameters.SetInt( "@flag", CategorizationSchemeFlag );
  276. sp.ExecuteNonQuery();
  277. int taxonomyID = sp.Parameters.GetInt( "@taxonomyID" );
  278. //
  279. // Save the category values
  280. //
  281. foreach( CategoryValue cv in CategoryValues )
  282. {
  283. cv.Save( tmodelkey );
  284. }
  285. Debug.Leave();
  286. }
  287. public void Get()
  288. {
  289. Debug.Enter();
  290. //
  291. // Retrieve the taxonomy
  292. //
  293. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_taxonomy_get" );
  294. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  295. sp.Parameters.Add( "@flag", SqlDbType.Int, ParameterDirection.InputOutput );
  296. sp.Parameters.SetGuidFromKey( "@tModelKey", tModelKey );
  297. sp.Parameters.SetNull( "@flag" );
  298. sp.ExecuteScalar();
  299. //
  300. // Set the flag value
  301. //
  302. CategorizationSchemeFlag = sp.Parameters.GetInt( "@flag" );
  303. //
  304. // Retrieve the taxonomy values
  305. //
  306. CategoryValues.Clear();
  307. SqlStoredProcedureAccessor sp2 = new SqlStoredProcedureAccessor( "net_taxonomyValues_get" );
  308. sp2.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  309. sp2.Parameters.SetGuidFromKey( "@tModelKey", tModelKey );
  310. SqlDataReaderAccessor reader = sp2.ExecuteReader();
  311. try
  312. {
  313. while( reader.Read() )
  314. {
  315. CategoryValues.Add( reader.GetString( "keyName" ), reader.GetString( "keyValue" ), reader.GetString( "parentKeyValue"), ( ( reader.GetInt( "valid" ) == 1 ) ? true : false ) );
  316. }
  317. }
  318. finally
  319. {
  320. reader.Close();
  321. }
  322. Debug.Leave();
  323. }
  324. }
  325. public enum ValidForCategorization
  326. {
  327. [XmlEnumAttribute( "false" )]
  328. False = 0,
  329. [XmlEnumAttribute( "true" )]
  330. True = 1,
  331. }
  332. public class CategorizationSchemeCollection : CollectionBase
  333. {
  334. public CategorizationSchemeCollection()
  335. {
  336. }
  337. public void Save()
  338. {
  339. Debug.Enter();
  340. foreach( CategorizationScheme tax in this )
  341. {
  342. tax.Save();
  343. }
  344. Debug.Leave();
  345. }
  346. public CategorizationScheme this[int index]
  347. {
  348. get { return (CategorizationScheme)List[index]; }
  349. set { List[index] = value; }
  350. }
  351. public int Add(CategorizationScheme value)
  352. {
  353. return List.Add(value);
  354. }
  355. public void Insert(int index, CategorizationScheme value)
  356. {
  357. List.Insert(index, value);
  358. }
  359. public int IndexOf( CategorizationScheme value )
  360. {
  361. return List.IndexOf( value );
  362. }
  363. public bool Contains( CategorizationScheme value )
  364. {
  365. return List.Contains( value );
  366. }
  367. public void Remove( CategorizationScheme value )
  368. {
  369. List.Remove( value );
  370. }
  371. public void CopyTo(CategorizationScheme[] array, int index)
  372. {
  373. List.CopyTo( array, index );
  374. }
  375. public void CopyTo( CategorizationScheme[] array )
  376. {
  377. foreach( CategorizationScheme tax in array )
  378. Add( tax );
  379. }
  380. public CategorizationScheme[] ToArray()
  381. {
  382. return (CategorizationScheme[]) InnerList.ToArray( typeof( CategorizationScheme ) );
  383. }
  384. }
  385. public class Category
  386. {
  387. [XmlElement( "relationshipQualifier" )]
  388. public RelationshipQualifier[] RelationshipQualifiers;
  389. [XmlAttribute( "tModelKey" )]
  390. public string TModelKey;
  391. [XmlAttribute( "keyValue" )]
  392. public string KeyValue;
  393. }
  394. public enum RelationshipQualifier
  395. {
  396. root = 1, parent = 2, child = 3
  397. }
  398. [XmlRoot( "categoryList", Namespace=UDDI.API.Extensions.Constants.Namespace )]
  399. public class CategoryList
  400. {
  401. [XmlAttribute( "truncated" )]
  402. public bool Truncated = false;
  403. [XmlAttribute( "operator" )]
  404. public string Operator = Config.GetString( "Operator" );
  405. [XmlIgnore]
  406. public CategoryInfoCollection CategoryInfos = new CategoryInfoCollection();
  407. [XmlElement( "categoryInfo" )]
  408. public CategoryInfo[] CategoryInfosSerialize
  409. {
  410. get
  411. {
  412. return CategoryInfos.ToArray();
  413. }
  414. set
  415. {
  416. CategoryInfos.CopyTo( value );
  417. }
  418. }
  419. public CategoryList(){}
  420. }
  421. public class CategoryInfo : CategoryValue
  422. {
  423. const int KeyValueIndex = 0;
  424. const int ParentKeyValueIndex = 1;
  425. const int KeyNameIndex = 2;
  426. const int IsValidIndex = 3;
  427. // -- 0 - Root information requested
  428. // -- 1 - Child information requested
  429. // -- 2 - Parent information requested
  430. // -- 3 - Current information requested
  431. public enum RelationType : int
  432. {
  433. Root = 0,
  434. Child = 1,
  435. Parent = 2,
  436. Current = 3
  437. }
  438. [XmlArray( "rootRelationship" ), XmlArrayItem( "categoryValue" )]
  439. public CategoryValueCollection Roots = null;
  440. [XmlArray( "parentRelationship" ), XmlArrayItem( "categoryValue" )]
  441. public CategoryValueCollection Parents = null;
  442. [XmlArray( "childRelationship" ), XmlArrayItem( "categoryValue" )]
  443. public CategoryValueCollection Children = null;
  444. public CategoryInfo( string tmodelkey, string keyvalue )
  445. : base( tmodelkey, keyvalue )
  446. {
  447. }
  448. public SqlDataReader GetValues( RelationType relation )
  449. {
  450. SqlCommand cmd = new SqlCommand( "net_taxonomyValue_get", ConnectionManager.GetConnection() );
  451. cmd.Transaction = ConnectionManager.GetTransaction();
  452. cmd.CommandType = CommandType.StoredProcedure;
  453. //
  454. // Add parameters and set values
  455. //
  456. SqlParameterAccessor populator = new SqlParameterAccessor( cmd.Parameters );
  457. cmd.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  458. cmd.Parameters.Add( "@keyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue );
  459. cmd.Parameters.Add( "@relation", SqlDbType.Int );
  460. populator.SetGuidFromKey( "@tModelKey", TModelKey );
  461. populator.SetString( "@keyValue", KeyValue );
  462. populator.SetInt( "@relation", (int) relation );
  463. return cmd.ExecuteReader();
  464. }
  465. public void Get( RelationshipQualifier[] relations )
  466. {
  467. if( null != KeyValue )
  468. {
  469. //
  470. // The request can ask for Root stuff with just the TModelKey
  471. //
  472. SqlDataReader rdr = GetValues( RelationType.Current );
  473. try
  474. {
  475. SqlDataReaderAccessor dracc = new SqlDataReaderAccessor( rdr );
  476. if( rdr.Read() )
  477. {
  478. this.KeyName = dracc.GetString( KeyNameIndex );
  479. this.IsValid = ( 1 == dracc.GetInt( IsValidIndex ) );
  480. }
  481. else
  482. {
  483. throw new UDDIException( UDDI.ErrorType.E_invalidValue, "UDDI_ERROR_INVALIDVALUE_VALUENOTFOUND" );
  484. }
  485. }
  486. finally
  487. {
  488. rdr.Close();
  489. }
  490. }
  491. if( null != relations )
  492. {
  493. foreach( RelationshipQualifier rq in relations )
  494. {
  495. switch( rq )
  496. {
  497. case RelationshipQualifier.root:
  498. GetRoots();
  499. break;
  500. case RelationshipQualifier.child:
  501. GetChildren();
  502. break;
  503. case RelationshipQualifier.parent:
  504. GetParents();
  505. break;
  506. }
  507. }
  508. }
  509. }
  510. public void GetRoots()
  511. {
  512. Roots = new CategoryValueCollection();
  513. SqlDataReader rdr = GetValues( RelationType.Root );
  514. try
  515. {
  516. SqlDataReaderAccessor dracc = new SqlDataReaderAccessor( rdr );
  517. while( rdr.Read() )
  518. {
  519. Roots.Add( dracc.GetString( KeyNameIndex ),
  520. dracc.GetString( KeyValueIndex ),
  521. dracc.GetString( ParentKeyValueIndex ),
  522. ( 1 == dracc.GetInt( IsValidIndex ) ) );
  523. }
  524. }
  525. finally
  526. {
  527. rdr.Close();
  528. }
  529. }
  530. public void GetChildren()
  531. {
  532. Children = new CategoryValueCollection();
  533. SqlDataReader rdr = GetValues( RelationType.Child );
  534. try
  535. {
  536. SqlDataReaderAccessor dracc = new SqlDataReaderAccessor( rdr );
  537. while( rdr.Read() )
  538. {
  539. Children.Add( dracc.GetString( KeyNameIndex ),
  540. dracc.GetString( KeyValueIndex ),
  541. dracc.GetString( ParentKeyValueIndex ),
  542. ( 1 == dracc.GetInt( IsValidIndex ) ) );
  543. }
  544. }
  545. finally
  546. {
  547. rdr.Close();
  548. }
  549. }
  550. public void GetParents()
  551. {
  552. Parents = new CategoryValueCollection();
  553. SqlDataReader rdr = GetValues( RelationType.Parent );
  554. try
  555. {
  556. SqlDataReaderAccessor dracc = new SqlDataReaderAccessor( rdr );
  557. while( rdr.Read() )
  558. {
  559. Parents.Add( dracc.GetString( KeyNameIndex ),
  560. dracc.GetString( KeyValueIndex ),
  561. dracc.GetString( ParentKeyValueIndex ),
  562. ( 1 == dracc.GetInt( IsValidIndex ) ) );
  563. }
  564. }
  565. finally
  566. {
  567. rdr.Close();
  568. }
  569. }
  570. public CategoryInfo(){}
  571. }
  572. [XmlInclude( typeof( CategoryInfo ) )]
  573. public class CategoryValue
  574. {
  575. [XmlAttribute( "tModelKey" )]
  576. public string TModelKey = null;
  577. [XmlAttribute( "keyName" )]
  578. public string KeyName = null;
  579. [XmlAttribute( "keyValue" )]
  580. public string KeyValue = null;
  581. [XmlAttribute( "parentKeyValue" )]
  582. public string ParentKeyValue = null;
  583. [XmlAttribute( "isValid" )]
  584. public bool IsValid = false;
  585. public CategoryValue()
  586. {
  587. }
  588. public CategoryValue( string tmodelkey, string keyvalue )
  589. {
  590. TModelKey = tmodelkey;
  591. KeyValue = keyvalue;
  592. }
  593. public CategoryValue( string keyname, string keyvalue, string parent, bool isvalid )
  594. {
  595. KeyName = keyname;
  596. KeyValue = keyvalue;
  597. ParentKeyValue = parent;
  598. IsValid = isvalid;
  599. }
  600. public void Save( string TModelKey )
  601. {
  602. Debug.Enter();
  603. if( !Utility.StringEmpty( ParentKeyValue ) )
  604. Debug.Verify( KeyValue != ParentKeyValue, "UDDI_ERROR_FATALERROR_PARENTKEYEQUALSVALUE", ErrorType.E_fatalError );
  605. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_taxonomyValue_save" );
  606. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  607. sp.Parameters.Add( "@keyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue );
  608. sp.Parameters.Add( "@parentKeyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue );
  609. sp.Parameters.Add( "@keyName", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyName );
  610. sp.Parameters.Add( "@valid", SqlDbType.Bit );
  611. sp.Parameters.SetGuidFromKey( "@tModelKey", TModelKey );
  612. sp.Parameters.SetString( "@keyValue", KeyValue );
  613. sp.Parameters.SetString( "@parentKeyValue", ParentKeyValue );
  614. sp.Parameters.SetString( "@keyName", KeyName );
  615. sp.Parameters.SetBool( "@valid" , IsValid );
  616. sp.ExecuteNonQuery();
  617. Debug.Leave();
  618. }
  619. }
  620. public class CategoryValueCollection : CollectionBase
  621. {
  622. public CategoryValueCollection()
  623. {
  624. }
  625. public CategoryValue this[int index]
  626. {
  627. get
  628. { return (CategoryValue)List[index]; }
  629. set
  630. { List[index] = value; }
  631. }
  632. public int Add( string keyname, string keyvalue, string parent, bool isvalid )
  633. {
  634. return List.Add( new CategoryValue( keyname, keyvalue, parent, isvalid ) );
  635. }
  636. public int Add(CategoryValue value)
  637. {
  638. return List.Add(value);
  639. }
  640. public void Insert(int index, CategoryValue value)
  641. {
  642. List.Insert(index, value);
  643. }
  644. public int IndexOf( CategoryValue value )
  645. {
  646. return List.IndexOf( value );
  647. }
  648. public bool Contains( CategoryValue value )
  649. {
  650. return List.Contains( value );
  651. }
  652. public void Remove( CategoryValue value )
  653. {
  654. List.Remove( value );
  655. }
  656. public void CopyTo(CategoryValue[] array, int index)
  657. {
  658. List.CopyTo( array, index );
  659. }
  660. public void CopyTo( CategoryValue[] array )
  661. {
  662. foreach( CategoryValue tax in array )
  663. Add( tax );
  664. }
  665. public CategoryValue[] ToArray()
  666. {
  667. return (CategoryValue[]) InnerList.ToArray( typeof( CategoryValue ) );
  668. }
  669. }
  670. public class CategoryCollection : CollectionBase
  671. {
  672. public CategoryCollection()
  673. {
  674. }
  675. public Category this[int index]
  676. {
  677. get { return (Category)List[index]; }
  678. set { List[index] = value; }
  679. }
  680. public int Add(Category value)
  681. {
  682. return List.Add(value);
  683. }
  684. public void Insert(int index, Category value)
  685. {
  686. List.Insert(index, value);
  687. }
  688. public int IndexOf( Category value )
  689. {
  690. return List.IndexOf( value );
  691. }
  692. public bool Contains( Category value )
  693. {
  694. return List.Contains( value );
  695. }
  696. public void Remove( Category value )
  697. {
  698. List.Remove( value );
  699. }
  700. public void CopyTo(Category[] array, int index)
  701. {
  702. List.CopyTo( array, index );
  703. }
  704. public void CopyTo( Category[] array )
  705. {
  706. foreach( Category tax in array )
  707. Add( tax );
  708. }
  709. public Category[] ToArray()
  710. {
  711. return (Category[]) InnerList.ToArray( typeof( Category ) );
  712. }
  713. }
  714. public class CategoryInfoCollection : CollectionBase
  715. {
  716. public CategoryInfoCollection()
  717. {
  718. }
  719. public CategoryInfo this[int index]
  720. {
  721. get
  722. { return (CategoryInfo)List[index]; }
  723. set
  724. { List[index] = value; }
  725. }
  726. public int Add(CategoryInfo value)
  727. {
  728. return List.Add(value);
  729. }
  730. public void Insert(int index, CategoryInfo value)
  731. {
  732. List.Insert(index, value);
  733. }
  734. public int IndexOf( CategoryInfo value )
  735. {
  736. return List.IndexOf( value );
  737. }
  738. public bool Contains( CategoryInfo value )
  739. {
  740. return List.Contains( value );
  741. }
  742. public void Remove( CategoryInfo value )
  743. {
  744. List.Remove( value );
  745. }
  746. public void CopyTo(CategoryInfo[] array, int index)
  747. {
  748. List.CopyTo( array, index );
  749. }
  750. public void CopyTo( CategoryInfo[] array )
  751. {
  752. foreach( CategoryInfo tax in array )
  753. Add( tax );
  754. }
  755. public CategoryInfo[] ToArray()
  756. {
  757. return (CategoryInfo[]) InnerList.ToArray( typeof( CategoryInfo ) );
  758. }
  759. }
  760. }