📄 common.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
/// <summary>
/// Common の概要の説明です
/// </summary>
public class Common
{
public Common()
{
}
//将Null转化为空字符串""
public string StringNullToEmpty(string paramStr)
{
if (paramStr == null)
{
paramStr = "";
}
return paramStr;
}
//将int转化为string
//先判断int值为Null,是则转化为字符串"".不为空转化为相应的字符串
public string IntToString(System.Nullable<int> paramInt)
{
string paramStr;
if (paramInt == null)
{
paramStr = "";
}
else
{
paramStr = paramInt.ToString();
}
return paramStr;
}
public string DecimalToString(System.Nullable<decimal> paramDecimal)
{
string paramStr;
if (paramDecimal == null)
{
paramStr = "";
}
else
{
paramStr = paramDecimal.ToString();
}
return paramStr;
}
//将DateTime转化为string
//先判断DateTime值为Null,是则转化为字符串"".不为空转化为相应的字符串
public string DateTimeToString(System.Nullable<DateTime> paramDT)
{
string paramStr;
if (paramDT == null)
{
paramStr = "";
}
else
{
paramStr = paramDT.ToString();
}
return paramStr;
}
/// 对待备贷订单sql检索语句的拼接处理
public string GetSqlStr(string orderID, int customerID, int orderCreaterID, string beginDate, string endDate, int orgID)
{
String[] str = new String[4] { " CustomerID=", " OrderCreaterID=", " OrderDate between", " orgID= " };
string strSql = "select * from Orders where OrderID like " +"'"+ orderID +"%"+"'" ;
if (Convert.ToString(customerID) != "0")
{
strSql +=" and"+str[0].ToString() + customerID;
}
else { }
if (Convert.ToString(orderCreaterID) != "0")
{
strSql +=" and"+str[1].ToString() + orderCreaterID;
}
else { }
strSql += " and"+str[2].ToString() + "'" + beginDate + "'" + " and" + "'" + endDate + "'"; //加入时间搜索
if (Convert.ToString(orgID) != "-1")
{
strSql += " and"+str[3].ToString() + orgID;
}
else { }
return strSql += " ORDER BY OrderDate DESC";
}
//public string GetWhere(bool where)
//{
// if (where)
// {
// string whereStr = "";
// return whereStr;
// }
// else
// {
// string whereStr = " where";
// return whereStr;
// }
//}
//public string GetAnd(bool and)
//{
// if (and)
// {
// string andStr = " and";
// return andStr;
// }
// else
// {
// string andStr = "";
// return andStr;
// }
//}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -