Beispiel #1
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 = "";
            }
        }
Beispiel #2
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
            {
            }
        }