public static void LoadJobs() { foreach (var job in ContextFactory.Instance.Job) { JobController jobController = new JobController(job); jobController.CreateWorldEntity(); } API.shared.consoleOutput("[GM] Loaded jobs: " + ContextFactory.Instance.Job.Count()); }
public void createjob(Client player, JobType type, int Level, string IDOrName = null) { AccountController account = player.getData("ACCOUNT"); if (account == null) { return; } if (!AdminController.AdminRankCheck("createproperty", account)) { return; } Groups.GroupController groupController = null; if (IDOrName != null) { groupController = EntityManager.GetGroup(player, IDOrName); if (groupController == null) { player.sendChatMessage("~r~ERROR: ~w~You specified an invalid group."); return; } } Data.Job jobData = new Data.Job(); JobController jobController = new JobController(jobData); jobController.Group = groupController; // _JobData.GroupID = (_GroupController == null ? null : _GroupController._GroupData.GroupID); if (groupController == null) { jobData.GroupId = null; } else { jobData.GroupId = groupController.Group.Id; } jobData.Type = type; jobData.PosX = player.position.X; jobData.PosY = player.position.Y; jobData.PosZ = player.position.Z; jobData.Level = Level; ContextFactory.Instance.Job.Add(jobData); ContextFactory.Instance.SaveChanges(); jobController.CreateWorldEntity(); player.sendChatMessage("~g~Server: ~w~ Added job: " + jobController.Type()); }