Ejemplo n.º 1
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);
        }