public void RemoveWorker(LocalWorker workerToRemove) { Workers.Remove(workerToRemove); workerToRemove.WorkingCompany = null; if (null != workerToRemove.AssignedProject) { workerToRemove.AssignedProject.RemoveWorker(workerToRemove); } WorkerRemoved?.Invoke(workerToRemove); #if DEVELOPMENT_BUILD || UNITY_EDITOR string debugInfo = string.Format("[{3}] Worker removed from company\nName {0} {1}\nID {2}\n", workerToRemove.Name, workerToRemove.Surename, workerToRemove.ID, this.GetType().Name); Debug.Log(debugInfo); #endif }
public void RemoveWorker(LocalWorker projectWorker) { projectWorker.AssignedProject = null; this.Workers.Remove(projectWorker); WorkerRemoved?.Invoke(projectWorker); #if DEVELOPMENT_BUILD || UNITY_EDITOR string debugInfo = string.Format( "[{5}] Worker removed from project\n" + "PROJECT -------------------\n" + "Name: {0}\n" + "ID: {1}\n" + "WORKER -------------------\n" + "Name: {2} {3}\n" + "ID: {4}", this.Name, this.ID, projectWorker.Name, projectWorker.Surename, projectWorker.ID, this.GetType().Name); Debug.Log(debugInfo); #endif }
public void RemoveWorker(int id) { if (!IsUserLoggedIn) { throw new UserLoggedInException(); } if (currentUser.WorkerRank != WorkerView.Rank.Manager) { throw new UserAccessException($"{WorkerView.Rank.Manager} Access needed for that action, your Access is {currentUser.WorkerRank}."); } Worker worker; try { workers.Open(); }catch (RepositoryOpenFailedExceptiom e) { log.Exception(e, "Failed on tring to update a user."); log.Fetal("Fetal Error, App shuting down."); Shutdown(1); } if (workers.RemoveById(id, out worker)) { try { workers.Close(); } catch (RepositorySaveFailedExceptiom e) { log.Exception(e, "Failed on tring to get user."); log.Fetal("Fetal Error, App shuting down."); Shutdown(1); } WorkerRemoved?.Invoke(this, ViewConverter.CreateWorkerView(worker)); } }