Esempio n. 1
0
        public static byte[] CombinationDistanceCard(DistanceParameterContent parameter, List <PlateCardData> data)
        {
            int start    = 0;
            int type     = SetTypeParameter(parameter, data);
            int function = SetFunctionParameeter(parameter.Function.Value);

            StringBuilder sb = new StringBuilder();

            if (function != -1)
            {
                sb.AppendFormat("{0:X2}", function);
            }
            else
            {
                start = 1;
            }
            sb.AppendFormat("{0:X4}", parameter.Count);
            if (data != null)
            {
                if (data.Count > 0)
                {
                    foreach (PlateCardData item in data)
                    {
                        sb.AppendFormat("{0:yyMMdd}", item.Time);
                        sb.AppendFormat("{0:X4}", item.Partition);
                        sb.Append(GetLprNumber(item.Plate));
                    }
                }
                else
                {
                    sb.Append("FFFFFFFFFFFFFFFFFFFFFFFFFF");
                }
            }
            return(PortAgreement.GetDistanceContent(parameter.CardNumber, type, start, sb.ToString()));
        }
Esempio n. 2
0
        public static byte[] SetDistanceData(LprCardDataParam param, ref int functionbyte)
        {
            int typebyte = SetCardTypeByte(param.CardTypeParam);

            functionbyte = SetCardFunctionByte(param.CardFunctioinParam);

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0:X2}", functionbyte);
            sb.AppendFormat("{0:X4}", param.Count);
            if (param.ViceCards != null && param.ViceCards.Count > 0)
            {
                foreach (LprCardViceCardParam item in param.ViceCards)
                {
                    sb.AppendFormat("{0:yyMMdd}", item.ViceCardTime);
                    sb.AppendFormat("{0:X4}", item.ViceCardPartition);
                    sb.Append(GetPlateNumber(item.PlateNumber));
                }
            }
            else
            {
                sb.Append("FFFFFFFFFFFFFFFFFFFFFFFFFF");
            }
            return(PortAgreement.GetDistanceContent(param.CardNumber, typebyte, 0, sb.ToString()));
        }
Esempio n. 3
0
        public static byte[] SetDistanceData(string cardnumber, int count, DateTime time, int partition)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0:X4}", count);
            sb.AppendFormat("{0:yyMMdd}", time);
            sb.AppendFormat("{0:X4}", partition);
            return(PortAgreement.GetDistanceContent(cardnumber, 1, sb.ToString()));
        }
Esempio n. 4
0
        public static byte[] SetDistanceData(SingleCardDataParam param, ref int functionbyte)
        {
            int typebyte = SetCardTypeByte(param.CardTypeParam);

            functionbyte = SetCardFunctionByte(param.CardFunctioinParam);

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0:X2}", functionbyte);
            sb.AppendFormat("{0:X4}", param.Count);
            sb.AppendFormat("{0:yyMMdd}", param.NewTime);
            sb.AppendFormat("{0:X4}", param.Partition);
            return(PortAgreement.GetDistanceContent(param.CardNumber, typebyte, 0, sb.ToString()));
        }
Esempio n. 5
0
        public static byte[] SetDistanceData(string cardnumber, int count, List <LprCardViceCardParam> param)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0:X4}", count);
            if (param != null && param.Count > 0)
            {
                foreach (LprCardViceCardParam item in param)
                {
                    sb.AppendFormat("{0:yyMMdd}", item.ViceCardTime);
                    sb.AppendFormat("{0:X4}", item.ViceCardPartition);
                    sb.Append(GetPlateNumber(item.PlateNumber));
                }
            }
            else
            {
                sb.Append("FFFFFFFFFFFFFFFFFFFFFFFFFF");
            }
            return(PortAgreement.GetDistanceContent(cardnumber, 1, sb.ToString()));
        }
Esempio n. 6
0
        public static byte[] SetLossCard(LossCardDataParam[] param)
        {
            StringBuilder sb       = new StringBuilder();
            int           datatype = 16777215;
            int           cardtype = 1;
            int           index    = 23;

            foreach (LossCardDataParam item in param)
            {
                cardtype = item.CardType != CardTypes.ViceCard ? 2 : 1;
                for (int i = 0; i < 2; i++)
                {
                    int typebinary = BinaryHelper.GetIntegerSomeBit(cardtype, i);
                    datatype = BinaryHelper.SetIntegeSomeBit(datatype, index - i, typebinary != 0);
                }
                index -= 2;
                sb.Append(item.CardNumber);
                sb.AppendFormat("{0:X2}", BinaryHelper.SetIntegeSomeBit(item.Functionbyte, 7, true));
                sb.AppendFormat("{0:yyMM}", item.CardTime.AddMonths(1));
            }
            return(PortAgreement.GetDistanceContent("797979", 0, string.Format("{0:X2}{1:X6}{2}", param.Length, datatype, sb.ToString())));
        }
Esempio n. 7
0
        public static byte[] CombinationDistanceCard(DistanceParameterContent parameter, SingleCardData?data)
        {
            int start    = 0;
            int type     = SetTypeParameter(parameter, data);
            int function = SetFunctionParameeter(parameter.Function.Value);

            StringBuilder sb = new StringBuilder();

            if (function != -1)
            {
                sb.AppendFormat("{0:X2}", function);
            }
            else
            {
                start = 1;
            }
            sb.AppendFormat("{0:X4}", parameter.Count);
            if (data != null)
            {
                sb.AppendFormat("{0:yyMMdd}", data.Value.Time);
                sb.AppendFormat("{0:X4}", data.Value.Partition);
            }
            return(PortAgreement.GetDistanceContent(parameter.CardNumber, type, start, sb.ToString()));
        }