public void GenProducts() { int num = 1; proset = new ProductSet(); foreach (Train t in tt) { foreach (StopStation ss in t.StaList) { for (int i = t.StaList.IndexOf(ss); i < t.StaList.Count - 1; i++) { Product p = new Product() { ProID = num++, StartStation = ss.StationName, EndStation = t.StaList[i + 1].StationName, Train = t }; double f = 0; for (int j = t.StaList.IndexOf(ss) + 1; j <= i + 1; j++) { f += (t.StaList[j].MileStone - t.StaList[j - 1].MileStone) * Math.Pow(settings.PriceDeclineRatio, j - t.StaList.IndexOf(ss) - 1); } p.Fare = f * t.PriceRatio; for (int j = t.StaList.IndexOf(ss); j < i + 1; j++) { //p.Add(t.SecList[j]); } proset.Add(p); } } } }
private void GenPro() { DataTable Pro = _ds.Tables["Pro"]; proset = new ProductSet(); foreach (DataRow dr in Pro.Rows) { Product p = new Product() { ProID = Convert.ToInt32(dr["ID"]), Description = dr["Des"].ToString(), Fare = Convert.ToDouble(dr["Fare"]) }; string s = dr["Res"].ToString(); foreach (string ss in s.Split(',')) { Resource temp = ResSet.Find(i => i.ResID == Convert.ToInt32(ss)); if (temp != null) { p.Add(temp); } } proset.Add(p); } }
public virtual void AddProduct(IProduct product) { _products.Add((Product)product, ((Product)product).SetShape); }
public virtual void AddProduct(IProduct product) { _products.Add((Product)product, ((Product)product).SetBrand); }
public virtual void AddProduct(IProduct product) { _products.Add((Product)product, ((Product)product).AddRoute); }