public HighTrain(EHighTrainType trainType1)
 {
     this.TrainBigKind = ETrainBigKind.动车;
     this.WaterCount   = 1;
     this.TrainType    = trainType1;
     this.CheDiShu     = 1;
 }
Beispiel #2
0
        //设置票价和满员
        private void SetPriceAndPerson(TrainLine line)
        {
            DataTable      dt         = HighTrainProfile.Data;
            int            traintype1 = int.Parse(Request.QueryString["TrainType"]);
            EHighTrainType type1      = (EHighTrainType)traintype1;

            DataRow[] drs = dt.Select("HIGHTRAINTYPE='" + type1.ToString() + "'");
            if (drs != null && drs.Length > 0)
            {
                DataRow dr = drs[0];
                this.m1.Value = dr["pcount1"].ToString();
                this.m2.Value = dr["pcount2"].ToString();
                this.m3.Value = dr["pcount4"].ToString();
                this.m4.Value = dr["pcount3"].ToString();
                this.m5.Value = dr["pcount5"].ToString();
            }
            //设置票价
            int licheng = int.Parse(this.totalmiles.Value);

            this.p1.Value = DTrainShouRu.GetTrainPrice(type1, EDTrainFareType.一等软座, line, licheng) + "";
            this.p2.Value = DTrainShouRu.GetTrainPrice(type1, EDTrainFareType.二等软座, line, licheng) + "";
            this.p3.Value = DTrainShouRu.GetTrainPrice(type1, EDTrainFareType.商务座, line, licheng) + "";

            this.p4.Value = DTrainShouRu.GetTrainPrice(type1, EDTrainFareType.动卧上铺, line, licheng) + "";
            this.p5.Value = DTrainShouRu.GetTrainPrice(type1, EDTrainFareType.动卧下铺, line, licheng) + "";

            this.p6.Value = DTrainShouRu.GetTrainPrice(type1, EDTrainFareType.特定座, line, licheng) + "";
        }
Beispiel #3
0
        /// <summary>
        /// 得到动车的折扣计算
        /// </summary>
        /// <returns></returns>
        private static double GetDiscount(EHighTrainType trainType,
                                          TrainLine Line,
                                          int YunXingLiCheng)
        {
            double result   = 0;
            String RateName = String.Empty;

            //300公里的动车
            if (trainType == EHighTrainType.CRH2C ||
                trainType == EHighTrainType.CRH380A ||
                trainType == EHighTrainType.CRH380AL ||
                trainType == EHighTrainType.CRH380B ||
                trainType == EHighTrainType.CRH380BL)      //增加了动车车型的CRH380B和CRH380BL的处理
            {
                RateName = "Rate3";
            }
            else
            {
                RateName = "Rate2";
                if (Line != null)
                {
                    foreach (LineNode node1 in Line.Nodes)
                    {
                        int type1 = int.Parse(node1.LineType);
                        if (type1 > 2)
                        {
                            RateName = "Rate1";   //普通线路
                            break;
                        }
                    }
                }
            }

            //计算动车的折扣
            if (String.IsNullOrEmpty(RateName) == false)
            {
                JTable tab1 = new JTable("HIGHTRAINPRICERATE");
                tab1.OrderBy = "LICHENG desc";
                List <SearchField> condition = new List <SearchField>();
                condition.Add(new SearchField("LICHENG", YunXingLiCheng + "",
                                              SearchOperator.SmallerAndEqual, SearchFieldType.NumericType));
                DataRow dr1 = tab1.GetFirstDataRow(condition, RateName);
                if (dr1 != null)
                {
                    result = double.Parse(dr1[0].ToString());
                    result = result / 100d;
                }
                tab1.Close();
            }
            return(result);
        }
Beispiel #4
0
        //得到默认的天数
        public static double GetDefaultCds1(int total, ETrainType type1)
        {
            double result = 1;
            double speed  = 0;
            int    type0  = (int)type1;

            if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K ||
                type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B)
            {
                result = 2;
                speed  = double.Parse(CheXianProfile.Data[(ECommTrainType)type0].SPEED);
            }
            else
            {
                result = 1;
                EHighTrainType type2 = (EHighTrainType)type0;
                DataTable      dt1   = HighTrainProfile.Data;
                if (dt1.Rows.Count > 0)
                {
                    DataRow[] drs = dt1.Select("HIGHTRAINTYPE='" + type2.ToString() + "'");
                    if (drs != null && drs.Length > 0)
                    {
                        speed = double.Parse(drs[0]["speed"].ToString());
                    }
                }
            }


            if (speed > 0)
            {
                double temp1 = (total / speed) * 2;
                if (temp1 < 24)
                {
                    temp1 = ((total / speed) * 2) / 16;
                }
                else
                {
                    temp1 = temp1 / 24;
                }
                result = Math.Ceiling(temp1);
            }

            return(result);
        }
Beispiel #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);
        }
Beispiel #6
0
        //得到默认的车底数
        public static double GetDefaultCds(int total, ETrainType type1)
        {
            double result = 1;
            double speed  = 0;
            int    type0  = (int)type1;

            if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K ||
                type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B)
            {
                result = 2;
                speed  = double.Parse(CheXianProfile.Data[(ECommTrainType)type0].SPEED);

                if (speed > 0)
                {
                    if (total < 1000)
                    {
                        double total1 = total * 1.5;
                        double t1     = (total1 / speed) * 2 / 24.0 + 0.00001;
                        result = Math.Ceiling(t1);
                    }
                    else
                    {
                        double total1 = total;
                        double t1     = (total1 / speed) * 2 / 24.0 + 0.00001;
                        result = Math.Ceiling(t1);
                        if (result < 2)
                        {
                            result = 2;
                        }
                    }
                }
            }
            else
            {
                result = 1;
                EHighTrainType type2 = (EHighTrainType)type0;
                DataTable      dt1   = HighTrainProfile.Data;
                if (dt1.Rows.Count > 0)
                {
                    DataRow[] drs = dt1.Select("HIGHTRAINTYPE='" + type2.ToString() + "'");
                    if (drs != null && drs.Length > 0)
                    {
                        speed = double.Parse(drs[0]["speed"].ToString());
                    }
                }

                if (speed > 0)
                {
                    double total1 = total;
                    double t1     = (total1 / speed) * 2 / 18.0 + 0.00001;
                    result = Math.Ceiling(t1);
                }
            }


            /*
             * if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K
             || type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B)
             ||{
             || if (result < 2) result = 2;
             ||}
             ||else
             ||{
             || if (result < 1) result = 1;
             ||}*/

            return(result);
        }
Beispiel #7
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);
        }