Ejemplo n.º 1
0
        static private void setcontrol(object sender, EventArgs e)
        {
            retstring = retstring.Replace('+', ' ');
            retstring = retstring.Replace('-', ' ');
            if (!EagleAPI.GetNoPnr(retstring))
            {
                return;
            }
            context.cbName.Items.Clear();
            List <string> names = new List <string>();

            names = EagleAPI.GetNames(retstring);
            for (int i = 0; i < names.Count; i++)
            {
                context.cbName.Items.Add(names[i]);
            }
            context.cbName.Text   = context.cbName.Items[0].ToString();
            context.tbCardID.Text = EagleAPI.GetIDCardNo(retstring)[0];
            string date = EagleAPI.GetDateStart(retstring);
            int    imm  = int.Parse(EagleAPI.GetMonthInt(date.Substring(date.Length - 3)));
            int    idd  = int.Parse(date.Substring(date.Length - 5).Substring(0, 2));
            int    iyy  = System.DateTime.Now.Year;

            //System.DateTime dt = new DateTime(iyy, imm, idd, 23, 59, 59);
            System.DateTime dt = new DateTime(iyy, imm, idd, 23, 59, 59);
            while (dt < System.DateTime.Now)
            {
                dt = dt.AddYears(1);
            }
            context.dtpBegin.Value = dt;
        }
Ejemplo n.º 2
0
        static private void setcontrol(object sender, EventArgs e)
        {
            retstring = retstring.Replace('+', ' ');
            retstring = retstring.Replace('-', ' ');
            if (!EagleAPI.GetNoPnr(retstring))
            {
                return;
            }
            context.cbName.Items.Clear();
            List <string> names = new List <string>();

            names = EagleAPI.GetNames(retstring);
            for (int i = 0; i < names.Count; i++)
            {
                context.cbName.Items.Add(names[i]);
            }
            context.cbName.Text   = context.cbName.Items[0].ToString();
            context.tbCardID.Text = EagleAPI.GetIDCardNo(retstring)[0];
            string date = EagleAPI.GetDateStart(retstring);

            try
            {
                int             imm = int.Parse(EagleAPI.GetMonthInt(date.Substring(date.Length - 3)));
                int             idd = int.Parse(date.Substring(date.Length - 5).Substring(0, 2));
                int             iyy = System.DateTime.Now.Year;
                System.DateTime dt  = new DateTime(iyy, imm, idd, 23, 59, 59);
                while (dt < System.DateTime.Now)
                {
                    dt = dt.AddYears(1);
                }
                //context.dtp_Start.Value = dt;

                context.tbFlightNo.Text = EagleAPI.GetFlightNo(retstring) + EagleAPI.GetFlightNo2(retstring);
                context.tbDate.Text     = dt.ToShortDateString();
            }
            catch
            {
                MessageBox.Show("注意:由于PNR信息异常,取时间出错,请手工输入!");
            }
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据detr提取票号产生
        /// </summary>
        /// <param name="detrResult"></param>
        public void SetVarsByDetr(string detrResult)
        {
            peaplecount = 1;

            ePlus.eTicket.etInfomation ei = new ePlus.eTicket.etInfomation();
            ei.SetVar(detrResult);
            psgname = ei.PASSENGER;
            sail    = ei.ORGDST;
            pnr     = ei.SmallCode;

            string tempdate = EagleAPI.substring(ei.FROM, 18, 5);

            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.substring(ei.FROM, 24, 4).Substring(0, 2);
                minute1 = EagleAPI.substring(ei.FROM, 24, 4).Substring(2, 2);
            }
            catch
            {
                hour1   = "";
                minute1 = "";
            }

            tempdate = EagleAPI.substring(ei.TO1, 18, 5);
            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.substring(ei.TO1, 24, 4).Substring(0, 2);
                minute2 = EagleAPI.substring(ei.TO1, 24, 4).Substring(2, 2);
            }
            catch
            {
                hour2   = "";
                minute2 = "";
            }
        }
