Пример #1
0
 private string ParkInterval(Ralid.Park.BusinessModel.Report.CardEventReport report)
 {
     if (report.LastDateTime != null)
     {
         TimeSpan span = new TimeSpan(report.EventDateTime.Ticks - report.LastDateTime.Value.Ticks);
         return(string.Format("{0:D2}:{1:D2}:{2:D2}", span.Days, span.Hours, span.Minutes));
     }
     else
     {
         return("00:00:00");
     }
 }
Пример #2
0
        public Message(Ralid.Park.BusinessModel.Report.CardEventReport report) //卡片进出记录消息
        {
            DateTime dt        = DateTime.Now;
            string   serialNum = dt.ToString("yyyyMMdd") + SerialNum().ToString("00000");
            string   carplate  = !string.IsNullOrEmpty(report.CarPlate) ? report.CarPlate : new string(' ', 1);
            string   data;

            if (report.IsExitEvent)
            {
                //~ PCQRU &0108&2008120800001|1001|粤A8888Q|2008-12-08 13:00:00|2008-12-08 17:00:00|临保|00:04:00|40|200|2008-12-08 17:00:00 #

                string cardType = report.CardType.IsMonthCard ? "月保" : "临保";
                string interval = ParkInterval(report);

                data = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}",
                                     serialNum,
                                     ParkID,
                                     carplate,
                                     report.LastDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                                     report.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                     cardType,
                                     interval,
                                     (int)(report.CardPaymentInfo != null ? report.CardPaymentInfo.Paid : 0),
                                     GetVacant(),
                                     dt.ToString("yyyy-MM-dd HH:mm:ss"));
                _Message = string.Format("~{0}&{1}&{2}#", "PCQRU", System.Text.ASCIIEncoding.GetEncoding("GB2312").GetByteCount(data).ToString("0000"), data);
            }
            else
            {
                //~PCERU&0070&2008120800001|1001|粤A8888Q|2008-12-08 13:00:00|40|2008-12-08 17:00:00#
                data = string.Format("{0}|{1}|{2}|{3}|{4}|{5}",
                                     serialNum,
                                     ParkID,
                                     carplate,
                                     report.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                     GetVacant(),
                                     dt.ToString("yyyy-MM-dd HH:mm:ss"));
                _Message = string.Format("~{0}&{1}&{2}#", "PCERU", System.Text.ASCIIEncoding.GetEncoding("GB2312").GetByteCount(data).ToString("0000"), data);
            }
        }