/// <summary> /// 得到车厢类型的整体票价率 /// </summary> /// <param name="type1"></param> /// <returns></returns> private static double GetCheXianFeeTotalRate(ECommCheXian type1) { double d1 = 0; CommChexianRateAndPersonCount rp1 = GetCheXianFeeRateAndPersonCount(type1); d1 = (rp1.Rate1 / 100d) * rp1.PersonCount1 + (rp1.Rate2 / 100d) * rp1.PersonCount2 + (rp1.Rate3 / 100d) * rp1.PersonCount3; return(d1); }
/// <summary> /// 得到车厢的满员人数 /// </summary> /// <param name="type1"></param> /// <returns></returns> private static int GetCheXianTotalPerson(ECommCheXian type1) { int d1 = 0; CommChexianRateAndPersonCount rp1 = GetCheXianFeeRateAndPersonCount(type1); d1 = rp1.PersonCount1 + rp1.PersonCount2 + rp1.PersonCount3; return(d1); }
/// <summary> /// 得到车厢类型的票价率和满员人数 /// </summary> /// <param name="type1"></param> /// <returns></returns> private static CommChexianRateAndPersonCount GetCheXianFeeRateAndPersonCount(ECommCheXian type1) { CommChexianRateAndPersonCount rp1 = new CommChexianRateAndPersonCount(); JTable tab1 = new JTable("CheXianBianZhu"); List <SearchField> condition = new List <SearchField>(); if (type1 == ECommCheXian.硬座) { condition.Add(new SearchField("kind", "YinZuo")); } else if (type1 == ECommCheXian.软座) { condition.Add(new SearchField("kind", "RuanZuo")); } else if (type1 == ECommCheXian.开放式硬卧) { condition.Add(new SearchField("(kind='YinWo1' or kind='YinWo2' or kind='YinWo3')", "", SearchOperator.UserDefine)); } else if (type1 == ECommCheXian.包房式硬卧) { condition.Add(new SearchField("(kind='YinWo4' or kind='YinWo5')", "", SearchOperator.UserDefine)); } else if (type1 == ECommCheXian.软卧) { condition.Add(new SearchField("(kind='RuanWo1' or kind='RuanWo2')", "", SearchOperator.UserDefine)); } else if (type1 == ECommCheXian.高级软卧) { condition.Add(new SearchField("(kind='GaoJiRuanWo1' or kind='GaoJiRuanWo2')", "", SearchOperator.UserDefine)); } tab1.OrderBy = "kind"; DataSet ds1 = tab1.SearchData(condition, -1, "*"); int i = 0; foreach (DataRow dr1 in ds1.Tables[0].Rows) { rp1.SetRate(i, int.Parse(dr1["Rate"].ToString())); rp1.SetPerson(i, int.Parse(dr1["PCount"].ToString())); i++; } tab1.Close(); return(rp1); }