Ejemplo n.º 5
0
        static private void setcontrol(object sender, EventArgs e)
        {
            if (GlobalVar.formSendCmdType == GlobalVar.FormSendCommandType.detrF)
            {
                try
                {
                    context.tbCardID.Text = EagleAPI.GetCardIdByDetr_F(retstringDetrF);
                    return;
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                    return;
                }
            }
            context.cbName.Items.Clear();
            try
            {
                if (context.radioButton1.Checked || context.radioButton2.Checked)
                {
                    retstring = retstring.Replace('+', ' ');
                    retstring = retstring.Replace('-', ' ');
                    if (!EagleAPI.GetNoPnr(retstring))
                    {
                        return;
                    }

                    List <string> names = new List <string>();
                    names = EagleAPI.GetNames(retstring);
                    for (int i = 0; i < names.Count; i++)
                    {
                        context.cbName.Items.Add(names[i]);
                    }
                    context.cbName.Text   = context.cbName.Items[0].ToString();
                    context.tbCardID.Text = EagleAPI.GetIDCardNo(retstring)[0];
                    string          date = EagleAPI.GetDateStart(retstring);
                    int             imm  = int.Parse(EagleAPI.GetMonthInt(date.Substring(date.Length - 3)));
                    int             idd  = int.Parse(date.Substring(date.Length - 5).Substring(0, 2));
                    int             iyy  = System.DateTime.Now.Year;
                    System.DateTime dt   = new DateTime(iyy, imm, idd, 23, 59, 59);
                    while (dt < System.DateTime.Now)
                    {
                        dt = dt.AddYears(1);
                    }
                    //context.dtp_Start.Value = dt;

                    context.tbFlightNo.Text = EagleAPI.GetFlightNo(retstring) + EagleAPI.GetFlightNo2(retstring);
                    context.tbDate.Text     = dt.ToShortDateString();
                }
                if (context.radioButton3.Checked)
                {
                    ePlus.eTicket.etInfomation ei = new ePlus.eTicket.etInfomation();
                    ei.SetVar(retstring);
                    context.cbName.Items.Add(ei.PASSENGER);
                    context.cbName.Text     = ei.PASSENGER;
                    context.tbCardID.Text   = "";
                    context.tbFlightNo.Text = EagleAPI.substring(ei.FROM, 4, 2) + EagleAPI.substring(ei.FROM, 10, 4);
                    string          date = EagleAPI.substring(ei.FROM, 18, 5);
                    int             imm  = int.Parse(EagleAPI.GetMonthInt(date.Substring(date.Length - 3)));
                    int             idd  = int.Parse(date.Substring(date.Length - 5).Substring(0, 2));
                    int             iyy  = System.DateTime.Now.Year;
                    System.DateTime dt   = new DateTime(iyy, imm, idd, 23, 59, 59);
                    while (dt < System.DateTime.Now)
                    {
                        dt = dt.AddYears(1);
                    }
                    context.tbDate.Text = dt.ToShortDateString();
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 6
0
        public void SetAllPolicy(System.Windows.Forms.ListView lv, string date)
        {
            try
            {
                if (!Model.md.b_026)
                {
                    return;
                }
                int iCount = lv.Items.Count;
                System.Windows.Forms.ListViewItem[] items = new System.Windows.Forms.ListViewItem[iCount];
                string flightnos = "";
                for (int i = 0; i < iCount; i++)
                {
                    string fn = lv.Items[i].SubItems[1].Text;
                    if (fn.Substring(0, 1) == "*")
                    {
                        fn = fn.Substring(1);
                    }
                    flightnos += fn + (i == iCount - 1 ? "" : ",");
                }

                string   cp = lv.Items[0].SubItems[3].Text;
                AVResult ar = new AVResult();
                ar.avResult = connect_4_Command.AV_String;
                ar.SetVar();
                //ar.SetToListview(lv,DateTime.Parse(date));
                Application.DoEvents();
                string day   = ar.avDate.Substring(0, 2);
                string mon   = ar.avDate.Substring(2, 3);
                int    iDay  = int.Parse(day);
                int    iMon  = int.Parse(EagleAPI.GetMonthInt(mon));
                int    iYear = DateTime.Now.Year;
                if (iMon < DateTime.Now.Month)
                {
                    iYear++;
                }

                string dd = iYear.ToString() + "-" + iMon.ToString() + "-" + iDay.ToString();
                ListPolicy.avDate = dd;
                EagleString.AvResult ar_new = new EagleString.AvResult(ar.avResult, 0, 0);
                ListPolicy.avDate      = ar_new.FlightDate_DT.ToShortDateString();
                GlobalVar2.xmlPolicies = WebService.wsGetPolicies(flightnos, dd, cp.Substring(0, 3), cp.Substring(cp.Length - 3));
                Hashtable ht = GetHashTableFromXmlString(GlobalVar2.xmlPolicies);
                for (int i = 0; i < iCount; i++)
                {
                    items[i]      = new System.Windows.Forms.ListViewItem();
                    items[i].Text = "";
                    items[i].SubItems.Add("返点");
                    items[i].SubItems.Add("");
                    items[i].SubItems.Add("政策");
                    items[i].SubItems.Add("");
                    items[i].SubItems.Add("");
                    items[i].SubItems.Add("");

                    int countLie = lv.Items[i].SubItems.Count;
                    for (int j = 7; j < countLie; j++)//23为3折舱,35为所有舱
                    {
                        Application.DoEvents();
                        try
                        {
                            if (lv.Items[i].SubItems[j].Text.Trim().Length != 2)
                            {
                                items[i].SubItems.Add("");
                            }
                            else
                            {
                                string p = GetOnePolicy(lv.Items[i].SubItems[3].Text,
                                                        date,
                                                        lv.Items[i].SubItems[1].Text,
                                                        lv.Items[i].SubItems[j].Text[0].ToString(),
                                                        ht
                                                        );
                                items[i].SubItems.Add(p);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                for (int i = 0; i < iCount; i++)
                {
                    lv.Items.Insert(2 * i + 1, items[i]);
                }
                bool b = false;
                for (int i = 0; i < lv.Items.Count; i += 2)
                {
                    try
                    {
                        b = !b;
                        if (b)
                        {
                            lv.Items[i].BackColor = lv.Items[i + 1].BackColor = lv.Items[i].BackColor = System.Drawing.Color.Gainsboro;
                        }
                        else
                        {
                            lv.Items[i].BackColor = lv.Items[i + 1].BackColor = lv.Items[i].BackColor = System.Drawing.Color.White;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                EagleAPI.LogWrite("SetAllPolicy:" + ex.Message);
            }
        }