public void AddWorker(LocalWorker workerToAdd) { Workers.Add(workerToAdd); workerToAdd.WorkingCompany = this; workerToAdd.DaysInCompany = 0; WorkerAdded?.Invoke(workerToAdd); #if DEVELOPMENT_BUILD || UNITY_EDITOR string debugInfo = string.Format("[{3}] Worker added to company\nName {0} {1}\nID {2}\n", workerToAdd.Name, workerToAdd.Surename, workerToAdd.ID, this.GetType().Name); Debug.Log(debugInfo); #endif }
public void AddWorker(WorkerView work, byte[] hashedpass) { 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}."); } try { workers.Open(); } catch (RepositoryOpenFailedExceptiom e) { log.Exception(e, "Failed on tring to add user."); log.Fetal("Fetal Error, App shuting down."); Shutdown(1); } Worker w = ViewConverter.CreateWorker(work); try { w.Password = SHA256.Create().ComputeHash(hashedpass); workers.Add(w); workers.Close(); WorkerAdded?.Invoke(this, work); } catch (DAL.Repositorys.PrimeryKeyAllReadyExistException e) { log.Exception(e); throw new util.PrimeryKeyAllReadyExistException(); }catch (RepositorySaveFailedExceptiom e) { log.Exception(e, "Failed on tring to add user."); log.Fetal("Fetal Error, App shuting down."); Shutdown(1); } catch (Exception e) { log.Exception(e); log.Fetal("Fetal Error Closing down app..."); Shutdown(1); } }
public void AddWorker(LocalWorker projectWorker) { projectWorker.AssignedProject = this; this.Workers.Add(projectWorker); WorkerAdded?.Invoke(projectWorker); #if DEVELOPMENT_BUILD || UNITY_EDITOR string debugInfo = string.Format( "[{5}] Worker added to 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 }