コード例 #1
0
        public string fdi2fdxx(string fd)
        {
            try
            {
                string ret = "";
                fd = fd.Trim();
                if (EagleAPI.substring(fd, 0, 2).ToLower() == "fd")
                {
                    string fd_sub = fd.Substring(2).Trim();
                    if (fd_sub[0] < '1' || fd_sub[0] > '8')
                    {
                        return(fd);
                    }
                    int      fd_i = int.Parse(fd_sub[0].ToString()) - 1;
                    AVResult ar   = new AVResult();
                    ar.avResult = avstring;

                    ar.SetVar();

                    ret = "fd" + ar.avFromTo + "/" + ar.avDate + "/" + ar.si[fd_i].fi[0].FI_FlightNo.Substring(0, 2);
                    return(ret);
                }
            }
            catch
            {
            }
            return(fd);
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        /// <summary>
        /// sd转换为ss指令
        /// </summary>
        /// <param name="sd"></param>
        /// <returns></returns>
        public string sd2ss(string sd)
        {
            try
            {
                if (!GlobalVar.b_sd2ss)
                {
                    return(sd);
                }
                string ret = "";
                sd = sd.Trim();
                if (EagleAPI.substring(sd, 0, 2).ToLower() == "sd")
                {
                    string sd_sub = sd.Substring(2).Trim();
                    int    sd_i   = int.Parse(sd_sub[0].ToString()) - 1;
                    if (sd_i < 0 || sd_i > 7)
                    {
                        return(sd);
                    }
                    AVResult ar = new AVResult();
                    ar.avResult = avstring;
                    EagleString.AvResult avres = new EagleString.AvResult(avstring);
                    ar.SetVar();
                    string state = sd_sub.Substring(2).Trim();
                    if (state[0] != '/')
                    {
                        state = "/LL" + state;
                    }
                    for (int i = 0; i < ar.si[sd_i].fi.Length; i++)
                    {
                        if (i == 0)
                        {
                            string stemp = ar.si[sd_i].fi[i].FI_Path;
                            if (stemp == "")
                            {
                                stemp = avres.CityPair;
                            }
                            ret += "\xdss:" + ar.si[sd_i].fi[i].FI_FlightNo + "/" + sd_sub[1].ToString() + "/" + ar.avDate.Substring(0, 5) + "/" + stemp + state;
                        }
                        if (i == 1)
                        {
                            string citystart = ar.si[sd_i].fi[0].FI_Path.Substring(3);
                            string city2end  = ar.si[sd_i].fi[1].FI_Path.Trim();
                            citystart += city2end.Substring(city2end.Length - 3);
                            string strNewAvDate = "";
                            string temp         = "";
                            if (ar.si[sd_i].fi[i].FI_TakeOff.Length >= 6)
                            {
                                temp = ar.si[sd_i].fi[i].FI_TakeOff.Substring(4, 2);
                            }
                            if (temp.IndexOf("+") != -1)
                            {
                                strNewAvDate = (Convert.ToInt32(ar.avDate.Substring(0, 2))
                                                + Convert.ToInt32(temp.Substring(1, 1))) + ar.avDate.Substring(2, 3);
                            }
                            if (strNewAvDate == "")
                            {
                                strNewAvDate = ar.avDate.Substring(0, 5);                    //add by wfb : 2009-2-18
                            }
                            //Eric 原 ret += "\xdss:" + ar.si[sd_i].fi[i].FI_FlightNo + "/" + sd_sub[1].ToString() + "/" + ar.avDate.Substring(0, 5) + "/" + citystart + state;
                            ret += "\xdss:" + ar.si[sd_i].fi[i].FI_FlightNo + "/" + sd_sub[1].ToString() + "/" + strNewAvDate + "/" + citystart + state;
                        }
                    }
                    ret = ret.Substring(1);
                    while (ret.IndexOf("*") > -1)
                    {
                        //MessageBox.Show("共享航班不能订座!");

                        ret = ret.Remove(ret.IndexOf("*"), 1);
                    }
                    return(ret);
                }
            }
            catch (Exception ea)
            {
                if (connect_4_Command.SendString.Substring(15, 2).IndexOf("/") == -1)
                {
                    EagleString.EagleFileIO.LogWrite("SD2SS FAILED!" + sd);
                }
            }

            return(sd);
        }