添加项目文件。
This commit is contained in:
37
HT.Cloud.Code/Util/Utils.cs
Normal file
37
HT.Cloud.Code/Util/Utils.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace HT.Cloud.Code
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
#region 自动生成编号
|
||||
|
||||
/// <summary>
|
||||
/// 表示全局唯一标识符 (GUID)。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GuId()
|
||||
{
|
||||
return IDGen.NextID().ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动生成编号 201008251145409865
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string CreateNo()
|
||||
{
|
||||
Random random = new Random();
|
||||
string strRandom = random.Next(1000, 10000).ToString(); //生成编号
|
||||
string code = DateTime.Now.ToString("yyyyMMddHHmmss") + strRandom;//形如
|
||||
return code;
|
||||
}
|
||||
|
||||
#endregion 自动生成编号
|
||||
|
||||
public static string GetGuid()
|
||||
{
|
||||
return IDGen.NextID().ToString().Replace("-", string.Empty).ToLower();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user