//空调费 public virtual double GetKongTiaoFee(ECommTrainType traintype, ECommCheXian chexian1) { bool specialKongTiao = false; //绿皮车在5.1-10.10征收空调费 if (traintype == ECommTrainType.绿皮车25B && (chexian1 == ECommCheXian.软卧 || chexian1 == ECommCheXian.高级软卧)) { int year1 = DateTime.Now.Year; DateTime dt1 = DateTime.Parse(year1 + "-5-1"); DateTime dt2 = DateTime.Parse(year1 + "-10-11"); DateTime dt0 = DateTime.Today; if (dt0 >= dt1 && dt0 <= dt2) { specialKongTiao = true; } } if (this.kongTiaoFlag || specialKongTiao) { return(this.KongTiaoFee); } else { return(0); } }
protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { String line1 = Request.QueryString["Line"]; int traintype1 = int.Parse(Request.QueryString["TrainType"]); this.traintype.Text = ((ETrainType)traintype1).ToString(); bool hasDianche = true; if ((ETrainType)traintype1 == ETrainType.空调车25G) { int dianche = int.Parse(Request.QueryString["hasDianChe"]); if (dianche > 0) { this.traintype.Text = this.traintype.Text + "(非直供电)"; hasDianche = true; } else { this.traintype.Text = this.traintype.Text + "(直供电)"; hasDianche = false; } } ETrainType traintype2 = (ETrainType)traintype1; String[] lineNodes = line1.Replace("-", ",").Split(','); String[] bianzhu = Request.QueryString["BianZhu"].Split(','); this.yz1.Text = bianzhu[0]; this.yw1.Text = bianzhu[1]; this.rw1.Text = bianzhu[2]; //保存总的编组数 int totalBianZhu = int.Parse(bianzhu[0]) + int.Parse(bianzhu[1]) + int.Parse(bianzhu[2]); //设置其他的默认编组 TrainLine lineObj = Line.GetTrainLineByTrainTypeAndLineNoeds(traintype2, hasDianche, lineNodes); ViewState["Line"] = lineObj; this.line.Text = line1 + "(" + lineObj.TotalMiles + "公里)"; //设置其他的编组的数据 ECommTrainType traintype3 = (ECommTrainType)traintype1; this.SetBianZhu(traintype3, totalBianZhu); this.CalShouruAndZhiChu(); DataTable dt1 = ViewState["BianZhuData"] as DataTable; if (dt1 != null) { DataView dv = dt1.DefaultView; dv.Sort = "sz desc"; this.repeater1.DataSource = dv; this.repeater1.DataBind(); } } base.OnLoad(e); }
/// <summary> /// 设置其他的编组数据 /// </summary> /// <param name="trainType"></param> private void SetBianZhu(ECommTrainType trainType, int totalBianZhu) { int yz0 = 0; int yz1 = 0; int yw0 = 0; int yw1 = 0; int rw0 = 0; int rw1 = 0; if (trainType == ECommTrainType.空调车25G) { yz0 = BZData.Train25G[0]; yz1 = BZData.Train25G[1]; yw0 = BZData.Train25G[2]; yw1 = BZData.Train25G[3]; rw0 = BZData.Train25G[4]; rw1 = BZData.Train25G[5]; } else if (trainType == ECommTrainType.空调车25K) { yz0 = BZData.Train25K[0]; yz1 = BZData.Train25K[1]; yw0 = BZData.Train25K[2]; yw1 = BZData.Train25K[3]; rw0 = BZData.Train25K[4]; rw1 = BZData.Train25K[5]; } else if (trainType == ECommTrainType.空调车25T) { yz0 = BZData.Train25T[0]; yz1 = BZData.Train25T[1]; yw0 = BZData.Train25T[2]; yw1 = BZData.Train25T[3]; rw0 = BZData.Train25T[4]; rw1 = BZData.Train25T[5]; } else if (trainType == ECommTrainType.绿皮车25B) { yz0 = BZData.Train25B[0]; yz1 = BZData.Train25B[1]; yw0 = BZData.Train25B[2]; yw1 = BZData.Train25B[3]; rw0 = BZData.Train25B[4]; rw1 = BZData.Train25B[5]; } //设置数据的值 int yz = 0, yw = 0, rw = 0; int oldyz = int.Parse(this.yz1.Text); int oldyw = int.Parse(this.yw1.Text); int dianche = int.Parse(Request.QueryString["hasDianChe"]); for (int i = 2; i <= 5; i++) { this.GetRandom(totalBianZhu, yz0, yz1, yw0, yw1, rw0, rw1, oldyz, oldyw, out yz, out yw); rw = totalBianZhu - dianche - yz - yw; 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; t1.Text = yz + ""; t2.Text = yw + ""; t3.Text = rw + ""; } }
//计算空调费 public override double GetKongTiaoFee(ECommTrainType traintype, ECommCheXian chexian1) { if (this.hasdata == false) { double fee1 = base.GetKongTiaoFee(traintype, chexian1); return(fee1 + JMath.Round1(fee1 * ShangFuRate, 0)); } else { return(this.KtFee); } }
//设置票价和满员 private void SetPriceAndPerson() { TicketPrice ticket = new TicketPrice(); int traintype1 = int.Parse(Request.QueryString["TrainType"]); ETrainType traintype = (ETrainType)traintype1; ECommTrainType type1 = (ECommTrainType)((int)traintype); int yunxingLiCheng = int.Parse(this.totalmiles.Value); TrainShouRu1 shour1 = null; if (traintype == ETrainType.绿皮车25B) { shour1 = new TrainShouRu1(yunxingLiCheng, false, EJiaKuai.其他); } else { shour1 = new TrainShouRu2(yunxingLiCheng, EJiaKuai.特快); } //设置票价 this.p1.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + ""; this.p2.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + shour1.YinWoPrice1 + ""; this.p3.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + shour1.YinWoPrice2 + ""; this.p4.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + shour1.YinWoPrice3 + ""; this.p5.Value = shour1.RuanZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.软卧) + shour1.JiaKuaiFee + shour1.RuanWoPrice1 + ""; this.p6.Value = shour1.RuanZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.软卧) + shour1.JiaKuaiFee + shour1.RuanWoPrice2 + ""; //设置定员 this.m1.Value = ChexianBianZhuData.YinZuo_Pcount + ""; this.m2.Value = (ChexianBianZhuData.YinWo1_Pcount + ChexianBianZhuData.YinWo2_Pcount + ChexianBianZhuData.YinWo3_Pcount) + ""; this.m3.Value = (ChexianBianZhuData.RuanWo1_Pcount + ChexianBianZhuData.RuanWo2_Pcount) + ""; this.m4.Value = TrainProfile.SyCheXianPCount + ""; }
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() + ""; }