public void Execute() { if (this._receiver.AddToStorage(this.prod, this.Quantity)) { AddCommandEvent?.Invoke(this, new StorageEventArgs($"На склад {this._receiver} поступил товар {this.prod.Name} {DateTime.Now}", this._receiver.StorageName, this.prod, Quantity, DateTime.Now, StorageEventArgs.EventType.AddingProduct)); } else { Console.ForegroundColor = ConsoleColor.Red; WrongProductAdding?.Invoke(this, new StorageEventArgs(string.Format("На склад {0} попытались загрузить товар неподходящего типа {1} {2}", this._receiver.StorageName, this.prod.Name, DateTime.Now), _receiver.StorageName, prod, Quantity, DateTime.Now, StorageEventArgs.EventType.AddingWrongProduct)); Console.ResetColor(); } }
protected virtual void Add() { AddCommandEvent?.Invoke(); }