Exemplo n.º 1
0
        /// <summary>
        /// 根据rt提PNR产生
        /// </summary>
        /// <param name="rTResult"></param>
        public void SetVarsByRt(string rtResult)
        {
            if (!EagleAPI.GetNoPnr(rtResult, false))
            {
                return;
            }



            psgname = "";
            List <string> names = new List <string>();

            names = EagleAPI.GetNames(rtResult);
            for (int i = 0; i < names.Count; i++)
            {
                psgname += names[i] + ",";
            }
            if (psgname.Length > 0)
            {
                psgname = psgname.Substring(0, psgname.Length - 1);
            }

            peaplecount = (names.Count >= EagleAPI.GetPeopleNumber(rtResult) ? names.Count : EagleAPI.GetPeopleNumber(rtResult));
            if (peaplecount <= 0)
            {
                peaplecount = 1;
            }

            sail = EagleAPI.GetFromTo(rtResult);

            pnr = EagleAPI.etstatic.Pnr;

            citypair1 = EagleAPI.GetStartCity(rtResult) + EagleAPI.GetEndCity(rtResult);
            citypair2 = (EagleAPI.GetEndCity2(rtResult) == "" ? "" : EagleAPI.GetEndCity(rtResult) + EagleAPI.GetEndCity2(rtResult));

            string tempdate = EagleAPI.GetDateStart(rtResult).Trim();

            if (tempdate != "")
            {
                if (tempdate[0] == '0')
                {
                    tempdate = tempdate.Substring(1);
                }
                string tempday   = tempdate.Substring(0, tempdate.Length - 3);
                string tempmonth = EagleAPI.GetMonthInt(mystring.right(tempdate, 3));
                string tempyear  = System.DateTime.Now.Year.ToString();
                if ((int.Parse(tempmonth) - System.DateTime.Now.Month) > 6)
                {
                    tempyear = System.DateTime.Now.AddYears(-1).Year.ToString();
                }
                date1 = tempyear + "-" + tempmonth + "-" + tempday;
            }
            else
            {
                date1 = "";
            }
            try
            {
                hour1   = EagleAPI.GetTimeStart(rtResult).Substring(0, 2);
                minute1 = EagleAPI.GetTimeStart(rtResult).Substring(2, 2);
            }
            catch
            {
                hour1   = "";
                minute1 = "";
            }

            tempdate = EagleAPI.GetDateStart2(rtResult).Trim();
            if (tempdate != "")
            {
                if (tempdate[0] == '0')
                {
                    tempdate = tempdate.Substring(1);
                }
                string tempday   = tempdate.Substring(0, tempdate.Length - 3);
                string tempmonth = EagleAPI.GetMonthInt(mystring.right(tempdate, 3));
                string tempyear  = System.DateTime.Now.Year.ToString();
                if ((int.Parse(tempmonth) - System.DateTime.Now.Month) > 6)
                {
                    tempyear = System.DateTime.Now.AddYears(-1).Year.ToString();
                }
                date2 = tempyear + "-" + tempmonth + "-" + tempday;
            }
            else
            {
                date2 = "";
            }
            try
            {
                hour2   = EagleAPI.GetTimeStart2(rtResult).Substring(0, 2);
                minute2 = EagleAPI.GetTimeStart2(rtResult).Substring(2, 2);
            }
            catch
            {
                hour2   = "";
                minute2 = "";
            }

            carrier1  = EagleAPI.GetCarrier(rtResult);
            carrier2  = EagleAPI.GetCarrier2(rtResult);
            flightno1 = EagleAPI.GetFlight(rtResult);
            flightno2 = EagleAPI.GetFlight2(rtResult);
            bunk1     = EagleAPI.GetClass(rtResult);
            bunk2     = EagleAPI.GetClass2(rtResult);

            float fare1 = 0F;
            float fare2 = 0F;

            switch (bunk1)
            {
            case "F":
                fare1 = 1600F;
                break;

            case "C":
                fare1 = 1400F;
                break;

            case "Y":
                fare1 = 1100F;
                break;

            default:
                fare1 = 600F;
                break;
            }
            switch (bunk2)
            {
            case "F":
                fare2 = 1600F;
                break;

            case "C":
                fare2 = 1400F;
                break;

            case "Y":
                fare2 = 1100F;
                break;

            case "":
                break;

            default:
                fare2 = 600F;
                break;
            }
            GlobalVar.f_limitMoneyPerTicket = fare1 + fare2;
        }
Exemplo n.º 2
0
        public bool set(string p, string s)
        {
            try
            {
                isEticket = (s.IndexOf("**ELECTRONIC TICKET PNR**") >= 0);
                pnr       = p;
                string[] tArray = EagleAPI.GetETNumber(s);
                if (tArray.Length < 1)
                {
                    throw new Exception("未取到票号!");
                }
                etnumbers = "";
                foreach (string t in tArray)
                {
                    etnumbers += t + ";";
                }
                while (etnumbers.IndexOf(";;") >= 0)
                {
                    etnumbers = etnumbers.Replace(";;", ";");
                }
                etnumbers = mystring.trim(etnumbers, ';');
                List <string> names   = EagleAPI.GetNames(s);
                string[]      cardids = EagleAPI.GetIDCardNo(s);
                passengers = "";
                for (int i = 0; i < names.Count; i++)
                {
                    passengers += ";" + names[i] + "-" + cardids[i];
                }
                passengers = mystring.trim(passengers, ';');

                //float count = (float)etnumbers.Split(':').Length;
                float count = 1F;
                try
                {
                    totalfc = string.Format("{0}", float.Parse(EagleAPI.GetTatol(s).Substring(3)) * count);
                }
                catch
                { totalfc = "0"; }
                try
                {
                    tf = string.Format("{0}", float.Parse(EagleAPI.GetTaxFuel(s).Substring(3)) * count);
                }
                catch { tf = "0"; }
                try
                {
                    tb = string.Format("{0}", float.Parse(EagleAPI.GetTaxBuild(s).Substring(EagleAPI.GetTaxBuild(s)[3] > '9' ? 0 : 3)) * count);
                }
                catch
                { tb = "0"; }


                fn1   = EagleAPI.GetCarrier(s) + EagleAPI.GetFlight(s);
                fn2   = EagleAPI.GetCarrier2(s) + EagleAPI.GetFlight2(s);
                bunk1 = EagleAPI.GetClass(s);
                bunk2 = EagleAPI.GetClass2(s);
                date1 = EagleAPI.GetDateStart(s);
                date2 = EagleAPI.GetDateStart2(s);
                cp1   = EagleAPI.GetStartCity(s) + EagleAPI.GetEndCity(s);
                cp2   = EagleAPI.GetEndCity(s) + EagleAPI.GetEndCity2(s);
                if (cp2.Length < 6 || cp2 == cp1)
                {
                    cp2 = "";
                }
            }
            catch (Exception ex)
            {
                EagleAPI.LogWrite(ex.Message);
                return(false);
            }
            return(true);
        }