예제 #1
0
        public bool RemoveWorker()
        {
            Workers.Sort(new Comparison <Worker>((a, b) => a.Stamina.CompareTo(b.Stamina)));
            Worker weakest = Workers.First();

            return(Workers.Remove(weakest));
        }
예제 #2
0
 public void Evacuate()
 {
     while (Workers.Count > 0)
     {
         Workers.First().LeaveCurrentBuilding();
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
 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));
 }
예제 #5
0
        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;
        }
예제 #6
0
 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"));
     }
 }
예제 #7
0
 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"));
     }
 }