2024-05-08 11:01:54 +08:00
|
|
|
|
namespace BLL
|
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Data.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ͨ<>÷<EFBFBD><C3B7><EFBFBD><EFBFBD>ࡣ
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class Funs
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ÿҳ<C3BF><D2B3><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static int PageSize
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = 15;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ά<><CEAC>һ<EFBFBD><D2BB>DB<44><42><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static Dictionary<int, Model.EProjectDB> dataBaseLinkList = new System.Collections.Generic.Dictionary<int, Model.EProjectDB>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ά<><CEAC>һ<EFBFBD><D2BB>DB<44><42><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static System.Collections.Generic.Dictionary<int, Model.EProjectDB> DBList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return dataBaseLinkList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static string connString;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string ConnString
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (connString == null)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return connString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (connString != null)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connString = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string UnitSet
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ·<><C2B7>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string RootPath
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ϵͳ<CFB5><CDB3>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string SystemName
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ldap <20><>ַ
|
|
|
|
|
public static string LdapUrl
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static Model.EProjectDB DB
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (!DBList.ContainsKey(System.Threading.Thread.CurrentThread.ManagedThreadId))
|
|
|
|
|
{
|
|
|
|
|
DBList.Add(System.Threading.Thread.CurrentThread.ManagedThreadId, new Model.EProjectDB(connString));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DBList[System.Threading.Thread.CurrentThread.ManagedThreadId];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PleaseSelect(System.Web.UI.WebControls.DropDownList DDL, string itemText)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem(itemText, BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-06-24 10:28:40 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½ClientId<49><64><EFBFBD><EFBFBD>
|
|
|
|
|
public static string ClientId
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½ClientSecret<65><74><EFBFBD><EFBFBD>
|
|
|
|
|
public static string ClientSecret
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½Redirect_url<72><6C><EFBFBD><EFBFBD>
|
|
|
|
|
public static string Redirect_url
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
2024-05-08 11:01:54 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ΪĿ<CEAA><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><>ѡ<EFBFBD><D1A1>" <20><>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DLL">Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
public static void FineUIPleaseSelect(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem("", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ΪĿ<CEAA><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><>ѡ<EFBFBD><D1A1>" <20><>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DLL">Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
public static void FineUINA(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem(" N/A ", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DDL"></param>
|
|
|
|
|
public static void FineUIPleaseSelectJobType(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem("Select Job Type", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ״̬<D7B4><CCAC>ѡ<EFBFBD><D1A1>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DDL"></param>
|
|
|
|
|
public static void FineUIPleaseSelectJobStatus(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem("Select Job Status", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// רҵ<D7A8><D2B5>ѡ<EFBFBD><D1A1>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DDL"></param>
|
|
|
|
|
public static void FineUIPleaseSelectDivision(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem("Select Division", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// β<><CEB2>רҵ<D7A8><D2B5>ѡ<EFBFBD><D1A1>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DDL"></param>
|
|
|
|
|
public static void FineUIPleaseSelectPunshDiscipline(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem("Select Punch Discipline", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void FineUIPleaseSelectPunshClass(FineUIPro.DropDownList DDL)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem("Select Punch Priority", BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void FineUIPleaseSelect(FineUIPro.DropDownList DDL, string itemText)
|
|
|
|
|
{
|
|
|
|
|
DDL.Items.Insert(0, new FineUIPro.ListItem(itemText, BLL.Const._Null));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ΪĿ<CEAA><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>" <20><>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DLL">Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
//public static void ReCompileSelect(System.Web.UI.WebControls.DropDownList DDL)
|
|
|
|
|
//{
|
|
|
|
|
// DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem("<22><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>", "0"));
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ΪĿ<CEAA><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>" <20><>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DLL">Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
//public static void FineUIReCompileSelect(FineUIPro.DropDownList DDL)
|
|
|
|
|
//{
|
|
|
|
|
// DDL.Items.Insert(0, new FineUIPro.ListItem("<22><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>", "0"));
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="decimalStr">Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
/// <returns><3E><><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD></returns>
|
|
|
|
|
public static bool IsDecimal(string decimalStr)
|
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrEmpty(decimalStr))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Convert.ToDecimal(decimalStr, NumberFormatInfo.InvariantInfo);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="integerStr">Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
/// <returns><3E><><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD></returns>
|
|
|
|
|
public static bool IsInteger(string integerStr)
|
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrEmpty(integerStr))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Convert.ToInt32(integerStr, NumberFormatInfo.InvariantInfo);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡ<EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="number">Ҫת<D2AA><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
/// <returns><3E>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD></returns>
|
|
|
|
|
public static string InterceptDecimal(object number)
|
|
|
|
|
{
|
|
|
|
|
if (number == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
decimal newNumber = 0;
|
|
|
|
|
string newNumberStr = "";
|
|
|
|
|
int an = -1;
|
|
|
|
|
string numberStr = number.ToString();
|
|
|
|
|
int n = numberStr.IndexOf(".");
|
|
|
|
|
if (n == -1)
|
|
|
|
|
{
|
|
|
|
|
return numberStr;
|
|
|
|
|
}
|
|
|
|
|
for (int i = n + 1; i < numberStr.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string str = numberStr.Substring(i, 1);
|
|
|
|
|
if (str == "0")
|
|
|
|
|
{
|
|
|
|
|
if (GetStr(numberStr, i))
|
|
|
|
|
{
|
|
|
|
|
an = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (an == -1)
|
|
|
|
|
{
|
|
|
|
|
newNumber = Convert.ToDecimal(numberStr);
|
|
|
|
|
}
|
|
|
|
|
else if (an == n + 1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
newNumberStr = numberStr.Substring(0, an - 1);
|
|
|
|
|
newNumber = Convert.ToDecimal(newNumberStr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
newNumberStr = numberStr.Substring(0, an);
|
|
|
|
|
newNumber = Convert.ToDecimal(newNumberStr);
|
|
|
|
|
}
|
|
|
|
|
return newNumber.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20>ж<EFBFBD><D0B6>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ӵ<EFBFBD>nλ<6E><CEBB>ʼ<EFBFBD>Ժ<EFBFBD><D4BA>Ƿ<EFBFBD><C7B7><EFBFBD>Ϊ0
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="number">Ҫ<>жϵ<D0B6><CFB5>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
/// <param name="n"><3E><>ʼ<EFBFBD><CABC>λ<EFBFBD><CEBB></param>
|
|
|
|
|
/// <returns>false<73><65><EFBFBD><EFBFBD>Ϊ0<CEAA><30>true<75><65>Ϊ0</returns>
|
|
|
|
|
public static bool GetStr(string number, int n)
|
|
|
|
|
{
|
|
|
|
|
for (int i = n; i < number.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (number.Substring(i, 1) != "0")
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡ<EFBFBD><C8A1>λ<EFBFBD><CEBB>ˮ<EFBFBD><CBAE>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="num"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string GetThreeNumber(string num)
|
|
|
|
|
{
|
|
|
|
|
int number = 0;
|
|
|
|
|
string reValue = string.Empty;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
number = Int32.Parse(num) + 1;
|
|
|
|
|
if (number.ToString().Length == 1)
|
|
|
|
|
{
|
|
|
|
|
reValue = "00" + number.ToString();
|
|
|
|
|
}
|
|
|
|
|
else if (number.ToString().Length == 2)
|
|
|
|
|
{
|
|
|
|
|
reValue = "0" + number.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
reValue = number.ToString();
|
|
|
|
|
}
|
|
|
|
|
return reValue;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="str">Ҫ<><D2AA>ȡ<EFBFBD><C8A1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
/// <param name="n"><3E><><EFBFBD><EFBFBD></param>
|
|
|
|
|
/// <returns><3E><>ȡ<EFBFBD><C8A1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></returns>
|
|
|
|
|
public static string GetSubStr(object str, object n)
|
|
|
|
|
{
|
|
|
|
|
if (str != null)
|
|
|
|
|
{
|
|
|
|
|
if (str.ToString().Length > Convert.ToInt32(n))
|
|
|
|
|
{
|
|
|
|
|
return str.ToString().Substring(0, Convert.ToInt32(n)) + "....";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return str.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>ת<EFBFBD><D7AA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static DateTime? GetNewDateTime(string time)
|
|
|
|
|
{
|
|
|
|
|
if (!String.IsNullOrEmpty(time))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return DateTime.Parse(time);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static decimal? GetNewDecimal(string value)
|
|
|
|
|
{
|
|
|
|
|
if (!String.IsNullOrEmpty(value))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return decimal.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static double? GetNewDouble(string value)
|
|
|
|
|
{
|
|
|
|
|
if (!String.IsNullOrEmpty(value))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return double.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static decimal GetNewDecimalOrZero(string value)
|
|
|
|
|
{
|
|
|
|
|
decimal returnValue = 0;
|
|
|
|
|
if (!String.IsNullOrEmpty(value))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
returnValue = decimal.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static int? GetNewInt(string value)
|
|
|
|
|
{
|
|
|
|
|
if (!String.IsNullOrEmpty(value))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return Int32.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static int GetNewIntOrZero(string value)
|
|
|
|
|
{
|
|
|
|
|
int returnValue = 0;
|
|
|
|
|
if (!String.IsNullOrEmpty(value))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
returnValue = Int32.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrLogInfo.WriteLog(ex);
|
|
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ָ<><D6B8><EFBFBD>ϴ<EFBFBD><CFB4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string GetNewFileName()
|
|
|
|
|
{
|
|
|
|
|
Random rm = new Random(System.Environment.TickCount);
|
|
|
|
|
return System.DateTime.Now.ToString("yyyyMMddhhmmss") + rm.Next(1000, 9999).ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ݱ<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>list
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="str"></param>
|
|
|
|
|
/// <param name="n"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<string> GetStrListByStr(string str, char n)
|
|
|
|
|
{
|
|
|
|
|
List<string> strList = new List<string>();
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
|
|
{
|
|
|
|
|
strList.AddRange(str.Split(n));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return strList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>תʱ<D7AA><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="datetime"></param>
|
|
|
|
|
/// <returns>long=Int64</returns>
|
|
|
|
|
public static long DateTimeToTimestamp(DateTime datetime)
|
|
|
|
|
{
|
|
|
|
|
DateTime dd = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
|
|
|
|
DateTime timeUTC = DateTime.SpecifyKind(datetime, DateTimeKind.Utc);//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ת<EFBFBD><D7AA>UTCʱ<43><CAB1>
|
|
|
|
|
TimeSpan ts = (timeUTC - dd);
|
|
|
|
|
return (Int64)ts.TotalMilliseconds;//<2F><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|