Пример #1
0
 public ListaTowarow()
 {
     string[] lines = System.IO.File.ReadAllLines(@"towar.txt");
     foreach (string line in lines)
     {
         string[] tow = line.Split(new string[] { " " }, StringSplitOptions.None);
         if (tow.Length == 2)
         {
             Towar tt = new Towar();
             tt.producent = tow[0];
             tt.nazwa     = tow[1];
             towary.Add(tt);
         }
     }
 }
Пример #2
0
        //private List<Towar> tow = new List<Towar>();


        public Hurtownia(int Id)
        {
            lock (tow)
            {
                id = Id;
                double a = Program.rand.Next(10, 30);
                robocizna = 1 + (a / 100);
                Console.WriteLine("Robocizna: " + robocizna);
                for (int i = 0; i < ListaTowarow.towary.Count(); i++)
                {
                    int rnd = Program.rand.Next(0, 100);
                    if (rnd < 70)
                    {
                        Towar      t  = ListaTowarow.towary[i];
                        TowarInfor ti = new TowarInfor();
                        ti.cena  = Program.rand.Next(1, 100);
                        ti.ilosc = Program.rand.Next(1, 10);

                        tow.Add(t, ti);
                    }
                }
            }
        }