public bool RemoveWorker() { Workers.Sort(new Comparison <Worker>((a, b) => a.Stamina.CompareTo(b.Stamina))); Worker weakest = Workers.First(); return(Workers.Remove(weakest)); }
public void Evacuate() { while (Workers.Count > 0) { Workers.First().LeaveCurrentBuilding(); } }
public Colonist RemoveWorker() { if (Workers.Count == 0) { throw new GameException($"No worker on {this.GetType().Name}"); } var worker = Workers.First(); Workers.Remove(worker); return(worker); }
public override string ToString() { return(string.Format( "Job: {0} ({1}), Worker: {2}, Tool: {3}, locationZone: {4}, Start: {5}, End: {6}", Job.ID, Job.Duration, Workers == null ? -1 : Workers.First().Resource.ID, Tools == null ? -1 : Tools.First().Resource.ID, LocationZone == null ? -1 : LocationZone.Resource.ID, Start, End)); }
internal void Edit(Worker worker) { WorkerSQL.Update(worker.Id, worker.PersNum, worker.FullName, worker.Birthday, worker.HiringDay, worker.Salary, worker.ProfArea, worker.Gender); Worker updateWorker = Workers.First(d => d.Id == worker.Id); updateWorker.PersNum = worker.PersNum; updateWorker.FullName = worker.FullName; updateWorker.Birthday = worker.Birthday; updateWorker.HiringDay = worker.HiringDay; updateWorker.Salary = worker.Salary; updateWorker.ProfArea = worker.ProfArea; updateWorker.Gender = worker.Gender; }
public ActionResult Delete(Worker model) { if (User.Identity.Name != "admin") { TempData["NoAdmin"] = string.Format("У вас немає прав адміністратора"); return(RedirectToAction("Index")); } else { Worker entityObject = Workers.First(e => e.Id == model.Id); Workers.Remove(entityObject); StaticDataContext.Save(); return(RedirectToAction("Index")); } }
public ActionResult Edit(WorkerEditingModel model) { if (User.Identity.Name != "admin") { TempData["NoAdmin"] = string.Format("У вас немає прав адміністратора"); return(RedirectToAction("Index")); } else { if (!ModelState.IsValid) { ViewBag.Post = CreatePostNameSelectList(model.Post); return(View(model)); } var entityObject = Workers.First(e => e.Id == model.Id); UpdateEntityModel(entityObject, model); StaticDataContext.Save(); TempData["Message"] = string.Format( "Зміни даних працівника \"{0}\" збережено", model.Name); return(RedirectToAction("Index")); } }