/// <summary>
        /// 分析新的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Button1_Click(object sender, EventArgs e)
        {
            //查询结果
            Line             newLine = null;
            List <TrainLine> line1   = null;
            List <TrainLine> line2   = null;
            List <TrainLine> line3   = null;
            List <TrainLine> line4   = null;

            String A0 = this.AStation.Text.Trim();
            String B0 = this.BStation.Text.Trim();

            if (String.IsNullOrEmpty(A0) == false &&
                String.IsNullOrEmpty(B0) == false)
            {
                bool flag = true;
                if (Line.isExistsStation(A0) == false)
                {
                    WebFrame.Util.JAjax.Alert("错误:起始站【" + A0 + "】不存在!");
                    flag = false;
                }

                if (flag)
                {
                    if (Line.isExistsStation(B0) == false)
                    {
                        WebFrame.Util.JAjax.Alert("错误:终点站【" + B0 + "】不存在!");
                        flag = false;
                    }
                }

                if (flag)
                {
                    //将用户当前的选择条件保存到Cookie
                    DataRow dr1 = JControl.GetControlValues(con1);
                    WebFrame.Util.JCookie.SetCookieValues("userFenXiData", dr1, -1);

                    //寻找四类典型的线路
                    String[] middle     = null;
                    String   middleTemp = String.Empty;
                    if (this.middleStation.Text.Trim() != String.Empty)
                    {
                        middleTemp = this.middleStation.Text.Trim().Replace(",", ",");
                        middle     = middleTemp.Split(',');
                    }
                    int shendu = int.Parse(this.sd.SelectedValue);

                    if (ViewState["A0"] != null)
                    {
                        //1--从视图状态中恢复数据
                        if (ViewState["A0"].ToString() == A0 &&
                            ViewState["B0"].ToString() == B0 &&
                            ViewState["shendu"].ToString() == shendu.ToString() &&
                            ViewState["SelTrainID"].ToString() == this.selTrain.Text)
                        {
                            if (ViewState["middle"].ToString() == middleTemp)
                            {
                                line1 = ViewState["Line1"] as List <TrainLine>;
                                line2 = ViewState["Line2"] as List <TrainLine>;
                                line3 = ViewState["Line3"] as List <TrainLine>;
                                line4 = ViewState["Line4"] as List <TrainLine>;
                            }
                        }
                    }

                    //2--从数据库中恢复数据
                    if (line1 == null && this.CheckBox1.Checked == false)
                    {
                        // SearchObjectBU.RestoreSearchResultFromDb(A0, B0, shendu,String.Empty, out newLine);
                    }

                    //4--执行搜索算法得到数据
                    if ((line1 == null && newLine == null) || this.CheckBox1.Checked)
                    {
                        newLine = new Line(A0, B0, shendu, this.selTrain.Text.Trim(), 300, false);
                    }

                    if ((line1 == null && newLine != null) || this.CheckBox1.Checked)
                    {
                        /*------------此处需要修改----------------*/
                        line1 = newLine.GetLayerLine(middle, ETrainType.动车CRH380A, false, 1, false);
                        line2 = newLine.GetLayerLine(middle, ETrainType.动车CRH2A, false, 1, false);
                        line3 = newLine.GetLayerLine(middle, ETrainType.空调车25T, false, 3, false);
                        line4 = newLine.GetLayerLine(middle, ETrainType.绿皮车25B, true, 3, false);
                    }

                    //将数据保存到视图状态
                    ViewState["A0"]         = A0;
                    ViewState["B0"]         = B0;
                    ViewState["shendu"]     = shendu;
                    ViewState["SelTrainID"] = this.selTrain.Text;
                    ViewState["middle"]     = middleTemp;

                    //ViewState["MyLine"] = newLine;
                    ViewState["Line1"] = line1;    //300公里动车的线路
                    ViewState["Line2"] = line2;    //200公里动车的线路
                    ViewState["Line3"] = line3;    //直达线路
                    ViewState["Line4"] = line4;    //普通车的线路

                    Dictionary <String, String> data1 = CommTrain.GetNewFenXiData(0);
                    this.Repeater2.DataSource = data1;
                    this.Repeater2.DataBind();
                    this.SearchInfo.Visible = true;
                    this.NewBindComplete();

                    //将查询结果保存到数据库中(只保存没有指定线路的站点)
                    if (String.IsNullOrEmpty(this.selTrain.Text.Trim()))
                    {
                        //  bool succ = SearchObjectBU.SaveSearchResultToDb(A0, B0, shendu,newLine, this.CheckBox1.Checked,String.Empty);
                    }
                    this.CheckBox1.Checked = false;
                }
            }
            else
            {
                WebFrame.Util.JAjax.Alert("错误:请输入车次的起点和终点");
            }
        }
        /// <summary>
        /// 原方法
        /// </summary>
        //private void CalShouruAndZhiChu()
        //{
        //    DataTable dt1 = new DataTable();
        //    dt1.Columns.Add("yz", typeof(int));
        //    dt1.Columns.Add("yw", typeof(int));
        //    dt1.Columns.Add("rw", typeof(int));
        //    dt1.Columns.Add("sr", typeof(double));
        //    dt1.Columns.Add("zc", typeof(double));
        //    dt1.Columns.Add("sz",typeof(double));


        //    CommTrain train1 = new CommTrain();
        //    TrainLine lineObj = ViewState["Line"] as TrainLine;
        //    int traintype1 = int.Parse(Request.QueryString["TrainType"]);
        //    train1.TrainType = (ECommTrainType)traintype1;
        //    train1.YunXingLiCheng = lineObj.TotalMiles;
        //    int dianche = int.Parse(Request.QueryString["hasDianChe"]);

        //    bool isYearFlag = true;
        //    if (String.IsNullOrEmpty(Request.QueryString["IsYear"]) == false)
        //    {
        //        if (Request.QueryString["IsYear"] == "0") isYearFlag = false;
        //    }
        //    train1.IsYearFlag = isYearFlag;

        //    for (int i = 1; i <= 5; i++)
        //    {
        //        DataRow dr1 = dt1.NewRow();
        //        TextBox t1 = this.yz1.Parent.FindControl("yz" + i) as TextBox;
        //        TextBox t2 = this.yz1.Parent.FindControl("yw" + i) as TextBox;
        //        TextBox t3 = this.yz1.Parent.FindControl("rw" + i) as TextBox;

        //        //设置车厢的编组
        //        train1.YinZuo = int.Parse(t1.Text);

        //        train1.OpenYinWo = int.Parse(t2.Text);
        //        train1.RuanWo = int.Parse(t3.Text);
        //        train1.CheDiShu = int.Parse(Request.QueryString["cds"]);

        //        //将数据保存到Table
        //        dr1["yz"] = int.Parse(t1.Text);
        //        dr1["yw"] = int.Parse(t2.Text);
        //        dr1["rw"] = int.Parse(t3.Text);

        //        if (dianche > 0)
        //        {
        //            train1.FaDianChe = 1;
        //            train1.GongDianType = EGongDianType.非直供电;
        //        }
        //        train1.Line = lineObj;

        //        //计算费用
        //        Label lab1 = this.yz1.Parent.FindControl("sr" + i) as Label;
        //        double s = train1.GetShouRu() / 10000;
        //        if (isYearFlag)
        //        {
        //            lab1.Text = String.Format("{0:n0}", s);
        //        }
        //        else
        //        {
        //            lab1.Text = String.Format("{0:n2}", s);
        //        }
        //        dr1["sr"] = double.Parse(lab1.Text);

        //        String findcond = "";
        //        List<ZhiChuData> zlist = train1.GetZhiChu(findcond);
        //        double z = 0;
        //        foreach (ZhiChuData data1 in zlist)
        //        {
        //            z = z + data1.ZhiChu;
        //        }
        //        //z = z / 10000;

        //        Label lab2 = this.yw1.Parent.FindControl("zc" + i) as Label;
        //        if (isYearFlag)
        //        {
        //            lab2.Text = String.Format("{0:n0}", z);
        //        }
        //        else
        //        {
        //            lab2.Text = String.Format("{0:n2}", z);
        //        }
        //        dr1["zc"] = double.Parse(lab2.Text);


        //        Label lab3 = this.yw1.Parent.FindControl("sz" + i) as Label;
        //        if (isYearFlag)
        //        {
        //            lab3.Text = String.Format("{0:n0}", s * SRate - z);
        //        }
        //        else
        //        {
        //            lab3.Text = String.Format("{0:n2}", s * SRate - z);
        //        }
        //        if (s - z < 0)
        //        { lab3.ForeColor = System.Drawing.Color.Red; }
        //        else
        //        {
        //            lab3.ForeColor = System.Drawing.Color.Empty;
        //        }
        //        dr1["sz"] = double.Parse(lab3.Text);

        //        dt1.Rows.Add(dr1);
        //    }

        //    ViewState["BianZhuData"] = dt1;
        //}
        /// <summary>
        /// 2014 0417
        /// </summary>
        private void CalShouruAndZhiChu()
        {
            DataTable dt1 = new DataTable();

            dt1.Columns.Add("yz", typeof(int));
            dt1.Columns.Add("yw", typeof(int));
            dt1.Columns.Add("rw", typeof(int));
            dt1.Columns.Add("sr", typeof(double));
            dt1.Columns.Add("zc", typeof(double));
            dt1.Columns.Add("sz", typeof(double));


            CommTrain train1     = new CommTrain();
            TrainLine lineObj    = ViewState["Line"] as TrainLine;
            int       traintype1 = int.Parse(Request.QueryString["TrainType"]);

            train1.TrainType      = (ECommTrainType)traintype1;
            train1.YunXingLiCheng = lineObj.TotalMiles;
            int dianche = int.Parse(Request.QueryString["hasDianChe"]);

            bool isYearFlag = true;

            if (String.IsNullOrEmpty(Request.QueryString["IsYear"]) == false)
            {
                if (Request.QueryString["IsYear"] == "0")
                {
                    isYearFlag = false;
                }
            }
            train1.IsYearFlag = isYearFlag;

            for (int i = 1; i <= 5; i++)
            {
                DataRow dr1 = dt1.NewRow();
                TextBox t1  = this.yz1.Parent.FindControl("yz" + i) as TextBox;
                TextBox t2  = this.yz1.Parent.FindControl("yw" + i) as TextBox;
                TextBox t3  = this.yz1.Parent.FindControl("rw" + i) as TextBox;

                //设置车厢的编组
                train1.YinZuo = int.Parse(t1.Text);

                train1.OpenYinWo = int.Parse(t2.Text);
                train1.RuanWo    = int.Parse(t3.Text);
                train1.CheDiShu  = int.Parse(Request.QueryString["cds"]);

                //将数据保存到Table
                dr1["yz"] = int.Parse(t1.Text);
                dr1["yw"] = int.Parse(t2.Text);
                dr1["rw"] = int.Parse(t3.Text);

                if (dianche > 0)
                {
                    train1.FaDianChe    = 1;
                    train1.GongDianType = EGongDianType.非直供电;
                }
                train1.Line = lineObj;

                //计算费用
                Label  lab1 = this.yz1.Parent.FindControl("sr" + i) as Label;
                double s    = train1.GetShouRu() / 10000;
                if (isYearFlag)
                {
                    lab1.Text = String.Format("{0:n0}", s);
                }
                else
                {
                    lab1.Text = String.Format("{0:n2}", s);
                }
                dr1["sr"] = double.Parse(lab1.Text);

                String            findcond = "";
                List <ZhiChuData> zlist    = train1.GetZhiChu(findcond);
                double            z        = 0;
                foreach (ZhiChuData data1 in zlist)
                {
                    z = z + data1.ZhiChu;
                }
                //z = z / 10000;

                Label lab2 = this.yw1.Parent.FindControl("zc" + i) as Label;
                if (isYearFlag)
                {
                    lab2.Text = String.Format("{0:n0}", z);
                }
                else
                {
                    lab2.Text = String.Format("{0:n2}", z);
                }
                dr1["zc"] = double.Parse(lab2.Text);


                Label lab3 = this.yw1.Parent.FindControl("sz" + i) as Label;
                if (isYearFlag)
                {
                    lab3.Text = String.Format("{0:n0}", s * SRate - z);
                }
                else
                {
                    lab3.Text = String.Format("{0:n2}", s * SRate - z);
                }
                if (s - z < 0)
                {
                    lab3.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    lab3.ForeColor = System.Drawing.Color.Empty;
                }
                dr1["sz"] = double.Parse(lab3.Text);

                dt1.Rows.Add(dr1);
            }

            ViewState["BianZhuData"] = dt1;
        }
        //// 计算收入和支出  原代码
        //private void NewCalShourAndZhiChu(TrainLine line0, RepeaterItem item)
        //{
        //    bool hasDianChe = false;                 //表示是否有发电车
        //    bool isYearFlag = false;                //表示是否是年分析的模式
        //    if (this.isYearPage.Value == "1")
        //    {
        //        isYearFlag = true;
        //    }

        //    Label lab1 = item.FindControl("traintype") as Label;
        //    ListControl cds = item.FindControl("cds") as ListControl;

        //    int traintype1 = int.Parse(lab1.Text);
        //    if (traintype1 == 21)
        //    {
        //        traintype1 = 2;
        //        hasDianChe = true;
        //    }

        //    //25B和25K有电车(金寿吉新增)
        //    if (traintype1 == 0 || traintype1 == 1)
        //    {
        //        hasDianChe = true;
        //    }

        //    ETrainType train1 = (ETrainType)(traintype1);
        //    double shouru1 = 0.0;
        //    int yz1 = 0, yw1 = 0, rw1 = 0,ca1=0,sy1=0;
        //    int totalPeople = 0;

        //    List<ZhiChuData>[] arrZc = new List<ZhiChuData>[4];
        //    arrZc[0] = new List<ZhiChuData>();
        //    arrZc[1] = new List<ZhiChuData>();
        //    arrZc[2] = new List<ZhiChuData>();
        //    arrZc[3] = new List<ZhiChuData>();
        //    double JnFee = 0;


        //    int totalBianZhu = 18;
        //    if (bz.SelectedIndex == 0)   //表示是自动编组方式
        //    {
        //        totalBianZhu = int.Parse(this.bzs0.SelectedValue);
        //    }


        //    //编组的选项目
        //    if (this.bz.SelectedIndex == 1)
        //    {
        //        yz1 = int.Parse(yz.Text);
        //        yw1 = int.Parse(yw.Text);
        //        rw1 = int.Parse(rw.Text);
        //        ca1 = int.Parse(ca.Text);
        //        sy1 = int.Parse(sy.Text);
        //    }

        //    Line.GetLineShouruAndZhiChu(train1, line0,
        //        cds.SelectedValue,totalBianZhu,
        //        out shouru1,ref yz1,ref yw1,ref rw1,ref ca1,ref sy1,
        //        out totalPeople,
        //        out arrZc[0],out arrZc[1],out arrZc[2],out arrZc[3],
        //        out JnFee,
        //        hasDianChe,isYearFlag,cb.SelectedIndex,"");

        //    //列车的收入
        //    shouru1 = shouru1 / 10000;
        //    Label labShouRu = item.FindControl("shouru") as Label;
        //    if (isYearFlag == false)
        //    {
        //        labShouRu.Text = String.Format("{0:n2}", shouru1);
        //        //labShouRu.Text = shouru1 + "";
        //    }
        //    else
        //    {
        //        labShouRu.Text = String.Format("{0:n0}", shouru1);
        //    }

        //    //计算列车的运输总人数
        //    Label labTotalPeople = item.FindControl("totalpeople") as Label;
        //    labTotalPeople.Text = String.Format("{0}", totalPeople);

        //    //计算列车的总支出和合适的车厢编组
        //    for (int i = 1; i <= 4; i++)
        //    {
        //        Label labZhiChu = item.FindControl("zhichu"+i) as Label;
        //        double sum1 = 0;
        //        String zc1 = String.Empty;
        //        foreach (ZhiChuData d1 in arrZc[i-1])
        //        {
        //            double t1 = d1.ZhiChu;

        //            sum1 = sum1 + t1;
        //            if (zc1 == String.Empty)
        //            {
        //                zc1 = d1.ZhiChu.ToString();
        //            }
        //            else
        //            {
        //                zc1 = zc1 + "," + d1.ZhiChu.ToString();
        //            }
        //        }
        //        zc1 = zc1 + "," + JnFee;

        //         if (isYearFlag == false)
        //        {
        //            labZhiChu.Text = String.Format("{0:n2}", sum1);
        //        }
        //        else
        //        {
        //            labZhiChu.Text = String.Format("{0:n0}", sum1);
        //        }
        //        //labZhiChu.OnClientClick = "javascript:ShowZhiChu('" + zc1 + "');return false;";

        //        //设置收支盈亏
        //        Label labsz = item.FindControl("sz" + i) as Label;
        //        if (isYearFlag == false)
        //        {
        //            labsz.Text = String.Format("{0:n2}", shouru1 * SRate - sum1);
        //        }
        //        else
        //        {
        //            labsz.Text = String.Format("{0:n0}", shouru1 * SRate - sum1);
        //        }

        //        //计算上座率
        //        Label labSzr = item.FindControl("szr"+i) as Label;
        //        if (isYearFlag == false)
        //        {
        //            labSzr.Text = String.Format("{0:n2}%", 100 * sum1 / (shouru1 * SRate));
        //        }
        //        else
        //        {
        //            labSzr.Text = String.Format("{0:n0}%", 100 * sum1 / (shouru1 * SRate));
        //        }
        //    }

        //    //显示列车的合适编组
        //    HyperLink link2 = item.FindControl("link2") as HyperLink;
        //    HyperLink link3 = item.FindControl("link3") as HyperLink;
        //    if (link2 != null)
        //    {
        //        if (int.Parse(lab1.Text) > 3 && lab1.Text != "21")
        //        {
        //            link2.Visible = false;
        //            link3.NavigateUrl = "SeeWordFile2.aspx?IsYear="+this.isYearPage.Value+"&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString())
        //                             + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=0,0,0,0,0";
        //        }
        //        else
        //        {
        //            if (lab1.Text != "21")
        //            {
        //                if (lab1.Text == "0" || lab1.Text == "1")  //表示 25B和25K
        //                {
        //                    link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString())
        //                                        + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1));
        //                }
        //                else
        //                {
        //                    link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString())
        //                                        + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1));
        //                }
        //            }
        //            else   //表示非直供电25G
        //            {
        //                link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear="+this.isYearPage.Value+"&TrainType=2&Line=" + Server.UrlEncode(line0.ToString())
        //                                   + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1,ca1,sy1));
        //            }
        //            link2.ToolTip = String.Format("最优的编组配置为:硬座{0}/ 硬卧{1}/ 软卧{2}/ 餐车{3} /宿营车{4}", yz1, yw1, rw1,ca1,sy1);
        //            link3.NavigateUrl = link2.NavigateUrl.Replace("BianZhuFenXi.aspx", "SeeWordFile.aspx");

        //            if (this.bz.SelectedIndex == 1)
        //            {
        //                link2.NavigateUrl = "javascript:alert('提示:此功能不适合手动编组模式!');";
        //                link2.ToolTip = String.Format("手动编组:硬座{0}/ 硬卧{1}/ 软卧{2}/ 餐车{3}/宿营车{4}", yz1, yw1, rw1, ca1,sy1);
        //            }
        //        }
        //    }


        //    Label bianzhu1 = item.FindControl("bianzhu") as Label;
        //    if (bianzhu1 != null)
        //    {
        //        bianzhu1.Text = String.Format("{0}-{1}-{2}-{3}-{4}", yz1, yw1, rw1,ca1,sy1);
        //    }
        //}

        // 分析线路
        private void SearchLine()
        {
            //查询结果
            Line             newLine = null;
            List <TrainLine> line1   = null;
            List <TrainLine> line2   = null;
            List <TrainLine> line3   = null;
            List <TrainLine> line4   = null;

            String A0 = this.AStation.Text.Trim();
            String B0 = this.BStation.Text.Trim();

            if (String.IsNullOrEmpty(A0) == false &&
                String.IsNullOrEmpty(B0) == false)
            {
                bool flag = true;
                if (Line.isExistsStation(A0) == false)
                {
                    WebFrame.Util.JAjax.Alert("错误:起始站【" + A0 + "】不存在!");
                    flag = false;
                }

                if (flag)
                {
                    if (Line.isExistsStation(B0) == false)
                    {
                        WebFrame.Util.JAjax.Alert("错误:终点站【" + B0 + "】不存在!");
                        flag = false;
                    }
                }

                if (flag)
                {
                    //将用户当前的选择条件保存到Cookie
                    DataRow dr1 = JControl.GetControlValues(con1);
                    WebFrame.Util.JCookie.SetCookieValues("userFenXiData", dr1, -1);

                    //寻找四类典型的线路
                    String[] middle     = null;
                    String   middleTemp = String.Empty;
                    if (this.middleStation.Text.Trim() != String.Empty)
                    {
                        middleTemp = this.middleStation.Text.Trim().Replace(",", ",");
                        middle     = middleTemp.Split(',');
                    }

                    if (ViewState["A0"] != null)
                    {
                        //1--从视图状态中恢复数据
                        if (ViewState["A0"].ToString() == A0 &&
                            ViewState["B0"].ToString() == B0 &&
                            ViewState["middle"].ToString() == middleTemp &&
                            ViewState["fengduanCondition"].ToString() == this.mulLine.Text &&
                            ViewState["onlygg"].ToString() == this.onlygg.Checked.ToString())
                        {
                            line1 = ViewState["Line1"] as List <TrainLine>;
                            line2 = ViewState["Line2"] as List <TrainLine>;
                            line3 = ViewState["Line3"] as List <TrainLine>;
                            line4 = ViewState["Line4"] as List <TrainLine>;
                        }
                    }

                    //2--从数据库中恢复数据
                    if (line1 == null)
                    {
                        SearchObjectBU.RestoreSearchResultFromDb(A0, B0, this.mulLine.Text.Trim(), out newLine);
                        if (newLine == null)
                        {
                            if (this.mulLine.Text.Trim() == String.Empty)
                            {
                                newLine = Line.GetLine(A0, B0, 100, this.selTrain.Text.Trim(), this.onlygg.Checked);
                            }
                            else
                            {
                                newLine = Line.GetLineByFengDuanSearch(this.mulLine.Text.Trim(), this.onlygg.Checked);
                            }
                        }

                        if (newLine != null)
                        {
                            line1 = newLine.GetLayerLine(middle, ETrainType.动车CRH380A, false, 1, this.onlygg.Checked);
                            line2 = newLine.GetLayerLine(middle, ETrainType.动车CRH2A, false, 1, this.onlygg.Checked);
                            line3 = newLine.GetLayerLine(middle, ETrainType.空调车25T, false, 3, this.onlygg.Checked);
                            line4 = newLine.GetLayerLine(middle, ETrainType.绿皮车25B, true, 3, this.onlygg.Checked);

                            //重新调整算法
                            if (line1.Count == 0 || line2.Count == 0)
                            {
                                Line dcnewLine = null;
                                if (this.mulLine.Text.Trim() == String.Empty)
                                {
                                    dcnewLine = Line.GetLine(A0, B0, 100, this.selTrain.Text.Trim(), true);
                                }
                                else
                                {
                                    dcnewLine = Line.GetLineByFengDuanSearch(this.mulLine.Text.Trim(), true);
                                }

                                if (dcnewLine != null)
                                {
                                    line1 = dcnewLine.GetLayerLine(middle, ETrainType.动车CRH380A, false, 1, true);
                                }

                                if (line2.Count == 0 && newLine != null)
                                {
                                    line2 = dcnewLine.GetLayerLine(middle, ETrainType.动车CRH2A, false, 1, true);
                                }
                            }
                        }
                    }

                    //3--将数据保存到视图状态
                    ViewState["A0"]                = A0;
                    ViewState["B0"]                = B0;
                    ViewState["middle"]            = middleTemp;
                    ViewState["fengduanCondition"] = this.mulLine.Text;
                    ViewState["onlygg"]            = this.onlygg.Checked.ToString();

                    //ViewState["MyLine"] = newLine;
                    ViewState["Line1"] = line1;    //300公里动车的线路
                    ViewState["Line2"] = line2;    //200公里动车的线路
                    ViewState["Line3"] = line3;    //直达线路
                    ViewState["Line4"] = line4;    //普通车的线路

                    //4--将查询对象保存到数据库
                    SearchObjectBU.SaveSearchResultToDb(A0, B0, newLine, this.mulLine.Text.Trim());


                    //=========设置车型的选择========================

                    /*
                     * data1.Add("3", "直达25T");
                     * data1.Add("2", "空调25G(直供电)");
                     * data1.Add("21", "空调25G(非直供电)");
                     * data1.Add("1", "空调25K");
                     * data1.Add("0", "绿皮车25B");
                     */
                    int index1 = bz.SelectedIndex;
                    if (index1 == 3)
                    {
                        index1 = 2;
                    }
                    Dictionary <String, String> data1 = CommTrain.GetNewFenXiData(index1);
                    this.Repeater2.DataSource = data1;
                    this.Repeater2.DataBind();
                    this.SearchInfo.Visible = true;
                    this.NewBindComplete();

                    String fullChengBen = String.Empty;
                    if (this.cb.SelectedIndex == 1)
                    {
                        fullChengBen = "全成本";
                    }

                    if (this.isYearPage.Value == "0")
                    {
                        this.t1.Text = fullChengBen + "趟";
                        this.t2.Text = fullChengBen + "趟";
                        this.t3.Text = fullChengBen + "趟";
                        this.t4.Text = fullChengBen + "趟";
                        this.t5.Text = fullChengBen + "趟";
                    }
                    else
                    {
                        this.t1.Text = fullChengBen + "年";
                        this.t2.Text = fullChengBen + "年";
                        this.t3.Text = fullChengBen + "年";
                        this.t4.Text = fullChengBen + "年";
                        this.t5.Text = fullChengBen + "年";
                    }
                }
            }
            else
            {
                WebFrame.Util.JAjax.Alert("错误:请输入车次的起点和终点");
            }
        }
        // 绑定Repeater的数据
        private void NewBindComplete()
        {
            foreach (RepeaterItem item in this.Repeater2.Items)
            {
                Label lab1 = item.FindControl("traintype") as Label;
                Label lab2 = item.FindControl("traintypeText") as Label;

                if (lab1 != null)
                {
                    //设置不同的车底数
                    ListControl cds = item.FindControl("cds") as ListControl;
                    if (cds != null)
                    {
                        cds.Items.Clear();
                        if (lab1.Text == "0" || lab1.Text == "1" ||
                            lab1.Text == "2" || lab1.Text == "3" ||
                            lab1.Text == "21")
                        {
                            for (int i = 1; i <= 6; i++)
                            {
                                ListItem list1 = new ListItem(i + "", i + "");
                                cds.Items.Add(list1);
                            }
                            cds.SelectedValue = "2";
                        }
                        else
                        {
                            cds.Items.Clear();

                            for (double i = 0.3; i <= 2.1; i = i + 0.1)
                            {
                                ListItem list1 = new ListItem(i + "", i + "");
                                cds.Items.Add(list1);
                            }

                            /*
                             * for (int i = 1; i <= 2; i++)
                             * {
                             *  ListItem list1 = new ListItem(i + "", i + "");
                             *  cds.Items.Add(list1);
                             * }*/
                            cds.SelectedValue = "1.0";
                        }
                    }

                    //设置其他的控件
                    ListControl rad1 = item.FindControl("selLine") as ListControl;
                    if (rad1 != null)
                    {
                        List <TrainLine> list1 = null;
                        ETrainType       type1 = ETrainType.绿皮车25B;
                        if (lab1.Text == "21")
                        {
                            type1 = ETrainType.空调车25G;
                        }
                        else
                        {
                            type1 = (ETrainType)(int.Parse(lab1.Text));
                        }

                        //===================================================================

                        /*
                         * //重新调整车型的条件
                         * if (lab1.Text == "0" || lab1.Text == "1"
                         || lab1.Text == "21")                               //普通车
                         ||{
                         || list1 = ViewState["Line4"] as List<TrainLine>;
                         ||}
                         ||else if (lab1.Text == "3" || lab1.Text == "2")           //直达车
                         ||{
                         || list1 = ViewState["Line3"] as List<TrainLine>;
                         ||}
                         ||else if (lab1.Text == "4" || lab1.Text == "5" || lab1.Text == "9" || lab1.Text == "10")           //200公里高速
                         ||{
                         || list1 = ViewState["Line2"] as List<TrainLine>;
                         ||}
                         ||else if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8"
                         || lab1.Text =="11" || lab1.Text =="12")  //300公里高速
                         ||{
                         || list1 = ViewState["Line1"] as List<TrainLine>;
                         ||}*/

                        if (lab1.Text == "0" || lab1.Text == "21")                               //普通车
                        {
                            list1 = ViewState["Line4"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "3" || lab1.Text == "2" || lab1.Text == "1")           //直达车
                        {
                            list1 = ViewState["Line3"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "4" || lab1.Text == "5" || lab1.Text == "9" || lab1.Text == "10")           //200公里高速
                        {
                            list1 = ViewState["Line2"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8" ||
                                 lab1.Text == "11" || lab1.Text == "12") //300公里高速
                        {
                            list1 = ViewState["Line1"] as List <TrainLine>;
                        }

                        //调整车底数的默认值
                        if (list1 != null && list1.Count > 0)
                        {
                            TrainLine line0 = list1[0];
                            int       miles = line0.TotalMiles;
                            // String defaultcds = Util.GetDefaultCds(miles, type1)+"";
                            String defaultcds = Util.GetDefaultCds1(miles, type1) + "";

                            if (cds.Items.FindByValue(defaultcds) != null)
                            {
                                cds.SelectedValue = defaultcds;

                                //设置其他的车底数不能用(仅适用于客车)
                                if (lab1.Text == "0" || lab1.Text == "1" ||
                                    lab1.Text == "2" || lab1.Text == "3" ||
                                    lab1.Text == "21")
                                {
                                    for (int i = 0; i < cds.Items.Count; i++)
                                    {
                                        double d1 = double.Parse(cds.Items[i].Value);
                                        if (d1 < double.Parse(defaultcds))
                                        {
                                            cds.Items[i].Enabled = false;
                                        }
                                        else
                                        {
                                            cds.Items[i].Enabled = true;
                                        }
                                    }
                                }
                            }
                        }

                        //设置选中的线路
                        this.SetLineItem(rad1, list1);


                        //计算收入和支持
                        if (rad1.Items.Count > 0)
                        {
                            item.Visible = true;
                            //列车收入和支出
                            this.NewCalShourAndZhiChu(list1[0], item);
                        }
                        else
                        {
                            item.Visible = false;
                        }

                        //设置不同的下拉框
                        DropDownList drop1 = item.FindControl("selTrainType") as DropDownList;
                        if (drop1 != null)
                        {
                            //300公里的动车
                            if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8" || lab1.Text == "11" || lab1.Text == "12")
                            {
                                CommTrain.SetDongCheListControl(drop1, 1);
                                lab2.Visible = false;
                            }
                            else if (lab1.Text == "4" || lab1.Text == "5" || lab1.Text == "9" || lab1.Text == "10") //200公里动车
                            {
                                CommTrain.SetDongCheListControl(drop1, 0);
                                lab2.Visible = false;
                            }
                            else
                            {
                                drop1.Visible = false;
                            }

                            if (drop1.Items.FindByValue(lab1.Text) != null)
                            {
                                drop1.SelectedValue = lab1.Text;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void SetSubData(int col, ZhiChuData zc1, int XiaoShou, CommTrain train2)
        {
            switch (zc1.ZhiChuName)
            {
            case "局外线路使用费":
                HtmlInputHidden hid1 = this.f3_3.Parent.FindControl("f" + col + "_3") as HtmlInputHidden;
                if (hid1 != null)
                {
                    hid1.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "机车牵引费":
                HtmlInputHidden hid2 = this.f3_3.Parent.FindControl("f" + col + "_4") as HtmlInputHidden;
                if (hid2 != null)
                {
                    hid2.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "售票服务费":
                HtmlInputHidden hid3 = this.f3_3.Parent.FindControl("f" + col + "_5") as HtmlInputHidden;
                if (hid3 != null)
                {
                    hid3.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "旅客服务费":
                HtmlInputHidden hid4 = this.f3_3.Parent.FindControl("f" + col + "_6") as HtmlInputHidden;
                if (hid4 != null)
                {
                    hid4.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "列车上水费":
                HtmlInputHidden hid5 = this.f3_3.Parent.FindControl("f" + col + "_7") as HtmlInputHidden;
                if (hid5 != null)
                {
                    hid5.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "人员工资和工资附加费":
                HtmlInputHidden hid6 = this.f3_3.Parent.FindControl("f" + col + "_8") as HtmlInputHidden;
                if (hid6 != null)
                {
                    hid6.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "车辆折旧费":
                HtmlInputHidden hid7 = this.f3_3.Parent.FindControl("f" + col + "_9") as HtmlInputHidden;
                if (hid7 != null)
                {
                    hid7.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "列车日常检修成本":
                HtmlInputHidden hid8 = this.f3_3.Parent.FindControl("f" + col + "_10") as HtmlInputHidden;
                if (hid8 != null)
                {
                    hid8.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "定期检修成本":
                HtmlInputHidden hid9 = this.f3_3.Parent.FindControl("f" + col + "_11") as HtmlInputHidden;
                if (hid9 != null)
                {
                    hid9.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "车辆消耗备用品":
                HtmlInputHidden hid10 = this.f3_3.Parent.FindControl("f" + col + "_12") as HtmlInputHidden;
                if (hid10 != null)
                {
                    hid10.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "空调车用油":
                HtmlInputHidden hid11 = this.f3_3.Parent.FindControl("f" + col + "_13") as HtmlInputHidden;
                if (hid11 != null)
                {
                    hid11.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "人员其他费用":
                HtmlInputHidden hid12 = this.f3_3.Parent.FindControl("f" + col + "_14") as HtmlInputHidden;
                if (hid12 != null)
                {
                    hid12.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "购买车辆利息":
                HtmlInputHidden hid13 = this.f3_3.Parent.FindControl("f" + col + "_15") as HtmlInputHidden;
                if (hid13 != null)
                {
                    hid13.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                }
                break;

            case "轮渡费":
                this.shipfee.Value = train2.GetFee15() + "";
                break;

            case "间接费用分摊":
                this.jianjiefee.Value = train2.GetFee16() + "";
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
        private void SetData()
        {
            String line1      = Request.QueryString["Line"];
            bool   isYearFlag = true;
            int    XiaoShou   = 0;

            if (String.IsNullOrEmpty(Request.QueryString["IsYear"]) == false)
            {
                if (Request.QueryString["IsYear"] == "0")
                {
                    isYearFlag = false;
                    XiaoShou   = 2;
                }
            }

            int traintype1 = int.Parse(Request.QueryString["TrainType"]);
            int dianche    = int.Parse(Request.QueryString["hasDianChe"]);

            String[] bianzhu    = Request.QueryString["BianZhu"].Split(',');
            bool     hasDianChe = false;

            if (dianche > 0)
            {
                hasDianChe = true;
            }

            this.yz.Value = bianzhu[0];
            this.yw.Value = bianzhu[1];
            this.rw.Value = bianzhu[2];
            this.ca.Value = "1";
            this.sy.Value = "0";

            if (bianzhu.Length >= 4)
            {
                this.ca.Value = bianzhu[3];
            }
            if (bianzhu.Length >= 5)
            {
                this.sy.Value = bianzhu[4];
            }

            String traintypename = ((ETrainType)traintype1).ToString();

            if (traintype1 == 2 || traintype1 == 1)
            {
                if (dianche > 0)
                {
                    traintypename = traintypename + "(非直供电)";
                }
                else
                {
                    traintypename = traintypename + "(直供电)";
                }
            }

            String[]  lineNodes = line1.Replace("-", ",").Split(',');
            TrainLine lineObj   = Line.GetTrainLineByTrainTypeAndLineNoeds((ETrainType)traintype1, hasDianChe, lineNodes);

            this.traintype.Value  = traintypename;
            this.totalmiles.Value = lineObj.TotalMiles + "";

            //设置起始站点
            this.as1.Value = lineObj.Nodes[0].AStation;
            this.bs1.Value = lineObj.Nodes[lineObj.Nodes.Count - 1].BStation;

            //计算支出
            CommTrain train2 = new CommTrain();

            train2.IsYearFlag = isYearFlag;

            if (String.IsNullOrEmpty(Request.QueryString["cds"]) == false)
            {
                train2.CheDiShu = double.Parse(Request.QueryString["cds"]);
            }

            train2.Line = lineObj;
            ECommTrainType commtype = (ECommTrainType)traintype1;

            train2.TrainType      = commtype;
            train2.YunXingLiCheng = lineObj.TotalMiles;
            double JnFee  = 0;
            double ShouRu = 0;

            String findcond;

            if (Session["FindCond"] == null)
            {
                findcond = "";
            }
            else
            {
                findcond = Session["FindCond"].ToString().Trim();
            }

            //1计算四种不同模式的支出
            int yz1 = int.Parse(this.yz.Value);
            int yw1 = int.Parse(this.yw.Value);
            int rw1 = int.Parse(this.rw.Value);
            int ca1 = int.Parse(this.ca.Value);
            int sy1 = int.Parse(this.sy.Value);

            train2.CunZengMoShi = ECunZengMoShi.新人新车;
            List <ZhiChuData> zhichu1 = train2.GetShouRuAndZhiChu(out ShouRu, yz1, yw1, rw1, sy1, ca1, hasDianChe, findcond);

            JnFee = train2.JnFee;
            int col = 3;
            int row = 3;

            foreach (ZhiChuData zc1 in zhichu1)
            {
                if (zc1.ZhiChuName != "电网和接触网使用费")
                {
                    SetSubData(col, zc1, XiaoShou, train2);
                }
            }
            f3_16.Value      = JMath.Round1(JnFee / XiShu, XiaoShou) + "";
            this.jfee1.Value = JMath.Round1(train2.JnFee / XiShu, XiaoShou) + "";
            this.jfee2.Value = JMath.Round1(train2.JnSaleFee / XiShu, XiaoShou) + "";
            this.jfee3.Value = JMath.Round1(train2.JnServerFee / XiShu, XiaoShou) + "";

            //2
            train2.CunZengMoShi = ECunZengMoShi.新人有车;
            List <ZhiChuData> zhichu2 = train2.GetShouRuAndZhiChu(out ShouRu, yz1, yw1, rw1, sy1, ca1, hasDianChe, findcond);

            JnFee = train2.JnFee;
            col   = 4;
            row   = 3;
            foreach (ZhiChuData zc1 in zhichu2)
            {
                if (zc1.ZhiChuName != "电网和接触网使用费")
                {
                    //HtmlInputHidden hid1 = this.f3_3.Parent.FindControl("f" + col + "_" + row) as HtmlInputHidden;
                    //if (hid1 != null) hid1.Value = JMath.Round1(zc1.ZhiChu / XiShu, XiaoShou) + "";
                    // row++;
                    SetSubData(col, zc1, XiaoShou, train2);
                }
            }
            f4_16.Value      = JMath.Round1(JnFee / XiShu, XiaoShou) + "";
            this.jfee4.Value = JMath.Round1(train2.JnFee / XiShu, XiaoShou) + "";
            this.jfee5.Value = JMath.Round1(train2.JnSaleFee / XiShu, XiaoShou) + "";
            this.jfee6.Value = JMath.Round1(train2.JnServerFee / XiShu, XiaoShou) + "";

            //3
            train2.CunZengMoShi = ECunZengMoShi.人新车;
            List <ZhiChuData> zhichu3 = train2.GetShouRuAndZhiChu(out ShouRu, yz1, yw1, rw1, sy1, ca1, hasDianChe, findcond);

            JnFee = train2.JnFee;
            col   = 5;
            row   = 3;
            foreach (ZhiChuData zc1 in zhichu3)
            {
                if (zc1.ZhiChuName != "电网和接触网使用费")
                {
                    SetSubData(col, zc1, XiaoShou, train2);
                }
            }
            f5_16.Value      = JMath.Round1(JnFee / XiShu, XiaoShou) + "";
            this.jfee7.Value = JMath.Round1(train2.JnFee / XiShu, XiaoShou) + "";
            this.jfee8.Value = JMath.Round1(train2.JnSaleFee / XiShu, XiaoShou) + "";
            this.jfee9.Value = JMath.Round1(train2.JnServerFee / XiShu, XiaoShou) + "";

            //4
            train2.CunZengMoShi = ECunZengMoShi.人有车;
            List <ZhiChuData> zhichu4 = train2.GetShouRuAndZhiChu(out ShouRu, yz1, yw1, rw1, sy1, ca1, hasDianChe, findcond);

            JnFee = train2.JnFee;
            col   = 6;
            row   = 3;
            foreach (ZhiChuData zc1 in zhichu4)
            {
                if (zc1.ZhiChuName != "电网和接触网使用费")
                {
                    SetSubData(col, zc1, XiaoShou, train2);
                }
            }
            f6_16.Value       = JMath.Round1(JnFee / XiShu, XiaoShou) + "";
            this.jfee10.Value = JMath.Round1(train2.JnFee / XiShu, XiaoShou) + "";
            this.jfee11.Value = JMath.Round1(train2.JnSaleFee / XiShu, XiaoShou) + "";
            this.jfee12.Value = JMath.Round1(train2.JnServerFee / XiShu, XiaoShou) + "";

            //计算轮渡费和间接分摊费
            //this.shipfee.Value = train2.GetFee15()+"";
            //this.jianjiefee.Value = train2.GetFee16() + "";
        }