public void CountEmployees() { Console.Clear(); Console.WriteLine("Count workers:" + " " + Workers.Count() + "\nCount managers: " + " " + Managers.Count() + "\nCount taskmasters:" + " " + Taskmasters.Count()); var sum = Workers.Count() + Managers.Count() + Taskmasters.Count(); Console.WriteLine("\nAll employees" + " " + sum); }
} // кол-во уволенных работников public Stub() { Workers = Init.InitWorkers(); Cars = Init.InitCars(); DayliIncome = 10000d + Init.rand.NextDouble() * (50000d - 10000d); AmountDayliRepairs = Cars.Count(car => car.RepairCompletionDate == DateTime.Today);; AmountNewCars = Cars.Count(car => car.RepairAcceptanceDate == DateTime.Today); AmountNewClients = Init.rand.Next(0, AmountNewCars); AmountNewWorkers = Workers.Count(w => w.DateOfEmployment == DateTime.Today); AmountFiredWorkers = Workers.Count(w => w.DateOfDismissal == DateTime.Today); }
public string Print() { var enumerable = Enumerable .Range(0, Map.SizeY) .Select( y => { var strings = Enumerable .Range(0, Map.SizeX) .Select( x => { var p = new V(x, Map.SizeY - y - 1); if (Map[p] == CellState.Obstacle) { return("#"); } var wCount = Workers.Count(w => w.Position == p); if (wCount != 0) { return(wCount.ToString()); } if (Workers.Any(w => w.Manipulators.Any(m => w.Position + m == p && Map.IsReachable(w.Position, w.Position + m)))) { return("-"); } if (Workers.Any(w => w.Manipulators.Any(m => w.Position + m == p))) { return("!"); } var booster = Boosters.FirstOrDefault(b => b.Position == p); if (booster != null) { return(booster.ToString()[0].ToString()); } if (Map[p] == CellState.Void) { return("."); } return("*"); }) .ToArray(); return(string.Join("", strings)); }); return(string.Join("\n", enumerable)); }
/// <summary> /// Редактирование информации о сотруднике /// </summary> private void EditByIndex() { if (Workers.Count == 0) { WriteLine("База пуста. Нажмите любую клавишу длz возврата в меню"); ReadKey(); return; } Clear(); WriteLine(ToString()); WriteLine("Редактирование информации о сотруднике. Введите индекс сотрудника"); int index = InputInt(); while (index < 0 || index >= Workers.Count()) { WriteLine("Неверный индекс. Повторите ввод: "); index = InputInt(); } WriteLine("Выберите свойство, которое хотите изменить:"); var propertiesToEdit = new List <PropertyInfo>(); int des = GetAndSelectWorkerProperty(out propertiesToEdit); WriteLine("Введите новое значение: "); var editingWorker = Workers[index]; if (propertiesToEdit[des].PropertyType == typeof(int)) { int intValue = InputInt(); propertiesToEdit[des].SetValue(editingWorker, intValue); } else { string strValue = ReadLine(); if (propertiesToEdit[des].Name == "Departament") { DoWithDepartment(editingWorker.Departament, x => x.WorkersAmount--); AddWorkersDepartament(strValue); } propertiesToEdit[des].SetValue(editingWorker, strValue); } }
public void PrintStoreInfo() { Console.WriteLine($"{Address}, # of Employees {Workers.Count()}"); var idsGreaterThan10 = Workers.Where(worker => worker.Id > 10); }