Beispiel #1
0
        /// <summary>
        /// 取航段信息
        /// </summary>
        /// <param name="pnr"></param>
        public void step1(string pnr)
        {
            this.Text = "正在清理控件……";
            Application.DoEvents();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
            textBox7.Clear();
            textBox8.Clear();
            textBox9.Clear();
            textBox10.Clear();
            textBox11.Clear();
            textBox12.Clear();
            textBox13.Clear();
            textBox14.Clear();
            textBox15.Clear();
            textBox16.Clear();
            textBox17.Clear();
            textBox18.Clear();
            //for (int i = 0; i < 4; i++) planeStyle[i] = "";
            planeStyleList.Clear();
            txtName.Text = "";
#if REALIBE
            string dsgxml = step2(pnr);
            Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface();
            string xml = ib.rt2(pnr, GlobalVar.serverAddr == GlobalVar.ServerAddr.HangYiWang);
#else
            logic.IBEAgent ibeagent = new logic.IBEAgent();
            ibeagent.IpID = GlobalVar.CurIPUsing;
            string xml = ibeagent.wsRT2(pnr.ToUpper());
#endif
            if (string.IsNullOrEmpty(xml) || xml.Contains("<ibe>err</ibe>"))
            {
                EagleWebService.IbeStuff.RefreshIbeUrl();
                MessageBox.Show("查询PNR失败!返回信息如下:\n" + xml);
                return;
            }
            this.Text = "正在获取PNR信息……";
            Application.DoEvents();
            Options.ibe.IbeRt ir = new Options.ibe.IbeRt(xml);
            ChildCount = 0;
            nkg乘客信息    = new string[ir.getpeopleinfo(0).Length];
            for (int i = 0; i < ir.getpeopleinfo(0).Length; i++)
            {
                //if (ir.getpeopleinfo(1)[i] == "") throw new Exception("ErrorCardId"); //commentted by chenqj
                txtName.Text += ir.getpeopleinfo(0)[i] + "-" + ir.getpeopleinfo(1)[i] + (i == ir.getpeopleinfo(0).Length - 1 ? "" : ";");
                if (ir.getpeopleinfo(0)[i].IndexOf("(CHD)") > 0)
                {
                    ChildCount++;
                }
                nkg乘客信息[i] = ir.getpeopleinfo(0)[i] + "-" + ir.getpeopleinfo(1)[i] + "-"
                             + (ir.getpeopleinfo(0)[i].IndexOf("(CHD)") > 0 ? "儿童" : "成人");
            }
            string[] fi = ir.getflightsegsinfo();
            nkg航班信息 = new string[fi.Length];
            for (int i = 0; i < fi.Length; i++)
            {
                string[] segment = fi[i].Split('~');

                //more than 4 destinations,modified by chenqj
                {
                    int index = i * 4 + 3;
                    groupBox1.Controls["textBox" + index.ToString()].Text     = segment[0]; //航班號
                    groupBox1.Controls["textBox" + (++index).ToString()].Text = segment[1]; //艙位
                    System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat;
                    DateTime dt;
                    try
                    {
                        dt = DateTime.ParseExact(segment[3].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI);
                    }
                    catch
                    {
                        dt = DateTime.Parse(segment[3]);
                    }

                    groupBox1.Controls["textBox" + (++index).ToString()].Text = dt.ToString("yyyy-MM-dd HHmm", myDTFI).ToUpper(); //時間
                    groupBox1.Controls["textBox" + (++index).ToString()].Text = segment[2];                                       //日期
#if REALIBE
                    planeStyleList.Add(getPlaneByFlightno(dsgxml, segment[0]));
#else
                    planeStyleList.Add(segment[6]);
#endif
                }
                Application.DoEvents();
                {
                    //到达时间segmeng[4];
                    System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat;
                    DateTime leavetime;
                    try
                    {
                        leavetime = DateTime.ParseExact(segment[4].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI);
                    }
                    catch
                    {
                        leavetime = DateTime.Parse(segment[4]);
                    }
                    string lt = leavetime.ToString("yyyy-MM-dd HHmm", myDTFI).ToUpper();

                    DateTime arrivetime;
                    try
                    {
                        arrivetime = DateTime.ParseExact(segment[5].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI);
                    }
                    catch
                    {
                        arrivetime = DateTime.Parse(segment[5]);
                    }
                    string at = arrivetime.ToString("yyyy-MM-dd HHmm", myDTFI).ToUpper();
                    nkg航班信息[i]  = lt.Split(' ')[0] + ",";
                    nkg航班信息[i] += lt.Split(' ')[1].Insert(2, ":") + "(" + segment[2].Substring(0, 3) + ")" + ",";
                    nkg航班信息[i] += at.Split(' ')[1].Insert(2, ":") + "(" + segment[2].Substring(3, 3) + ")" + ",";
                    nkg航班信息[i] += pnr + ",";
                    nkg航班信息[i] += "HK" + ",";//订座状态
                    nkg航班信息[i] += EagleAPI.GetAirLineName(segment[0].Substring(0, 2)) + ",";
                    nkg航班信息[i] += segment[0] + ",";
                    nkg航班信息[i] += segment[1] + ",";
                    nkg航班信息[i] += "#票价#" + ",";
                    //nkg航班信息[i] += planeStyle[i] + ",";
                    nkg航班信息[i] += planeStyleList[i] + ",";
                    nkg航班信息[i] += "#机建燃油#";
                }
            }
            //**************************2008-7-16置gbYzpOrder中的航班信息变量**********************************开始
            if (GlobalVar2.gbYzpOrder == null)
            {
                GlobalVar2.gbYzpOrder = new YzpBtoC.YZPnewOrder();
            }
            GlobalVar2.gbYzpOrder.rFLIGHTINFO = new YzpBtoC.YZPflightINFO[fi.Length];
            GlobalVar2.gbYzpOrder.rPASSINFO   = new YzpBtoC.YZPpassINFO[ir.getpeopleinfo(0).Length];
            for (int count = 0; count < fi.Length; count++)
            {
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count] = new YzpBtoC.YZPflightINFO();
                string[] segment = fi[count].Split('~');
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rFLIGHTNO   = segment[0];
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rFLIGHTDATE = getflightdate(segment[3]);
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rCITYLEAVE  = segment[2].Substring(0, 3);
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rCITYARRIVE = segment[2].Substring(3);
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rBUNK       = segment[1];
#if REALIBE
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rPLANETYPE  = planeStyleList[count];        //planeStyle[count];
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTAXBUILD   = step5(planeStyleList[count]); //step5(planeStyle[count]);
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMELEAVE  = getNormalDateStringFromIBEDate(segment[4]).Split(' ')[1];
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMEARRIVE = getNormalDateStringFromIBEDate(segment[5]).Split(' ')[1];
#else
                //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rPLANETYPE = segment[6];

                //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTAXOIL = segment[8];
                //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTAXBUILD = EagleString.EagleFileIO.TaxOfBuildBy(segment[6]).ToString();

                //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMELEAVE = DateTime.Parse(segment[4]).ToString("HHmm");

                //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMEARRIVE = DateTime.Parse(segment[5]).ToString("HHmm");
#endif
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rSTOPSTATION  = "略";
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rAIRLINEID    = "1";
                GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rAIRLINEINDEX = count.ToString();
            }
            //**************************2008-7-16置gbYzpOrder中的航班信息变量**********************************结束
        }