namespace Duwamish7.Common.Data { using System; using System.Data; using System.Runtime.Serialization;
/// <summary> /// A custom serializable dataset containing book information. /// <res> /// This class is used to define the shape of BookData. /// </res> /// <res> /// The serializable constructor allows objects of type BookData to be remoted. /// </res> /// </summary> [System.ComponentModel.DesignerCategory("Code")] [SerializableAttribute] public class BookData : DataSet { // // Books table constants // /// <value>The constant used for Books table. </value> public const String BOOKS_TABLE = "Books"; /// <value>The constant used for PKId field in the Books table. </value> public const String PKID_FIELD = "PKId"; /// <value>The constant used for TypeId field in the Books table. </value> public const String TYPE_ID_FIELD = "TypeId"; /// <value>The constant used for PublisherId field in the Books table. </value> public const String PUBLISHER_ID_FIELD = "PublisherId"; /// <value>The constant used for PublicationYear field in the Books table. </value> public const String PUBLICATION_YEAR_FIELD = "PublicationYear"; /// <value>The constant used for ISBN field in the Books table. </value> public const String ISBN_FIELD = "ISBN"; /// <value>The constant used for ImageFileSpec field in the Books table. </value> public const String IMAGE_FILE_SPEC_FIELD = "ImageFileSpec"; /// <value>The constant used for Title field in the Books table. </value> public const String TITLE_FIELD = "Title"; /// <value>The constant used for Title field in the Books table. </value> public const String DESCRIPTION_FIELD = "Description"; /// <value>The constant used for UnitPrice field in the Books table. </value> public const String UNIT_PRICE_FIELD = "UnitPrice"; /// <value>The constant used for UnitCost field in the Books table. </value> public const String UNIT_COST_FIELD = "UnitCost"; /// <value>The constant used for ItemType field in the Books table. </value> public const String ITEM_TYPE_FIELD = "ItemType"; /// <value>The constant used for PublisherName field in the Books table. </value> public const String PUBLISHER_NAME_FIELD = "PublisherName"; /// <value>The constant used for Authors field in the Books table. </value> public const String AUTHORS_FIELD = "Authors"; /// <summary> /// Enum for the Search Type. /// <res> /// Each item is ordered and valued to match the layout in /// web's SearchModule class changes to these values will need to /// be reflected in web's SearchModule class. /// </res> /// </summary> [SerializableAttribute] public enum SearchTypeEnum { /// <summary> /// Title search. /// </summary> Title = 0, /// <summary> /// ISBN search. /// </summary> ISBN = 1, /// <summary> /// Author search. /// </summary> Author = 2, /// <summary> /// Subject search. /// </summary> Subject = 3, /// <summary> /// Id search. /// </summary> ID = 4, /// <summary> /// Id list search. /// </summary> IdList = 5 }
/// <summary> /// Constructor to support serialization. /// <res>Constructor that supports serialization.</res> /// <param name="info">The SerializationInfo object to read from.</param> /// <param name="context">Information on who is calling this method.</param> /// </summary> public BookData(SerializationInfo info, StreamingContext context) : base(info, context) { }
/// <summary> /// Constructor for BookData. /// <res>Initialize a BookData instance by building the table schema.</res> /// </summary> public BookData() { // // Create the tables in the dataset // BuildDataTables(); }
//---------------------------------------------------------------- // Sub BuildDataTables: // Creates the following datatables: Books //---------------------------------------------------------------- private void BuildDataTables() { // // Create the Books table // DataTable table = new DataTable(BOOKS_TABLE); DataColumnCollection columns = table.Columns;
columns.Add(PKID_FIELD, typeof(System.Int32)); columns.Add(TYPE_ID_FIELD, typeof(System.Int32)); columns.Add(PUBLISHER_ID_FIELD, typeof(System.Int32)); columns.Add(PUBLICATION_YEAR_FIELD, typeof(System.Int16)); columns.Add(ISBN_FIELD, typeof(System.String)); columns.Add(IMAGE_FILE_SPEC_FIELD, typeof(System.String)); columns.Add(TITLE_FIELD, typeof(System.String)); columns.Add(DESCRIPTION_FIELD, typeof(System.String)); columns.Add(UNIT_PRICE_FIELD, typeof(System.Decimal)); columns.Add(UNIT_COST_FIELD, typeof(System.Decimal)); columns.Add(ITEM_TYPE_FIELD, typeof(System.String)); columns.Add(PUBLISHER_NAME_FIELD, typeof(System.String)); // // [Authors] is an optional column that will get added dynamically to the table schema // when the stored proc. GetBookById is used to fill the 'Books' table // this.Tables.Add(table); }
{
using System;
using System.Data;
using System.Runtime.Serialization;
/// <summary>
/// A custom serializable dataset containing book information.
/// <res>
/// This class is used to define the shape of BookData.
/// </res>
/// <res>
/// The serializable constructor allows objects of type BookData to be remoted.
/// </res>
/// </summary>
[System.ComponentModel.DesignerCategory("Code")]
[SerializableAttribute]
public class BookData : DataSet
{
//
// Books table constants
//
/// <value>The constant used for Books table. </value>
public const String BOOKS_TABLE = "Books";
/// <value>The constant used for PKId field in the Books table. </value>
public const String PKID_FIELD = "PKId";
/// <value>The constant used for TypeId field in the Books table. </value>
public const String TYPE_ID_FIELD = "TypeId";
/// <value>The constant used for PublisherId field in the Books table. </value>
public const String PUBLISHER_ID_FIELD = "PublisherId";
/// <value>The constant used for PublicationYear field in the Books table. </value>
public const String PUBLICATION_YEAR_FIELD = "PublicationYear";
/// <value>The constant used for ISBN field in the Books table. </value>
public const String ISBN_FIELD = "ISBN";
/// <value>The constant used for ImageFileSpec field in the Books table. </value>
public const String IMAGE_FILE_SPEC_FIELD = "ImageFileSpec";
/// <value>The constant used for Title field in the Books table. </value>
public const String TITLE_FIELD = "Title";
/// <value>The constant used for Title field in the Books table. </value>
public const String DESCRIPTION_FIELD = "Description";
/// <value>The constant used for UnitPrice field in the Books table. </value>
public const String UNIT_PRICE_FIELD = "UnitPrice";
/// <value>The constant used for UnitCost field in the Books table. </value>
public const String UNIT_COST_FIELD = "UnitCost";
/// <value>The constant used for ItemType field in the Books table. </value>
public const String ITEM_TYPE_FIELD = "ItemType";
/// <value>The constant used for PublisherName field in the Books table. </value>
public const String PUBLISHER_NAME_FIELD = "PublisherName";
/// <value>The constant used for Authors field in the Books table. </value>
public const String AUTHORS_FIELD = "Authors"; /// <summary>
/// Enum for the Search Type.
/// <res>
/// Each item is ordered and valued to match the layout in
/// web's SearchModule class changes to these values will need to
/// be reflected in web's SearchModule class.
/// </res>
/// </summary>
[SerializableAttribute]
public enum SearchTypeEnum
{
/// <summary>
/// Title search.
/// </summary>
Title = 0,
/// <summary>
/// ISBN search.
/// </summary>
ISBN = 1,
/// <summary>
/// Author search.
/// </summary>
Author = 2,
/// <summary>
/// Subject search.
/// </summary>
Subject = 3,
/// <summary>
/// Id search.
/// </summary>
ID = 4,
/// <summary>
/// Id list search.
/// </summary>
IdList = 5
}
/// <summary>
/// Constructor to support serialization.
/// <res>Constructor that supports serialization.</res>
/// <param name="info">The SerializationInfo object to read from.</param>
/// <param name="context">Information on who is calling this method.</param>
/// </summary>
public BookData(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
/// <summary>
/// Constructor for BookData.
/// <res>Initialize a BookData instance by building the table schema.</res>
/// </summary>
public BookData()
{
//
// Create the tables in the dataset
//
BuildDataTables();
}
//----------------------------------------------------------------
// Sub BuildDataTables:
// Creates the following datatables: Books
//----------------------------------------------------------------
private void BuildDataTables()
{
//
// Create the Books table
//
DataTable table = new DataTable(BOOKS_TABLE);
DataColumnCollection columns = table.Columns;
columns.Add(PKID_FIELD, typeof(System.Int32));
columns.Add(TYPE_ID_FIELD, typeof(System.Int32));
columns.Add(PUBLISHER_ID_FIELD, typeof(System.Int32));
columns.Add(PUBLICATION_YEAR_FIELD, typeof(System.Int16));
columns.Add(ISBN_FIELD, typeof(System.String));
columns.Add(IMAGE_FILE_SPEC_FIELD, typeof(System.String));
columns.Add(TITLE_FIELD, typeof(System.String));
columns.Add(DESCRIPTION_FIELD, typeof(System.String));
columns.Add(UNIT_PRICE_FIELD, typeof(System.Decimal));
columns.Add(UNIT_COST_FIELD, typeof(System.Decimal));
columns.Add(ITEM_TYPE_FIELD, typeof(System.String));
columns.Add(PUBLISHER_NAME_FIELD, typeof(System.String));
//
// [Authors] is an optional column that will get added dynamically to the table schema
// when the stored proc. GetBookById is used to fill the 'Books' table
//
this.Tables.Add(table);
}
} //class BookData
} //namespace Duwamish7.Common.Data这是duwamish 7.0 cs 其中的一段代码,参考把~~~~~~~