Example #1
0
        public static string Serialize(CardPaymentInfo payment)
        {
            string text = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}",
                                        payment.ChargeDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                        payment.CardID,
                                        payment.EnterDateTime != null ? payment.EnterDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                                        payment.CarPlate,
                                        payment.CardType,
                                        payment.CarType,
                                        (byte)payment.TariffType,
                                        payment.LastTotalPaid,
                                        payment.Accounts,
                                        payment.Paid,
                                        payment.Discount,
                                        (byte)payment.PaymentMode,
                                        (byte)payment.PaymentCode,
                                        payment.IsCenterCharge,
                                        payment.Operator,
                                        payment.StationID,
                                        payment.Memo);

            byte[] data    = System.Text.UTF8Encoding.UTF8.GetBytes(text);
            string hex     = HexStringConverter.HexToString(data, string.Empty);
            string encript = (new DTEncrypt()).Encrypt(hex);

            return(encript);
        }
Example #2
0
 /// <summary>
 /// 设置卡片缴费数据(中央收费或出口收费)
 /// </summary>
 /// <param name="payment">缴费记录</param>
 public void SetPaidData(CardPaymentInfo payment)
 {
     if (!IsCompletedPaid || !MySetting.Current.IsInFreeTime(PaidDateTime.Value, payment.ChargeDateTime))
     {
         //未完成缴费或已过缴费后免费时间的
         ParkFee      = payment.ParkFee;              //更新外车场的停车费用
         PaidDateTime = payment.ChargeDateTime;       //更新缴费时间
     }
     IsPaid        = true;                            //更新缴费标识
     TotalPaidFee += payment.Paid + payment.Discount; //加上已缴费用
 }
Example #3
0
        public static CardPaymentInfo Deserialize(string value)
        {
            CardPaymentInfo item = null;
            string          hex  = (new DTEncrypt()).DSEncrypt(value);

            byte[] data = HexStringConverter.StringToHex(hex);
            string text = System.Text.UTF8Encoding.UTF8.GetString(data, 0, data.Length);

            string[] temp = text.Split('|');
            if (temp != null && temp.Length > 0)
            {
                try
                {
                    item = new CardPaymentInfo();
                    item.ChargeDateTime = DateTime.Parse(temp[0]);
                    item.CardID         = temp[1];
                    if (string.IsNullOrEmpty(temp[2]))
                    {
                        item.EnterDateTime = null;
                    }
                    else
                    {
                        item.EnterDateTime = DateTime.Parse(temp[2]);
                    }
                    item.CarPlate       = temp[3];
                    item.CardType       = byte.Parse(temp[4]);
                    item.CarType        = byte.Parse(temp[5]);
                    item.TariffType     = (TariffType)(byte.Parse(temp[6]));
                    item.LastTotalPaid  = decimal.Parse(temp[7]);
                    item.Accounts       = decimal.Parse(temp[8]);
                    item.Paid           = decimal.Parse(temp[9]);
                    item.Discount       = decimal.Parse(temp[10]);
                    item.PaymentMode    = (PaymentMode)(byte.Parse(temp[11]));
                    item.PaymentCode    = (PaymentCode)(byte.Parse(temp[12]));
                    item.IsCenterCharge = bool.Parse(temp[13]);
                    item.Operator       = temp[14];
                    item.StationID      = temp[15];
                    item.Memo           = temp[16];
                }
                catch (Exception ex)
                {
                    ExceptionPolicy.HandleException(ex);
                    item = null;
                }
            }
            return(item);
        }
Example #4
0
        /// <summary>
        /// 生成卡片外车场停车收费记录
        /// </summary>
        /// <param name="card">卡片</param>
        /// <param name="ts">停车场费率设置</param>
        /// <param name="tos" >收费设置选项</param>
        /// <param name="chargeDateTime">收费时间</param>
        /// <returns></returns>
        public static CardPaymentInfo CreateCardPaymentRecord(CardInfo card, MySetting ts, Byte carType, DateTime chargeDateTime)
        {
            CardPaymentInfo cardPayment = new CardPaymentInfo();

            cardPayment.ChargeDateTime = chargeDateTime;
            cardPayment.CardID         = card.CardID;
            cardPayment.EnterDateTime  = card.LastDateTime;
            cardPayment.CarPlate       = card.CarPlate;
            cardPayment.CardType       = card.CardType.ID;
            cardPayment.CarType        = carType;
            cardPayment.PaymentCode    = PaymentCode.POS;
            cardPayment.PaymentMode    = PaymentMode.Cash;
            cardPayment.IsCenterCharge = false;
            cardPayment.LastTotalPaid  = card.TotalPaidFee;

            ParkAccountsInfo parkFee = ts.CalculateCardParkFee(card, carType, chargeDateTime);

            cardPayment.ParkFee    = parkFee.ParkFee;
            cardPayment.Accounts   = parkFee.Accounts;
            cardPayment.TariffType = parkFee.TariffType;

            return(cardPayment);
        }