Exemplo n.º 1
0
 public void Buy(Person buyer, double summ)
 {
     if ((buyer.Balance >= summ))
     {
         for (int j = 0; j < summ / DefaultPrice; j++)
         {
             buyer.PersonalShares.Add(new Share(DefaultPrice));
             Shares.RemoveAt(Shares.Count - 1);
         }
         buyer.Balance -= summ;
         CountShares   -= summ / DefaultPrice;
     }
 }
Exemplo n.º 2
0
 public void SaveChanges(Share share)
 {
     SaveChanges <Share>(share);
     for (int i = 0; i < Shares.Count; i++)
     {
         if (Shares[i].Identifier == share.Identifier)
         {
             Shares.RemoveAt(i);
             Shares.Insert(i, share);
             return;
         }
     }
     Shares.Add(share);
 }