Exemplo n.º 1
0
 //获取星期字
 private byte getWeekByte(DoorTimeView doortime)
 {
     byte weekByte = 0x00;
     if (doortime.Sunday)
     {
         weekByte += 0x01;
     }
     if (doortime.Monday)
     {
         weekByte += 0x02;
     }
     if (doortime.Tuesday)
     {
         weekByte += 0x04;
     }
     if (doortime.Wednesday)
     {
         weekByte += 0x08;
     }
     if (doortime.Thursday)
     {
         weekByte += 0x10;
     }
     if (doortime.Friday)
     {
         weekByte += 0x20;
     }
     if (doortime.Saturday)
     {
         weekByte += 0x40;
     }
     if (doortime.Holiday)
     {
         weekByte += 0x80;
     }
     return weekByte;
 }
Exemplo n.º 2
0
        public void SetDoorTime(DoorTimeView doortime)
        {
            log.Info("TCPControl set door time: DoorNum= " + doortime.DoorNum + ",DoorTimeNum=" + doortime.DoorTimeNum + ",StartTime=" + doortime.StartTime + ",EndTime" + doortime.EndTime + ",WeekByte= " + getWeekByte(doortime) + " ,PassBack=" + true + ",Indetifys= " + doortime.Identify + ",LimitDate= " + doortime.LimitDate + ",group=0");

            /* public Boolean AddTimeZone(
             *  UInt16 Door,
             *  byte Index,
             *  DateTime frmtime,
             *  DateTime totime,
             *  byte Week,
             *  Boolean PassBack,
             *  byte Indetify,
             *  DateTime Enddatetime,
             *  byte Group
             *  )
             */
            DateTime startTime = doortime.StartTime;
            DateTime endTime = doortime.EndTime;
            startTime.AddYears(2000);
            endTime.AddYears(2000);
            bool result = connector.AddTimeZone(
                (byte)doortime.DoorNum,
                (byte)doortime.DoorTimeNum,
                startTime,
                endTime,
                getWeekByte(doortime),
                true,
                (byte)doortime.Identify,
                doortime.LimitDate,
                0 //group
                );
            if (!result)
            {
                log.Info("TCPControl set door: Fail..." + connector.TCPLastError);
            }
        }