Exemplo n.º 1
0
        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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public virtual void AddProduct(IProduct product)
 {
     _products.Add((Product)product, ((Product)product).SetShape);
 }
Exemplo n.º 4
0
 public virtual void AddProduct(IProduct product)
 {
     _products.Add((Product)product, ((Product)product).SetBrand);
 }
Exemplo n.º 5
0
 public virtual void AddProduct(IProduct product)
 {
     _products.Add((Product)product, ((Product)product).AddRoute);
 }