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; } /// /// 将c# DateTime时间格式转换为Unix时间戳格式 /// /// 时间 /// long 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; } } }