IcsFromERPJob
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ICSSoft.FromERP
{
public class ConstWorkPoint
{
public const string WorkPoint = "6000";
public const string Muser = "job";
public const string Musername = "job";
}
public class Common
{
public static decimal TurnDecimal(decimal? deci)
{
decimal result = 0;
if (!string.IsNullOrEmpty(deci.ToString()))
{
result = decimal.Parse(deci.ToString());
}
return result;
}
public static string CreateNo()
{
Random random = new Random();
string strRandom = random.Next(1000, 10000).ToString(); //生成编号
string code = DateTime.Now.ToString("yyyyMMddHHmmss") + strRandom;//形如
return code;
}
/// <summary>
/// 将c# DateTime时间格式转换为Unix时间戳格式
/// </summary>
/// <param name="time">时间</param>
/// <returns>long</returns>
public static long ConvertDateTimeToInt(System.DateTime time)
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
long t = (time.Ticks - startTime.Ticks) / 10000; //除10000调整为13位
return t;
}
}
}