private void save(string sender, string text, string date) { DateTime dt = DateTime.Parse(date);//DateTime.ParseExact(date, "yyyyMMddHHmmss", null, System.Globalization.DateTimeStyles.None); byte[] b = Convert.FromBase64String(text); string content = Utility.GetHex(b); //try { TX300 x300 = new TX300(content); x300.package_to_msg(); x300.TerminalID = sender + "000"; //save(x300); if (x300.CommandID == 0xBB0F) { handleBB0F(sender, x300.TerminalType); } var SMSInstance = new SmsBLL(); var sms = SMSInstance.GetObject(); sms.SendTime = dt; sms.Sender = sender; sms.Data = text; // 这里接收到的都是终端汇报回来的信息 sms.Type = Common.SMSUtility.SMS_TERMINAL; SMSInstance.Add(sms); } }
/// <summary> /// 处理tracker汇报的数据 /// </summary> /// <param name="obj"></param> private void HandleReportData(Api obj) { var tmp = ParseJson <Account>(obj.content); if (null != tmp && !string.IsNullOrEmpty(tmp.data)) { string base64 = HttpUtility.UrlDecode(tmp.data); try { using (var bll = new SmsBLL()) { TB_SMS sms = bll.GetObject(); sms.Data = base64; sms.Sender = tmp.name; sms.Type = SMSUtility.SMS_TRACKER; bll.Add(sms); ResponseData(0, "Data saved"); } } catch (Exception e) { ResponseData(-1, string.Format("Can not handle your [report] request: {0}", e.Message)); } } else { ResponseData(-1, "Cannot handler data report request with error content."); } }