public virtual void AddMoney(CopyAutomat automat, int money) { automat.MoneyAmount += money; if (automat.MoneyAmount > automat.Cost && automat.State is InitState) { automat.State = new MoneyAddedState(); } }
public virtual int GetChange(CopyAutomat automat) { var change = automat.MoneyAmount; automat.MoneyAmount = 0; automat.State = new InitState(); automat.DeviceId = Guid.Empty; automat.DocumentId = Guid.Empty; return(change); }
public override void Print(CopyAutomat automat) { automat.MoneyAmount -= automat.Cost; //print if (automat.MoneyAmount > automat.Cost) { automat.State = new MoneyAddedState(); } else { automat.State = new InitState(); } }
public override void SelectDevice(CopyAutomat automat, Guid deviceId) { Console.WriteLine("Недостаточно средств"); }
public abstract void Print(CopyAutomat automat);
public abstract void SelectDocument(CopyAutomat automat, Guid documentId);
public abstract void SelectDevice(CopyAutomat automat, Guid deviceId);
public override void SelectDevice(CopyAutomat automat, Guid deviceId) { automat.DocumentId = Guid.Empty; automat.DeviceId = deviceId; automat.State = new DeviceSelectedState(); }
public override void SelectDocument(CopyAutomat automat, Guid documentId) { automat.DocumentId = documentId; }
public override void SelectDocument(CopyAutomat automat, Guid documentId) { automat.DocumentId = documentId; automat.State = new DocumentSelectedState(); }
public override void Print(CopyAutomat automat) { Console.WriteLine("Документ не выбран"); }
public override void SelectDevice(CopyAutomat automat, Guid deviceId) { automat.DeviceId = deviceId; }
public override void Print(CopyAutomat automat) { Console.WriteLine("Устройство не выбрано"); }
public override void SelectDocument(CopyAutomat automat, Guid documentId) { Console.WriteLine("Устройство не выбрано"); }
public override void Print(CopyAutomat automat) { Console.WriteLine("Недостаточно средств"); }
public override void SelectDocument(CopyAutomat automat, Guid documentId) { Console.WriteLine("Недостаточно средств"); }