private string MakeLobbyTitle(string lobbyTitle) { lobbyTitle = WorkshopRepository.GetLobbyTitle(lobbyTitle); sbInformationStrings.Length = 0; sbInformationStrings.AppendFormat("{0}: {1}", sLocalisedStrings[5], lobbyTitle); return(sbInformationStrings.ToString()); }
public ActionResult UpdateRepair(RepairView repair) { var workshopRepo = new WorkshopRepository(); workshopRepo.UpdateRepair(repair); return(Ok()); }
private RagdollModel BindToSkin(WorkshopItemMetadata wsMeta) { if (wsMeta == null) { return(null); } RagdollModelMetadata ragdollModelMetadata = wsMeta as RagdollModelMetadata; if (ragdollModelMetadata != null) { RagdollModel component; if (ragdollModelMetadata.modelPrefab == null) { AssetBundle assetBundle = WorkshopRepository.LoadBundle(ragdollModelMetadata); string[] allAssetNames = assetBundle.GetAllAssetNames(); GameObject original = assetBundle.LoadAsset(ragdollModelMetadata.model) as GameObject; component = UnityEngine.Object.Instantiate(original).GetComponent <RagdollModel>(); assetBundle.Unload(unloadAllLoadedObjects: false); } else { component = UnityEngine.Object.Instantiate(ragdollModelMetadata.modelPrefab.gameObject).GetComponent <RagdollModel>(); } component.meta = ragdollModelMetadata; component.BindToRagdoll(ragdoll); component.texture.LoadFromPreset(preset); return(component); } return(null); }
public ActionResult <IEnumerable <RepairView> > GetRepairJobs() { var workshopRepo = new WorkshopRepository(); var repairs = workshopRepo.GetRepairs(); if (repairs is null) { return(NotFound()); } return(Ok(repairs)); }
public ActionResult TakeRepairJob(RepairView repair) { var workshopRepo = new WorkshopRepository(); if (repair is null) { return(NotFound()); } workshopRepo.UpdateRepair(repair); return(Ok()); }
public ActionResult <IEnumerable <RepairLogView> > GetRepairLogs(long repairID) { var workshopRepo = new WorkshopRepository(); var logs = workshopRepo.GetRepairLogs(repairID); if (logs is null) { return(NotFound()); } return(Ok(logs)); }
public void Initialize() { instance = this; dlc.Init(); LoadBuiltinModels(); LoadBuiltinLevels(); ReloadLocalModels(); ReloadLocalPresets(); RefreshSubscriptions(); presetRepo.MigrateLegacySkin(); Dependencies.OnInitialized(this); }
public ActionResult <IEnumerable <AutoView> > GetAutomobiles() { var workshopRepo = new WorkshopRepository(); var autos = workshopRepo.GetAutomobiles(); if (autos is null) { return(NotFound()); } else { return(Ok(autos)); } }
public ActionResult ValidateClientEmail(string m) { var workshopRepo = new WorkshopRepository(); var autos = workshopRepo.ValidateClientEmail(m); if (!autos) { return(NotFound(false)); } else { return(Ok(true)); } }
public ActionResult <IEnumerable <ClientView> > GetClients() { var workshopRepo = new WorkshopRepository(); var clients = workshopRepo.GetClients(); if (clients is null) { return(NotFound()); } else { return(Ok(clients)); } }
public ActionResult ValidatePlate(string plate) { var workshopRepo = new WorkshopRepository(); var autos = workshopRepo.ValidatePlate(plate); if (!autos) { return(NotFound(false)); } else { return(Ok(true)); } }
public ActionResult <IEnumerable <ManagerView> > GetManagers() { var repo = new WorkshopRepository(); var bonuses = repo.GetManagers(); if (bonuses is null) { return(NotFound()); } else { return(Ok(bonuses)); } }
public ActionResult <IEnumerable <TechnicianView> > GetTechniciansByRepairID(long repairID) { var workshopRepo = new WorkshopRepository(); var techs = workshopRepo.GetTechniciansByRepairID(repairID); if (techs is null) { return(NotFound()); } else { return(Ok(techs)); } }
public ActionResult <IEnumerable <RepairView> > GetRepairs(long techID) { var workshopRepo = new WorkshopRepository(); var techs = workshopRepo.GetRepairsByTechnicianID(techID); if (techs is null) { return(NotFound()); } else { return(Ok(techs)); } }
public ActionResult AddRepairLog(RepairLogView log) { var workshopRepo = new WorkshopRepository(); if (workshopRepo.GetRepairLogs().SingleOrDefault(rl => rl.Id == log.Id) != null) { return(Ok()); } var repairRepo = workshopRepo.GetRepairs(); log.Repair = repairRepo.Single(r => r.Id == log.Repair.Id); workshopRepo.AddRepairLog(log); return(Ok()); }
public ActionResult ValidateUser(UserView u) { var repo = new WorkshopRepository().GetUsers(); var result = (from users in repo where u.isManager == true && users.Username == u.Username && System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(users.Password)) == u.Password select users).FirstOrDefault(); if (result is null) { return(NotFound(false)); } else { return(Ok(true)); } }
public ActionResult RegisterClient(ClientView client) { var workshopRepo = new WorkshopRepository(); var clients = workshopRepo.GetClients(); if (clients is null) { return(NotFound()); } else if (clients.Contains(client)) { return(Ok("Already registered.")); } else { workshopRepo.RegisterClient(client); return(Ok()); } }
public ActionResult UpdateRepairLog(RepairLogView log) { var workshopRepo = new WorkshopRepository(); RepairLogView found = workshopRepo.GetRepairLogs(log.Repair.Id).SingleOrDefault(rl => rl.Id == log.Id); if (found is null) { workshopRepo.AddRepairLog(log); } else { found.Date = DateTime.Today; found.Description = log.Description; found.TechnicianId = log.TechnicianId; workshopRepo.UpdateRepairLog(found); } return(Ok()); }
private String AllWorkshopsData() { XMLBuilder allWorkshopsXml = new XMLBuilder("workshops"); WorkshopRepository repository = this.WorkshopManager().GetWorkshopRepository(); List <String> ids = repository.GetIds(); foreach (String id in ids) { Workshop workshop = repository.GetWorkshop(id); allWorkshopsXml.AddBelowParent("workshop"); allWorkshopsXml.AddAttribute("id", workshop.GetID()); allWorkshopsXml.AddAttribute("name", workshop.GetName()); allWorkshopsXml.AddAttribute("status", workshop.GetStatus()); allWorkshopsXml.AddAttribute("duration", workshop.GetDurationAsString()); } return(this._catalogApp.GetFormattedData(allWorkshopsXml.ToString())); }
public void executeActionAndGetResponseTest_ALL_WORKSHOPS() { List <Workshop> workshops = new List <Workshop> { new Workshop("HELLO", "OPEN", "2018/08") }; var repository = new WorkshopRepository() { _workshops = workshops }; var target = new CatalogApp(); target.workshopManager = new WorkshopManager() { Repository = repository }; var expectedString = "<workshop name='HELLO' status='OPEN' duration='2018/08'/>"; var actual = target.executeActionAndGetResponse(CatalogApp.ALL_WORKSHOPS, null); Assert.AreEqual(actual.Builder.ToString(), expectedString); Assert.AreEqual(actual.ALlWorkshopsStylesheet, CatalogApp.ALL_WORKSHOPS_STYLESHEET); }
static void Main(string[] args) { //creeaza workshop var workshop = WorkshopFactory.Instance.CreeazaWorkshop("Vector"); var repository = new WorkshopRepository(); repository.AdaugaWorkshop(workshop); //inscrie firma - gresit se poate adauga firma in doua workshopuri, //crearea obiecului firma ar trebui sa fie facuta intern in model (aici firma este o entitate) workshop.InscrieFirma(WorkshopFactory.Instance.CreeazaFirma("10", "Autoliv")); workshop.InscrieFirma(WorkshopFactory.Instance.CreeazaFirma("11", "Continental")); workshop.InscrieFirma(WorkshopFactory.Instance.CreeazaFirma("12", "Hella")); //inscrierea aceleias firme arunca exceptie workshop.IncepeWorkshop(); //pret activitate workshop.NoteazaActivitateFirma(new Modele.Generic.IdParticipare("10"), new Modele.Generic.Pret(5)); workshop.NoteazaActivitateFirma(new Modele.Generic.IdParticipare("11"), new Modele.Generic.Pret(5)); workshop.NoteazaActivitateFirma(new Modele.Generic.IdParticipare("12"), new Modele.Generic.Pret(5)); var pretPachet = new Dictionary <Modele.Generic.IdParticipare, Modele.Generic.Pret>(); pretPachet.Add(new IdParticipare("10"), new Pret(30)); workshop.TrecePretPachet(pretPachet); pretPachet.Add(new IdParticipare("11"), new Pret(40)); workshop.TrecePretPachet(pretPachet); pretPachet.Add(new IdParticipare("12"), new Pret(30)); workshop.TrecePretPachet(pretPachet); workshop.IncheieWorkshop(); repository.ActualizeazaWorkshop(workshop); Console.WriteLine("Press any key to terminate"); Console.ReadLine(); }
public override void OnGotFocus() { titleText.text = ScriptLocalization.Get((!NetGame.isServer) ? "MULTIPLAYER/LOBBY.TitleClient" : ((!NetGame.friendly) ? "MULTIPLAYER/LOBBY.TitleServerPublic" : "MULTIPLAYER/LOBBY.TitleServer")); bool flag = NetGame.instance.transport.CanSendInvite(); inviteButton.gameObject.SetActive(flag); selectLevelButton.gameObject.SetActive(NetGame.isServer); startGameButton.gameObject.SetActive(NetGame.isServer); settingsButton.gameObject.SetActive(NetGame.isServer); WorkshopRepository.instance.LoadBuiltinLevels(); RebindLevel(); RebindSettings(); defaultElement = (NetGame.isServer ? startGameButton.gameObject : ((!flag) ? leaveButton.gameObject : inviteButton.gameObject)); base.OnGotFocus(); if (NetGame.isServer) { lobbyText.text = string.Format("{0}\n<size=75%>{1}</size>", ScriptLocalization.Get("WORKSHOP/SelectLobbyLevel"), WorkshopRepository.GetLobbyTitle(App.instance.GetLobbyTitle())); } selectLobbyButton.gameObject.SetActive(NetGame.isServer); informationBox.gameObject.SetActive(!NetGame.isServer); NetGame.instance.transport.RegisterForLobbyData(OnLobbyDataUpdate); }
public WorkshopController() { _WorkshopRepository = new WorkshopRepository(); }
private IEnumerator EnterLobbyAsync(bool asServer, Action callback = null) { NetScope.ClearAllButPlayers(); object obj = stateLock; Monitor.Enter(obj); try { state = ((!asServer) ? AppSate.ClientLoadLobby : AppSate.ServerLoadLobby); SuspendDeltasForLoad(); Game.instance.HasSceneLoaded = false; string sceneName = null; if (Game.multiplayerLobbyLevel < 128) { sceneName = WorkshopRepository.GetLobbyFilename(Game.multiplayerLobbyLevel); goto IL_01fb; } bool loaded = false; WorkshopLevelMetadata workshopLevel = null; WorkshopRepository.instance.levelRepo.LoadLevel(Game.multiplayerLobbyLevel, delegate(WorkshopLevelMetadata l) { workshopLevel = l; loaded = true; }); while (!loaded) { yield return(null); } if (workshopLevel != null) { lobbyAssetbundle = FileTools.LoadBundle(workshopLevel.dataPath); string[] allScenePaths = lobbyAssetbundle.GetAllScenePaths(); sceneName = Path.GetFileNameWithoutExtension(allScenePaths[0]); StopPlaytimeForItem(previousLobbyID); StartPlaytimeForItem(workshopLevel.workshopId); previousLobbyID = workshopLevel.workshopId; goto IL_01fb; } if (NetGame.isServer) { goto IL_01fb; } SubtitleManager.instance.ClearProgress(); UnityEngine.Debug.Log("Level load failed."); instance.ServerFailedToLoad(); SignalManager.EndReset(); goto end_IL_0055; IL_01fb: if (string.IsNullOrEmpty(sceneName)) { sceneName = WorkshopRepository.GetLobbyFilename(0uL); Game.multiplayerLobbyLevel = 0uL; } AsyncOperation loader = SceneManager.LoadSceneAsync(sceneName); if (loader != null) { while (!loader.isDone || !Game.instance.HasSceneLoaded) { yield return(null); } } if (state != AppSate.ServerLoadLobby && state != AppSate.ClientLoadLobby) { UnityEngine.Debug.Log("Exiting wrong app state (" + state.ToString() + ")"); } state = ((!asServer) ? AppSate.ClientLobby : AppSate.ServerLobby); ResumeDeltasAfterLoad(); if (!RatingMenu.instance.ShowRatingMenu()) { MenuSystem.instance.ShowMainMenu <MultiplayerLobbyMenu>(); } Game.instance.state = GameState.Inactive; UpdateJoinable(); callback?.Invoke(); if (queueAfterLevelLoad != null) { Action action = queueAfterLevelLoad; queueAfterLevelLoad = null; if (NetGame.netlog) { UnityEngine.Debug.Log("Executing queue"); } action(); } if (lobbyAssetbundle != null) { lobbyAssetbundle.Unload(unloadAllLoadedObjects: false); lobbyAssetbundle = null; } Game.instance.FixAssetBundleImport(lobby: true); end_IL_0055 :; } finally { } }
static void Main(string[] args) { /* * Onderstaande code dient uitlsuitend als referentie. Er zijn meerdere (betere) oplossingen denkbaar. * Dit is code die je later in unittests zal plaatsen. */ // EF Code plaatsen we in een eigen class. Deze noemen we een repository. StudentRepository studentRepository = new StudentRepository(); WorkshopRepository workshopRepository = new WorkshopRepository(); DepartmentRepository departmentRepository = new DepartmentRepository(); Console.WriteLine("***** Students *****"); var students = studentRepository.GetStudents(); foreach (var student in students) { Console.WriteLine($"{student.Firstname} {student.Lastname} \t- email: {student.Email}"); } // Opdracht 2.1 Console.WriteLine(); Console.WriteLine("***** Workshops *****"); var workshops = workshopRepository.WorkshopInformation(); foreach (var workshop in workshops) { Console.WriteLine($"Workshop: {workshop.Name} Aantal registraties: {workshop.Registrations.Count}"); foreach (var teacher in workshop.Teachers) { Console.WriteLine($"\tTeacher: {teacher.Fullname}"); } foreach (var registration in workshop.Registrations) { Console.WriteLine($"\tStudent: {registration.Student.Fullname}"); } } Console.WriteLine(); Console.WriteLine("***** Student met Workshop *****"); // Opdracht 2.2 // We halen de eerste Workshop op vanuit de lijst die we al in het geheugen hebben. var ws = workshops.First(); Student s = new Student { Email = "*****@*****.**", Firstname = "Sjaak", Lastname = "Student" }; Registration r = new Registration { Student = s, Workshop = ws }; try { studentRepository.AddStudentWithWorkShop(r); Console.WriteLine($"Student {r.Student.Fullname} is bewaard en ingeschreven voor {r.Workshop.Name}"); } catch (Exception ex) { // Beter om je eigen Exception class te maken Console.WriteLine(ex.Message); } // Opdracht 2.3 Console.WriteLine(); Console.WriteLine("***** Workshops zonder Registratie *****"); int numWorkshops = workshopRepository.DeleteWorkshopWithoutRegistration(); Console.WriteLine($"{numWorkshops} workshops zijn verwijderd omdat er geen registratie is gekoppeld. De overgebleven workshops zijn: "); var ovgWorkshops = workshopRepository.GetWorkshops(); foreach (var workshop in workshops) { Console.WriteLine($"Workshop: {workshop.Name}"); } // Opdracht 2.4 Console.WriteLine(); Console.WriteLine("***** Budgetverhoging *****"); var departments = departmentRepository.BudgetIncrease(10); foreach (var department in departments) { Console.WriteLine($"Departement: {department.Name} heeft nu een budget van {department.Budget} euro"); } // Opdracht 2.5 Console.WriteLine(); Console.WriteLine("***** Teacher Wissel *****"); foreach (var workshop in workshops) { Console.WriteLine($"Workshop: {workshop.Name}"); foreach (var teacher in workshop.Teachers) { Console.WriteLine($"\tTeacher: {teacher.Fullname} - ID: {teacher.Id}"); } } Console.Write("Geef het ID van de teacher die wil ruilen: "); var teacherFrom = Convert.ToInt32(Console.ReadLine()); Console.Write("Geef het ID van de teacher met wie wordt geruild: "); var teacherTo = Convert.ToInt32(Console.ReadLine()); var geruild = workshopRepository.SwapTeachers(teacherFrom, teacherTo); if (geruild) { Console.WriteLine("De teachers zijn omgewisseld"); } else { Console.WriteLine("Geen teachers omgewisseld, controleer de ID van de teachers"); } // Opdracht 2.6 Console.WriteLine(); Console.WriteLine("***** Studenten aantallen *****"); Tuple <int, int> t = studentRepository.StudentenMetEnZonderRegistratie(); Console.WriteLine($"Studenten met registratie: {t.Item1} - Zonder registratie: {t.Item2}"); // Einde programma Console.WriteLine(); Console.Write("Press a key to exit"); Console.ReadLine(); }