Define a dbparam class and dbparamcollection

Source: Internet
Author: User

Using system;
Using system. collections;

Namespace livechain. CSW. dataaccess
{
/// <Summary>
/// Summary description for dbparams.
/// </Summary>
/// <Summary>
/// DB Param type. Use Type by self can easy to extend ..
/// The cursor
/// </Summary>
Public Enum dbptype
{
String = 1,
Decimal = 2,
Int16 = 3,
Int32 = 4,
Int = 4,
Int64 = 5,
Datetime = 6,
Boolean = 7,
Binary = 8,
Double = 9,

Cursor = 20
}

Public Enum dbparamdirection
{
Input = 1,
Output = 2,
InputOutput = 3
}
Public class dbparam
{
Public string name;
Public object value;
Public dbptype type;
Public int size;
Public dbparamdirection direction;

// If the name changed, the old name use to find it's name with start.
// The conllection's index [String] use this oldname;
// But, it also take a problem, when the Use Change the name before do procedure.
// The result value will wrong .??
Public String oldname
{
Get {return oldname ;}
}
Private string oldname;

Public dbparam (string aname, dbptype ptype, int asize, object avalue, dbparamdirection pdirection)
{
Oldname = aname;
Name = aname;
Value = avalue;
Type = ptype;
Size = asize;
This. Direction = pdirection;
}
Public dbparam (string aname, dbptype ptype, int asize, dbparamdirection pdirection)
: This (aname, ptype, asize, null, pdirection)
{}

Public dbparam (string aname, dbptype ptype, int asize, object avalue)
: This (aname, ptype, asize, avalue, dbparamdirection. Input)
{}

Public dbparam (string aname, dbptype ptype, object avalue)
: This (aname, ptype, 0, avalue)
{}
}

Public class dbparamcollection: system. Collections. collectionbase, system. componentmodel. ilistsource
{
// String fullname = "livechain. CSW. commondata. dbparam ";
Public dbparam this [int Index]
{
Get
{
Return (dbparam) list [Index]);
}
Set
{
List [Index] = value;
}
}
// Add the name index, can easy to use it.
Public dbparam this [string name]
{
Get {
Foreach (dbparam P in List)
{
If (P. oldname = Name)
Return P;
}
Return NULL;
}
}

Public int add (dbparam value)
{
Return (list. Add (value ));
}

Public int indexof (dbparam value)
{
Return (list. indexof (value ));
}

Public void insert (INT index, dbparam value)
{
List. insert (index, value );
}

Public void remove (dbparam value)
{
List. Remove (value );
}

Public bool contains (dbparam value)
{
// If value is not of Type dbparam, this will return false.
Return (list. Contains (value ));
}

# Region ilistsource Member

Public ilist getlist ()
{
// Todo: Add childlocationdatacollection. getlist
Return this. List;
}

Public bool containslistcollection
{
Get
{
// Todo: Add childlocationdatacollection. containslistcollection getter implementation
Return false;
}
}

# Endregion
}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.