Beispiel #1
0
        /// <summary>
        /// 主方法:解析AVH指令(即:【AVH/{出发城市三字码}{到达城市三字码}/{起飞日期}/{航司}】指令)返回结果
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>解析结果</returns>
        public override CommandResult <JetermEntity.Response.AVH> BusinessDispose(JetermEntity.Request.AVH request)
        {
            JetermEntity.Parser.AVH avh = new JetermEntity.Parser.AVH(this.config, this.OfficeNo);

            this.Cmd = avh.ParseCmd(request);
            if (string.IsNullOrEmpty(this.Cmd))
            {
                return(avh.Response);
            }

            string dtStr = ParserHelper.ConvertDateTimeToString(request.DepDate);

            ExcuteCmd(dtStr);

            return(avh.ParseCmdResult(this.CmdResult));
        }
Beispiel #2
0
        /// <summary>
        /// 获得AVH指令返回结果
        /// </summary>
        /// <param name="request">请求对象</param>
        /// <returns>若请求参数验证通过,则返回AVH指令(即:【AVH/{出发城市三字码}{到达城市三字码}/{起飞日期}/{航司}】指令);否则返回为空。</returns>
        public override string ParseCmd(JetermEntity.Request.AVH request)
        {
            if (string.IsNullOrWhiteSpace(request.Airline) && !string.IsNullOrWhiteSpace(request.FlightNo) && request.FlightNo.Length > 2)
            {
                request.Airline = request.FlightNo.ToUpper().Trim().Substring(0, 2);
            }
            _request = request;
            if (!ValidRequest())
            {
                return(string.Empty);
            }

            string dtStr = ParserHelper.ConvertDateTimeToString(request.DepDate);

            return(string.Format("AVH/{0}{1}/{2}{3}/D", request.SCity, request.ECity, dtStr.Substring(0, 5), (string.IsNullOrWhiteSpace(request.Airline) ? string.Empty : string.Format("/{0}", request.Airline))));
        }