Пример #1
0
        protected override Dictionary <string, object> GetSaveDataContent()
        {
            var data = base.GetSaveDataContent();

            data.Add(SaveKeyBonuses, new DictionarySaveable(Bonuses.ToDictionary(pair => (object)(int)pair.Key, pair => (object)pair.Value)));
            data.Add(SaveKeyStatBonuses, new DictionarySaveable(StatBonuses.ToDictionary(pair => (object)(int)pair.Key, pair => (object)pair.Value)));
            data.Add(SaveKeyLightPower, (int)LightPower);
            data.Add(SaveKeyDescription, Description);
            return(data);
        }
        private string ComposeReport()
        {
            var bonusByEmployeeId = Bonuses.ToDictionary(bonus => bonus.EmployeeId, bonus => bonus);

            var table = new ConsoleTable("Code", "Full name", "Bonus")
                        .Configure(options => options.EnableCount = false);

            foreach (var employeeId in bonusByEmployeeId.Keys)
            {
                var fullName = Employees.First(employee => employee.Id == employeeId).FullName;
                table.AddRow(employeeId, fullName, $"{bonusByEmployeeId[employeeId].Bonus:0.00}");
            }

            return(table.ToString());
        }