| | |
| | | { |
| | | public class DoorLockCommonInfo : ZigBee.Device.DoorLock |
| | | { |
| | | public DoorLockCommonInfo() |
| | | #region 本地变量 |
| | | public static bool InTempPasswordVisiable = false; |
| | | public static int ValidDateYear = 0; |
| | | public static int ValidDateMonth = 0; |
| | | public static int ValidDateDay = 0; |
| | | public static int ValidDateHour = 100; |
| | | public static int ValidDateMinute = 100; |
| | | public static int ValidDateSecond = 0; |
| | | public static int InValidDateYear = 0; |
| | | public static int InValidDateMonth = 0; |
| | | public static int InValidDateDay = 0; |
| | | public static int InValidDateHour = 100; |
| | | public static int InValidDateMinute = 100; |
| | | public static int InValidDateSecond = 0; |
| | | #endregion |
| | | /// <summary> |
| | | /// 生成6位临时密码 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static string GetTempPassword() |
| | | { |
| | | string password = ""; |
| | | password = new Random().Next(100000, 999999).ToString(); |
| | | return password; |
| | | } |
| | | |
| | | public class DoorLockFingerprintInfo |
| | | /// <summary> |
| | | /// 将UNIX时间戳转换成系统时间(精确到秒) |
| | | /// <returns></returns> |
| | | public static DateTime GetLocalTime(int unixTimeStamp) |
| | | { |
| | | /// <summary> |
| | | /// 指纹备注 |
| | | /// </summary> |
| | | public string fingerprintRemark = string.Empty; |
| | | /// <summary> |
| | | /// 指纹图片 |
| | | /// </summary> |
| | | public string fingerprintImage = string.Empty; |
| | | DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); |
| | | long lTime = long.Parse(unixTimeStamp + "0000000"); |
| | | TimeSpan toNow = new TimeSpan(lTime); |
| | | DateTime dtResult = dtStart.Add(toNow); |
| | | return dtResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 将系统时间转换成UNIX时间戳(精确到秒) |
| | | /// </summary> |
| | | /// <param name="dateTime">北京时间</param> |
| | | /// <param name="accurateToMilliseconds">精确到毫秒,否到秒</param> |
| | | /// <returns>返回一个长整数时间戳</returns> |
| | | public static string GetUnixTimeStamp(DateTime dateTime) |
| | | { |
| | | DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); |
| | | //DateTime dtNow = DateTime.Parse(DateTime.Now.ToString()); |
| | | TimeSpan toNow = dateTime.Subtract(dtStart); |
| | | string timeStamp = toNow.Ticks.ToString(); |
| | | timeStamp = timeStamp.Substring(0, timeStamp.Length - 7); |
| | | return timeStamp; |
| | | } |
| | | |
| | | /// <summary> |