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
}
}