예제 #1
0
        public void AddAccount(Account account)
        {
            if (account.Name == null) // check account name for null
            {
                throw new ArgumentNullException(account.Name, "Name can't be null");
            }

            if (!MyDb.AddData(account.Save(), account.Name, "Account")) // check account name for exist
            {
                throw new ArgumentException("This account name already exists");
            }
        }
예제 #2
0
 public void AddShopLot(ShopLot lot)
 {
     if (GetShopLot(lot.Name) != null)
     {
         var temp = lot.Save();
         if (temp.Length > DataForWrappers.MaxSizeOfShopLot)
         {
             throw new ArgumentException("Image too large");
         }
         bool result = MyDb.AddData(temp, lot.Name, "ShopLot");
         if (!result)
         {
             throw new ArgumentException("Goods is already exists");
         }
     }
     else
     {
         throw new ArgumentNullException(lot.Name);
     }
 }