Ejemplo n.º 1
0
 public dlgPolicySelect(ePlus.Data.PolicySelect ps)
 {
     InitializeComponent();
     fillDg乘客信息(ps.dt乘客信息);
     fillDg航班信息(ps.dt航班信息);
     this.Text = "政策选择";
 }
Ejemplo n.º 2
0
        public void steps(string pnr)
        {
            //1.置對話框值
            step1(textBox1.Text.Trim());//包含了step2
            string[] result         = new string[planeStyleList.Count];
            string[] fareAndistance = new string[planeStyleList.Count];
            string[] rebate         = new string[planeStyleList.Count];

            if (txtName.Text.Trim() == "")
            {
                MessageBox.Show
                    ("PNR不存在!或者服务器不可用,可能需要紧急提交", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //2.取票面價 more than 4 destinations,modified by chenqj
            for (int i = 0; i < planeStyleList.Count; i++)
            {
                int index = i * 4 + 3;

                if (GetTextBox(index + 3).Text.Trim().Length == 6)
                {
                    fareAndistance[i] = step3(GetTextBox(index + 3).Text.Trim());
                    rebate[i]         = step4(GetTextBox(index).Text, GetTextBox(index + 1).Text);
                    double f = double.Parse(fareAndistance[i].Split('~')[0].Trim());
                    double r = double.Parse(rebate[i]);
                    if (ChildCount > 0)
                    {
                        r = 50;                                      //儿童
                    }
                    int fr = (int)((f * r) / 100.0 + 5.0) / 10 * 10; //票价
                    result[i]  = fr.ToString() + "~";                // fareAndistance[0].Split('~')[0].Trim() + "~";
                    nkg航班信息[i] = nkg航班信息[i].Replace("#票价#", fr.ToString());
                }
                else
                {
                    result[i] = "0~";
                }
            }

            for (int i = 0; i < nkg航班信息.Length; i++)
            {
                nkg航班信息[i] = nkg航班信息[i].Replace("#票价#", "0");                                     //如果票价没替换,则以0替换
            }
            int[] tax = new int[nkg航班信息.Length];
            //3.取機建
            //for (int i = 0; i < planeStyle.Length; i++)
            for (int i = 0; i < planeStyleList.Count; i++)
            {
                try
                {
                    //string taxbuild = step5(planeStyle[i]).Trim();
                    string taxbuild = step5(planeStyleList[i]).Trim();
                    result[i] += taxbuild + "~";
                    tax[i]     = int.Parse(taxbuild);//可能不足四个航段,被CATCH掉
                }
                catch
                {
                }
            }
            //4.取燃油
            //for (int i = 0; i < planeStyle.Length; i++)
            for (int i = 0; i < planeStyleList.Count; i++)
            {
                string tmpTaxOil = "";
                try
                {
                    tmpTaxOil = step6(fareAndistance[i].Split('~')[1]).Trim();
                }
                catch
                {
                    tmpTaxOil = "0";
                }

                //**************************2008-7-16置gbYzpOrder中的航班信息变量**********************************开始
                if (i < GlobalVar2.gbYzpOrder.rFLIGHTINFO.Length)
                {
                    GlobalVar2.gbYzpOrder.rFLIGHTINFO[i].rTAXOIL   = tmpTaxOil;
                    GlobalVar2.gbYzpOrder.rFLIGHTINFO[i].rDisCount = rebate[i];
                }
                //**************************2008-7-16置gbYzpOrder中的航班信息变量**********************************结束
                result[i] += tmpTaxOil + "~";

                try
                {
                    tax[i]    += int.Parse(tmpTaxOil);
                    nkg航班信息[i] = nkg航班信息[i].Replace("#机建燃油#", tax[i].ToString());//可能不足四个航段被捕捉掉
                }
                catch
                {
                }
            }
            //////////////////////////////////////////////////////////NKG航班信息已经完整
            //5.取返点 more than 4 destinations,modified by chenqj
            for (int i = 0; i < planeStyleList.Count; i++)
            {
                int    index     = i * 4 + 3;
                string strFlight = this.GetTextBox(index).Text;
                string strClass  = this.GetTextBox(index + 1).Text;
                string strDate   = this.GetTextBox(index + 2).Text;
                string strCity   = this.GetTextBox(index + 3).Text;

                try
                {
                    result[i] += step7(strFlight, strClass, strDate.Substring(0, strDate.IndexOf(' ')), strCity);
                }
                catch
                {
                    result[i] += "0";
                }
            }

            //6.计算数据
            string[] args = step8(result, txtName.Text.Split(';').Length);

            //6.5 NKG创建订单
            if (GlobalVar.gbIsNkgFunctions)
            {
                ePlus.Data.PolicySelect ps = new ePlus.Data.PolicySelect();
                ps.FillTables(nkg航班信息, nkg乘客信息, nkg政策选择);
                ePlus.Data.dlgPolicySelect dlgPS = new ePlus.Data.dlgPolicySelect(ps);
                dlgPS.ShowDialog();
            }
            //7.提交
            step9(args, this.tbPhone.Text);
        }