void Repeater2_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            RepeaterItem item = e.Item;

            TrainLine line0 = null;                      //表示选中的线路

            ETrainType train1   = ETrainType.空调车25T;     //表示列车类型
            double     cdsvalue = 1;                     //表示车底数
            String     bianZhu  = String.Empty;          //列车的编组

            if (item != null)
            {
                Label lab1 = item.FindControl("traintype") as Label;
                if (lab1 != null)
                {
                    ListControl rad1 = item.FindControl("selLine") as ListControl;
                    if (rad1 != null)
                    {
                        List <TrainLine> list1 = null;
                        if (lab1.Text == "0" || lab1.Text == "1" ||
                            lab1.Text == "2" || lab1.Text == "21")                           //普通车
                        {
                            list1 = ViewState["Line4"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "3")                                            //直达车
                        {
                            list1 = ViewState["Line3"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "4" || lab1.Text == "5")                      //200公里高速
                        {
                            list1 = ViewState["Line2"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8")  //300公里高速
                        {
                            list1 = ViewState["Line1"] as List <TrainLine>;
                        }

                        line0 = list1[rad1.SelectedIndex];
                    }

                    ListControl cds = item.FindControl("cds") as ListControl;
                    if (cds != null)
                    {
                        cdsvalue = double.Parse(cds.SelectedValue);
                    }
                    int traintype1 = int.Parse(lab1.Text);
                    if (traintype1 == 21)
                    {
                        traintype1 = 2;
                    }
                    train1 = (ETrainType)(traintype1);

                    Label bianzhu1 = item.FindControl("bianzhu") as Label;
                    if (bianzhu1 != null)
                    {
                        bianZhu = bianzhu1.Text;
                    }

                    //开始计算其中的数值
                    if (line0 != null)
                    {
                        BusinessRule.PubCode.Util.ExportData("trainData1.xls");
                    }
                }
            }
        }
        /// <summary>
        /// 绑定Repeater的数据
        /// </summary>
        private void NewBindComplete()
        {
            foreach (RepeaterItem item in this.Repeater2.Items)
            {
                Label lab1 = item.FindControl("traintype") 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);
                            }
                            cds.SelectedValue = "1";
                        }
                    }

                    //设置其他的控件
                    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 == "2" || lab1.Text == "21")                          //普通车
                        {
                            list1 = ViewState["Line4"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "3")                                            //直达车
                        {
                            list1 = ViewState["Line3"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "4" || lab1.Text == "5")                      //200公里高速
                        {
                            list1 = ViewState["Line2"] as List <TrainLine>;
                        }
                        else if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8")  //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) + "";
                            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;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 计算收入和支出  20140417
        /// </summary>
        /// <param name="line0"></param>
        /// <param name="item"></param>
        private void NewCalShourAndZhiChu(TrainLine line0, RepeaterItem item)
        {
            bool hasDianChe = false;        //表示是否有发电车

            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;
            }

            ETrainType train1 = (ETrainType)(traintype1);
            double     shouru1 = 0.0;
            int        yz = 0, yw = 0, rw = 0, ca = 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 cbmode = int.Parse(this.cb.selectIndex);

            int totalBianZhu = 18;

            Line.GetLineShouruAndZhiChu(train1, line0, cds.SelectedValue, totalBianZhu,
                                        out shouru1, ref yz, ref yw, ref rw, ref ca,
                                        ref sy1,
                                        out totalPeople,
                                        out arrZc[0], out arrZc[1], out arrZc[2], out arrZc[3],
                                        out JnFee, hasDianChe, true, 0, "");

            //列车的收入
            shouru1 = shouru1 / 10000;
            Label labShouRu = item.FindControl("shouru") as Label;

            labShouRu.Text = String.Format("{0:n0}", shouru1);

            //计算列车的运输总人数
            Label labTotalPeople = item.FindControl("totalpeople") as Label;

            labTotalPeople.Text = String.Format("{0:n0}", totalPeople);

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

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

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

                //计算上座率
                Label labSzr = item.FindControl("szr" + i) as Label;
                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=1&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString())
                                        + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=0,0,0";
                }
                else
                {
                    if (lab1.Text != "21")
                    {
                        link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=1&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString())
                                            + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2}", yz, yw, rw));
                    }
                    else
                    {
                        link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=1&TrainType=2&Line=" + Server.UrlEncode(line0.ToString())
                                            + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2}", yz, yw, rw));
                    }
                    link2.ToolTip     = String.Format("最优的编组配置为:硬座{0}/ 硬卧{1}/ 软卧{2}", yz, yw, rw);
                    link3.NavigateUrl = link2.NavigateUrl.Replace("BianZhuFenXi.aspx", "SeeWordFile.aspx");
                }
            }


            Label bianzhu1 = item.FindControl("bianzhu") as Label;

            if (bianzhu1 != null)
            {
                bianzhu1.Text = String.Format("{0}-{1}-{2}", yz, yw, rw);
            }
        }
        /// <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;
        }
