Esempio n. 1
0
        public bool Personalize(out byte[] uid, RPTPersoSector persoSector)
        {
            bool ret = false;

            byte[]  cardUid    = null;
            byte    cardUidLen = 0;
            LIB_ERR err        = LIB_ERR.NO_ERROR;

            ret = rpt.Do(persoSector, ref cardUid, ref cardUidLen, ref err);
            uid = new byte[cardUidLen];
            Array.Copy(cardUid, uid, uid.Length);

            return(ret);
        }
Esempio n. 2
0
        static bool Personalize(out byte[] uid)
        {
            bool   result       = false;
            object ticketObject = null;

            switch (Ticket.journeyType)
            {
            case JourneyType.SJT:
                ticketObject = new TicketSJT {
                    stationIn = Convert.ToByte(Ticket.startStation.id), stationOut = Convert.ToByte(Ticket.endStation.id), price = Convert.ToUInt16(Ticket.ticketPrice)
                };
                break;

            case JourneyType.RJT:
                ticketObject = new TicketRJT {
                    stationInOut = Convert.ToByte(Ticket.startStation.id), stationOutIn = Convert.ToByte(Ticket.endStation.id), price = Convert.ToUInt16(Ticket.ticketPrice)
                };
                break;

            case JourneyType.Day_Pass:
                ticketObject = new TicketDayPass {
                    price = Convert.ToUInt16(Ticket.ticketPrice)
                };
                break;

            case JourneyType.Weekend_Pass:
                ticketObject = new TicketWeekendPass {
                    passType = Convert.ToByte(0), price = Convert.ToUInt16(Ticket.ticketPrice)
                };
                break;

            case JourneyType.Group_Ticket:
                ticketObject = new TicketGroup {
                    stationIn = Convert.ToByte(Ticket.startStation.id), stationOut = Convert.ToByte(Ticket.endStation.id), peopleCount = Convert.ToByte(Ticket.peopleCount), price = Convert.ToUInt16(Ticket.ticketPrice)
                };
                break;

            case JourneyType.EventTicket:
                ticketObject = new TicketEventPass {
                    startDT = Ticket.ticketActivateDts, endDT = Ticket.ticketExpiryDts, price = Convert.ToUInt16(Ticket.ticketPrice)
                };
                break;
            }

            var persoSector = new RPTPersoSector(Convert.ToByte(Ticket.startStation.id), DateTime.Now, ticketObject);

            result = Dispenser.Instance.Personalize(out uid, persoSector);

            return(result);
        }