示例#1
0
        public void AddGoodToList(object parameter)
        {
            GoodNameToAdd.Trim();

            StringBuilder SB = new StringBuilder();

            if (GoodNameToAdd == "")
            {
                SB.Remove(0, SB.Length);
                SB.Append("Write the name of product.");
                throw new ArgumentException(SB.ToString());
            }

            if (GoodCostToAdd < 0)
            {
                SB.Remove(0, SB.Length);
                SB.Append("Write valid cost.");
                throw new ArgumentException(SB.ToString());
            }

            if (GoodCostToAdd > Money)
            {
                return;
            }


            SB.Remove(0, SB.Length);
            SB.Append("Good ");
            SB.Append(GoodNameToAdd);
            SB.Append(" is added");

            Goods.AddGood(GoodNameToAdd,
                          GoodCostToAdd, CurrentID);
            CurrentID++;
            SummaryCost += GoodCostToAdd;
            Money       -= GoodCostToAdd;
        }
示例#2
0
 public Shop()
 {
     goods = new Goods();
     goods.AddGood(new Good("Сапоги женский", 150, 200, 10));
     fixedCosts = new FixedCosts();
 }