1. Enumeration
<Select id = "accounttype" name = "accounttype">
<Option value = ""> --- all --- </option>
@ Foreach (VAR item in lib4net. Comm. enumhelper. gemembertvalues <psaccounttype> ())
{
<Option value = "@ (INT) item)"> @ item. getdescription () </option>
}
</SELECT>
2. Retrieve enumeration description
/// <Summary>
/// Obtain the Object Description
/// </Summary>
/// <Param name = "input"> </param>
/// <Returns> </returns>
Public static string getdescription (this object input)
{
If (input = NULL)
Return string. empty;
Type enumtype = input. GetType ();
If (! Enumtype. isenum)
{
Return string. empty;
}
VaR name = enum. getname (enumtype, convert. toint32 (input ));
If (name = NULL)
Return string. empty;
Object [] objs = enumtype. getfield (name). getcustomattributes (typeof (descriptionattribute), false );
If (objs = NULL | objs. Length = 0)
{
Return string. empty;
}
Else
{
Descriptionattribute ATTR = objs [0] As descriptionattribute;
Return ATTR. description;
}
}
3. display or process strings
/// <Summary>
/// If the data is empty, it is displayed-
/// </Summary>
/// <Param name = "input"> </param>
/// <Returns> </returns>
Public static string tocustomerstring (this object input)
{
If (input = NULL)
Return "---";
Else
Return input. tostring ();
}
/// <Summary>
/// Complete the operation:
/// 1. trim, remove leading and trailing Spaces
/// 2. Set the null string to null.
/// </Summary>
/// <Param name = "input"> Object </param>
Public static void customizetrim (this object input)
{
If (input! = NULL)
{
Type type = input. GetType ();
Propertyinfo [] Infos = type. getproperties ();
Object val = NULL;
String strval = NULL;
Foreach (propertyinfo info in Infos)
{
Val = info. getvalue (input, null );
If (Val! = NULL)
{
If (Val. GetType (). fullname = typeof (string). fullname)
{
Strval = Val as string;
If (string. isnullorwhitespace (strval ))
{
Strval = NULL;
}
Else
{
Strval = strval. Trim ();
}
If (info. canwrite)
{
Info. setvalue (input, strval, null );
}
}
}
}
}
}
5. Oracle stored procedure call [return information, monomer or list]
Public iresult fundbuild (string partnerid, string userid, datetime begindate, datetime enddate)
{
List <dbparameter> dblist = new list <dbparameter> ();
Dblist. Add (New dbparameter {name = "v_parnter_id", value = partnerid });
Dblist. Add (New dbparameter {name = "v_start_date", value = begindate });
Dblist. Add (New dbparameter {name = "v_end_date", value = enddate });
Dblist. Add (New dbparameter {name = "v_operator", value = userid });
Dblist. Add (New dbparameter {name = "v_error_code", direction = parameterdirection. Output });
Dblist. Add (New dbparameter {name = "v_msg", direction = parameterdirection. Output });
Arraylist REV = dbaccess. dbprovider. excuteproctoarray ("sp_dchannel_fund_build", dblist. toarray ());
Bool status = commfun. toint (Rev [0],-1) = errorcode. success;
String MSG = rev [1] as string;
Return new result (status, MSG );
}
Public datatable getshopreport (shoporderquery query)
{
List <oracleparameter> plist = new list <oracleparameter> ();
Plist. Add (New oracleparameter {parametername = "v_platform_id", value = query. platformid });
Plist. Add (New oracleparameter {parametername = "v_business_type", value = query. businesstype });
Plist. Add (New oracleparameter {parametername = "v_product_no", value = query. productno });
Plist. Add (New oracleparameter {parametername = "v_shop_id", value = query. shopid });
Plist. Add (New oracleparameter {parametername = "v_business_no", value = query. businessno });
Plist. Add (New oracleparameter {parametername = "v_begin_date", value = query. begindate });
Plist. Add (New oracleparameter {parametername = "v_end_date", value = query. enddate });
Oracleparameter dataset = new oracleparameter {parametername = "v_data", oracledbtype = oracledbtype. refcursor, direction = parameterdirection. Output };
Plist. Add (Dataset );
Dataset DS = _ platformorderdataaccess. dbprovider. getdatasetbyprocedure ("bp_sp_sale_report", plist. toarray ());
Return Ds. Tables [0];
}