namespace ConsoleApp1
{
public class Program
{
static void Main(string[] args)
{
}
}
public class Equipment
{
private readonly int inventoryNumber;
private string name;
private decimal dailyRate;
public int InventoryNumber { get { return inventoryNumber; } }
public string Name { get { return name; } set {
if (string.IsNullOrWhiteSpace(value))
throw new Exception("Имя оборудования не может быть пустым");
else
name = value;
} }
public decimal DailyRate { get { return dailyRate; } set {
if (!isAvailable)
throw new Exception("Пока оборудование выдано, изменять суточную стоимость нельзя");
else if (value <= 0)
throw new Exception("Значение суточной стоимости не может быть меньше или равно нулю");
else
dailyRate = value;
}
}
public int CurrentRentalDays { get; private set; }
public bool isAvailable { get
{
if (CurrentRentalDays == 0)
{
return true;
}
return false;
}
}
}
}