Exemplo n.º 5
0
        //得到动车的价格
        public static double GetTrainPrice(
            EHighTrainType traintype,
            EDTrainFareType type1,
            TrainLine Line,
            int yunXingLiCheng)
        {
            double SFRate = 1.0;
            double result = 0;
            String stype1 = "CRH2A";
            String srate1 = "Rate1";

            switch (traintype)
            {
            case EHighTrainType.CRH2A:
                stype1 = "CRH2A";
                break;

            case EHighTrainType.CRH2B:
                stype1 = "CRH2B";
                break;

            case EHighTrainType.CRH2C:
                stype1 = "CRH2C";
                break;

            case EHighTrainType.CRH2E:
                stype1 = "CRH2E";
                break;

            case EHighTrainType.CRH380A:
                stype1 = "CRH380A";
                break;

            case EHighTrainType.CRH380AL:
                stype1 = "CRH380AL";
                break;

            //增加动车车型的影响(2013年3月13日)
            case EHighTrainType.CRH380B:
                stype1 = "CRH380B";
                break;

            case EHighTrainType.CRH380BL:
                stype1 = "CRH380BL";
                break;

            case EHighTrainType.CRH5A:
                stype1 = "CRH5A";
                break;
            }

            switch (type1)
            {
            case EDTrainFareType.一等软座:
                srate1 = "Rate1";
                break;

            case EDTrainFareType.二等软座:
                srate1 = "Rate2";
                break;

            case EDTrainFareType.动卧上铺:
                srate1 = "Rate3";
                break;

            case EDTrainFareType.动卧下铺:
                srate1 = "Rate31";
                break;

            case EDTrainFareType.商务座:
                srate1 = "Rate4";
                break;

            case EDTrainFareType.特定座:
                srate1 = "Rate5";
                break;
            }

            //重新计算票价(300公里高速在非高速线上按200公里的计算)
            //修改日期:2013年
            //Author:Jin ShouJi
            if (Line != null && Line.Nodes != null)
            {
                foreach (LineNode node1 in Line.Nodes)
                {
                    int    miles1    = node1.Miles;
                    String lineType1 = node1.LineType;
                    String stype2    = stype1;
                    if ((stype2 == "CRH380A" ||
                         stype2 == "CRH380AL" ||
                         stype2 == "CRH380B" ||
                         stype2 == "CRH380BL" ||
                         stype2 == "CRH2C") && lineType1 != "1")
                    {
                        stype2 = "CRH2A";
                    }

                    DataRow[] drs = HighTrainProfile.Data.Select("HIGHTRAINTYPE='" + stype2 + "'");
                    if (drs != null && drs.Length > 0)
                    {
                        DataRow dr = drs[0];
                        if (dr[srate1].ToString().Trim() != String.Empty)
                        {
                            double rate0 = double.Parse(dr[srate1].ToString());
                            result = result + miles1 * rate0 * SFRate;
                        }
                    }
                }
            }

            /*
             * //老的计算方法
             * DataRow[] drs= HighTrainProfile.Data.Select("HIGHTRAINTYPE='" + stype1 + "'");
             * if (drs != null && drs.Length > 0)
             * {
             *  DataRow dr = drs[0];
             *  if (dr[srate1].ToString().Trim() != String.Empty)
             *  {
             *      double rate0 = double.Parse(dr[srate1].ToString());
             *      result = yunXingLiCheng * rate0 * SFRate;
             *  }
             * }*/


            //计算保险费
            double baoxian = JMath.Round1(TrainProfile.BaoXianFee * TrainProfile.BaseFee * yunXingLiCheng, 1);

            if (result == 0)
            {
                baoxian = 0;
            }
            result = JMath.Round1(result + baoxian, 0);

            double discount = GetDiscount(traintype, Line, yunXingLiCheng);

            result = JMath.Round1(result * (1 - discount), 0);
            return(result);
        }
        protected void selTrainType_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListControl obj1 = sender as ListControl;

            if (obj1 != null)
            {
                RepeaterItem item1 = obj1.Parent as RepeaterItem;
                if (item1 != null)
                {
                    Label lab1 = item1.FindControl("traintype") as Label;
                    Label lab2 = item1.FindControl("traintypeText") as Label;
                    if (lab1.Text != null)
                    {
                        lab1.Text = obj1.SelectedValue;
                        lab2.Text = obj1.SelectedItem.Text;
                    }

                    ListControl selline = item1.FindControl("selLine") as ListControl;
                    int         index1  = selline.SelectedIndex;

                    List <TrainLine> list1 = null;

                    /*
                     * //重新调整线路的限制
                     * if (lab1.Text == "0" || lab1.Text == "1" || lab1.Text == "2"
                     || lab1.Text == "21")       //普通车
                     ||{
                     || list1 = ViewState["Line4"] as List<TrainLine>;
                     ||}
                     ||else if (lab1.Text == "3")                                            //直达车
                     ||{
                     || 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>;
                    }


                    TrainLine line0 = list1[index1];
                    this.NewCalShourAndZhiChu(line0, item1);
                }
            }
        }
        // 计算收入和支出  20140417
        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);
            }
        }
Exemplo n.º 8
0
        void button1_Command(object sender, CommandEventArgs e)
        {
            if (FrameLib.CheckData(button1))
            {
                button1.ExecutePara.Success = true;
                if (this.Line.Text.Trim() != String.Empty)
                {
                    //检查线路的配置是否正确
                    String     traintype = this.TrainType.Text.Trim();
                    ETrainType type1     = ETrainType.空调车25T;

                    if (traintype == "动车组")
                    {
                        type1 = ETrainType.动车CRH2A;
                    }
                    else if (traintype == "空调特快")
                    {
                        type1 = ETrainType.空调车25T;
                    }
                    else if (traintype == "空调快速")
                    {
                        type1 = ETrainType.空调车25G;
                    }
                    else if (traintype == "空调普快")
                    {
                        type1 = ETrainType.空调车25G;
                    }
                    else if (traintype == "快速")
                    {
                        type1 = ETrainType.空调车25K;
                    }
                    else if (traintype == "普快")
                    {
                        type1 = ETrainType.绿皮车25B;
                    }

                    String[]  lineNodes = this.Line.Text.Trim().Replace("-", ",").Split(',');
                    TrainLine lineObj   = BusinessRule.Line.GetTrainLineByTrainTypeAndLineNoeds(type1, false, lineNodes);
                    if (lineObj != null)
                    {
                        if (lineObj.TotalMiles + "" != this.Mile.Text.Trim())
                        {
                            button1.ExecutePara.Success  = false;
                            button1.ExecutePara.FailInfo = "错误:线路的距离设置错误,应为(" + lineObj.TotalMiles + "公里)!";
                        }
                    }
                    else
                    {
                        button1.ExecutePara.Success  = false;
                        button1.ExecutePara.FailInfo = "错误:线路的配置不对或线路不存在!";
                    }
                }

                if (button1.ExecutePara.Success)
                {
                    button1.JButtonType = JButtonType.SimpleAction;
                    FrameLib.ExecuteJButton(button1);
                }
                else
                {
                    FrameLib.ExecuteButtonInfo(button1);
                }
            }
        }
        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() + "";
        }
Exemplo n.º 10
0
        //线路使用费
        public static double GetFee1(
            ETrainType type1,
            bool kongTiao,
            TrainLine line0)
        {
            double fee0 = 0;

            if (line0 != null)
            {
                //普通列车
                if (IsCommonTrain(type1))
                {
                    bool kt = true;
                    if (type1 == ETrainType.绿皮车25B)
                    {
                        kt = kongTiao;
                    }
                    for (int i = 0; i < line0.Nodes.Count; i++)
                    {
                        int    index0 = int.Parse(line0.Nodes[i].LineType);
                        double Rate   = 0;
                        if (kt == false)
                        {
                            Rate = LineProfile.FeeRate[index0].Fee6;
                        }
                        else
                        {
                            Rate = LineProfile.FeeRate[index0].Fee5;
                        }
                        fee0 = fee0 + Rate * line0.Nodes[i].Miles;
                    }
                }
                else   //动车组
                {
                    EHighTrainBianZhu bianzhu = EHighTrainBianZhu.单组;
                    if (IsUnionHighTrain(type1))
                    {
                        bianzhu = EHighTrainBianZhu.重联;
                    }

                    for (int i = 0; i < line0.Nodes.Count; i++)
                    {
                        int    index0 = int.Parse(line0.Nodes[i].LineType);
                        double Rate   = 0;
                        if (bianzhu == EHighTrainBianZhu.单组)
                        {
                            if (Is300Train(type1) == false)
                            {
                                Rate = LineProfile.FeeRate[index0].Fee3;
                            }
                            else
                            {
                                Rate = LineProfile.FeeRate[index0].Fee1;
                            }
                        }
                        else
                        {
                            if (Is300Train(type1) == false)
                            {
                                Rate = LineProfile.FeeRate[index0].Fee4;
                            }
                            else
                            {
                                Rate = LineProfile.FeeRate[index0].Fee2;
                            }
                        }
                        fee0 = fee0 + Rate * line0.Nodes[i].Miles;
                    }
                }
            }

            fee0 = fee0 * 2 * 365;
            return(fee0);
        }
Exemplo n.º 11
0
        void button1_Click(object sender, ImageClickEventArgs e)
        {
            //System.Web.Security.FormsAuthentication.RedirectFromLoginPage(this.UserID.Text, false);

            String ip1 = KIPBU.GetIPs();

            if (String.IsNullOrEmpty(ip1) == false)
            {
                String[]      ips   = ip1.Split(',');
                List <String> list1 = new List <string>();
                foreach (String m in ips)
                {
                    if (list1.Contains(m) == false)
                    {
                        list1.Add(m);
                    }
                }

                String soureceIP = Request.UserHostAddress;
                if (list1.Contains(soureceIP))
                {
                    if (String.IsNullOrEmpty(this.UserID.Text) == false &&
                        String.IsNullOrEmpty(this.PassWord.Text) == false)
                    {
                        MyUserName user1 = new MyUserName();
                        bool       succ  = user1.Login(this.UserID.Text, this.PassWord.Text);
                        if (succ)
                        {
                            FrameLib.UserID   = this.UserID.Text;
                            FrameLib.DepartID = "DepartID";



                            //基础数据初始化
                            //基础数据发生变化时,重写这些数据;

                            ChexianBianZhuData.Init();
                            LiChengProfile.Init();
                            LiChengJianRate.Init();
                            JiaKuaiProfile.Init();
                            LineProfile.Init();
                            // QianYinFeeProfile.Init();
                            CheXianProfile.Init();
                            HighTrainProfile.Init();
                            TrainLineKindProfile.Init();
                            TrainProfile.Init();
                            PersonGZProfile.Init();
                            RiChangFeeProfile.Init();
                            A2A3FeeProfile.Init();

                            //调整夏冬切换的线路
                            TrainLine.ExchangeSpringAndWinter();

                            //处理系统的升级
                            AppCode.Upgrade.Go();

                            Response.Redirect("TrainWeb/MainFrame.aspx", true);
                        }
                        else
                        {
                            JAjax.Alert("错误:用户名或密码不正确!");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/GenericErrorPage.htm", true);
                }
            }
            else
            {
                Response.Redirect("/GenericErrorPage.htm", true);
            }
        }
Exemplo n.º 12
0
        private TrainLine SetData()
        {
            String line1      = Request.QueryString["Line"];
            int    traintype1 = int.Parse(Request.QueryString["TrainType"]);
            int    dianche    = int.Parse(Request.QueryString["hasDianChe"]);
            bool   hasDianChe = false;

            bool isYearFlag = true;
            int  XiaoShou   = 0;

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

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

            if ((ETrainType)traintype1 == ETrainType.空调车25G)
            {
                if (dianche > 0)
                {
                    traintypename = traintypename + "(非直供电)";
                    hasDianChe    = true;
                }
                else
                {
                    traintypename = traintypename + "(直供电)";
                    hasDianChe    = false;
                }
            }

            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;


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

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

            train2.Line       = lineObj;
            train2.IsYearFlag = isYearFlag;
            EHighTrainType commtype = (EHighTrainType)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计算四种不同模式的支出
            train2.CunZengMoShi = ECunZengMoShi.新人新车;
            List <ZhiChuData> zhichu1 = train2.GetShouRuAndZhiChu(out ShouRu, findcond);

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

            foreach (ZhiChuData zc1 in zhichu1)
            {
                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);
                }
            }
            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, findcond);

            JnFee = train2.JnFee;
            col   = 4;
            row   = 3;
            foreach (ZhiChuData zc1 in zhichu2)
            {
                if (zc1.ZhiChuName != "机车牵引费")
                {
                    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, 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, 0) + "";
            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, 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.jianjiefee.Value = train2.GetFee16() + "";

            return(lineObj);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Finds the off transfers.
        /// </summary>
        /// <param name="connections">The connections.</param>
        /// <param name="selectedLine">The selected line.</param>
        /// <param name="transfers">The transfers.</param>
        /// <returns></returns>
        private static List <Transfer> findOffTransfers(List <GroupOfConnections> connections, TrainLine selectedLine, List <Transfer> transfers)
        {
            int lineNumber = selectedLine.LineNumber;

            // loop over all group of connection
            foreach (GroupOfConnections connection in connections)
            {
                TrainLine previousLine = null;
                // loop over all lines in that group
                foreach (TrainLine line in connection.LinesOfConnection)
                {
                    // if the previous line is wanted line
                    if (previousLine != null && previousLine.LineNumber == lineNumber)
                    {
                        updateTransfer(selectedLine, line, connection, transfers);
                    }

                    // set line as prevous for next loop
                    previousLine = line;
                }
            }

            return(transfers);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Finds the on/off transfers.
        /// </summary>
        /// <param name="connections">The connections.</param>
        /// <param name="selectedLine">The selected line.</param>
        /// <param name="transfers">The transfers.</param>
        /// <returns></returns>
        private static List <Transfer> findOnOffTransfers(List <GroupOfConnections> connections, TrainLine selectedLine, List <Transfer> transfers)
        {
            int lineNumber = selectedLine.LineNumber;

            // loop over all group of connection
            foreach (GroupOfConnections connection in connections)
            {
                // previous line - determines if we are handling the off or on transfer
                TrainLine previousLine = null;

                // loop over all lines in that group
                foreach (TrainLine line in connection.LinesOfConnection)
                {
                    if (previousLine != null)
                    {
                        // off: if the previous line is wanted line
                        if (previousLine.LineNumber == lineNumber)
                        {
                            updateTransfer(selectedLine, line, connection, transfers);
                        }

                        // on: if the current line is wanted line
                        if (line.LineNumber == lineNumber)
                        {
                            updateTransfer(previousLine, selectedLine, connection, transfers);
                        }
                    }

                    // set line as prevous for next loop
                    previousLine = line;
                }
            }

            return(transfers);
        }