예제 #1
0
파일: SMSPnr.cs 프로젝트: cuitsl/asyncsdk
 /// <summary>
 /// 开始线程.
 /// </summary>
 /// <param name="SESSION">会话端.</param>
 /// <param name="InPacket">入口数据包.</param>
 /// <param name="OutPacket">出口数据包.</param>
 /// <param name="Key">The key.</param>
 protected override void ExecutePlugIn(eTerm.AsyncSDK.Core.eTerm363Session SESSION, eTerm.AsyncSDK.Core.eTerm363Packet InPacket, eTerm.AsyncSDK.Core.eTerm363Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
 {
     Match PnrMatch = Regex.Match(Encoding.GetEncoding("gb2312").GetString(SESSION.UnInPakcet(InPacket)).Trim(), @"^!SMSPNR\s+([A-Z0-9]{6,6})\s+(\d+)", RegexOptions.Multiline| RegexOptions.IgnoreCase);
     string Pnr = string.Empty;
     string Mobile = string.Empty;
     if (PnrMatch == null) {
         SESSION.SendPacket(__eTerm443Packet.BuildSessionPacket(SESSION.SID, SESSION.RID, "指令格式错误!"));
         return;
     }
     Pnr = PnrMatch.Groups[1].Value;
     Mobile = PnrMatch.Groups[2].Value;
     RTCommand Rt = new RTCommand();
     IPEndPoint ServerEP = SESSION.AsyncSocket.LocalEndPoint as IPEndPoint;
     Rt.Connect(ServerEP.Address.ToString(), ServerEP.Port, SESSION.userName, SESSION.userPass);
     if (SESSION.Async443 != null)
         SESSION.Async443.TSession = null;
     RTResult Result=Rt.retrieve(Pnr) as RTResult;
     StringBuilder sb = new StringBuilder();
     foreach (PNRAirSegResult Seg in Result.getAirSegs)
         sb.AppendFormat("航段:{0} {1}-{2} {3} {4}\r", Seg.getAirNo, Seg.getOrgCity, Seg.getDesCity, Seg.getDepartureTime, Seg.getArrivalTime);
     foreach (PNRPassengerResult Inf in Result.getPassengers)
         sb.AppendFormat("旅客:{0}\r", Inf.getName);
     sb.AppendFormat("{0}  Pnr信息已经发送至:{1}",Pnr, Mobile);
     SESSION.SendPacket(__eTerm443Packet.BuildSessionPacket(SESSION.SID, SESSION.RID,
             sb.ToString()
         ));
 }
예제 #2
0
 /// <summary>
 /// 开始线程.
 /// </summary>
 /// <param name="SESSION">会话端.</param>
 /// <param name="InPacket">入口数据包.</param>
 /// <param name="OutPacket">出口数据包.</param>
 /// <param name="Key">The key.</param>
 protected override void ExecutePlugIn(eTerm.AsyncSDK.Core.eTerm363Session SESSION, eTerm.AsyncSDK.Core.eTerm363Packet InPacket, eTerm.AsyncSDK.Core.eTerm363Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
 {
     string ExpressValue=Regex.Match(Encoding.GetEncoding("gb2312").GetString(SESSION.UnInPakcet(InPacket)).Trim(), @"^!comm\s+([\d|\*|\.|\/|\-|\+]+)").Groups[1].Value;
     try {
         SESSION.SendPacket(__eTerm443Packet.BuildSessionPacket(SESSION.SID, SESSION.RID,Expressions.Calculate( ExpressValue).ToString()));
     }
     catch (Exception ex) {
         SESSION.SendPacket(__eTerm443Packet.BuildSessionPacket(SESSION.SID, SESSION.RID, ex.Message));
     }
 }
예제 #3
0
 /// <summary>
 /// 开始线程.
 /// </summary>
 /// <param name="SESSION">会话端.</param>
 /// <param name="InPacket">入口数据包.</param>
 /// <param name="OutPacket">出口数据包.</param>
 /// <param name="Key">The key.</param>
 protected override void ExecutePlugIn(eTerm.AsyncSDK.Net.eTerm443Async SESSION, eTerm.AsyncSDK.Net.eTerm443Packet InPacket, eTerm.AsyncSDK.Net.eTerm443Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
 {
     ContextInstance.Instance.providerName = Key.providerName;
     ContextInstance.Instance.connectionString = Key.connectionString;
     string ClientSession=SESSION.TSession.userName;
     string eTermSession=SESSION.userName;
     new Async_Log() {
         ASynCommand = Encoding.GetEncoding("gb2312").GetString(SESSION.UnInPakcet(OutPacket)),
         ASyncResult = Encoding.GetEncoding("gb2312").GetString(SESSION.UnOutPakcet(InPacket)),
          ClientSession=ClientSession,
         eTermSession = eTermSession,
            LogDate=DateTime.Now
     }.Add();
 }