public void Initialise(PlayerReader playerReader, RequirementFactory requirementFactory, ILogger logger) { Pull.Initialise(playerReader, requirementFactory, logger); Combat.Initialise(playerReader, requirementFactory, logger); Adhoc.Initialise(playerReader, requirementFactory, logger); Parallel.Initialise(playerReader, requirementFactory, logger); ShapeshiftForm.ForEach(i => i.Initialise(playerReader, requirementFactory, logger)); Interact.Key = InteractKey; Interact.Initialise(playerReader, requirementFactory, logger); if (string.IsNullOrEmpty(Blink.Key)) { Blink.Key = " "; } Blink.Initialise(playerReader, requirementFactory, logger); TargetLastTarget.Key = TargetLastTargetKey; TargetLastTarget.Initialise(playerReader, requirementFactory, logger); GatherFindKeys.ForEach(key => { GatherFindKeyConfig.Add(new KeyAction { Key = key }); GatherFindKeyConfig.Last().Initialise(playerReader, requirementFactory, logger); }); }
public IActionResult Edit(int?id, Adhoc ticket) { if (id == null) { return(NotFound()); } string userId = null; // When user id is unavailable, display user as "Anomymous" if (User.Identity.Name == null || User.Identity.Name == "" || User.Identity.Name == "Anomymous user") { userId = "Anomymous"; } else { userId = User.Identity.Name; } if (ModelState.IsValid) { // When status is changed by analyst to closed/cancelled, update analyst id (whoever closed the ticket) if (ticket.Status == "Closed" || ticket.Status == "Cancelled") { Adhoc oticket = new Adhoc { ID = ticket.ID, Status = ticket.Status, SupportAnalyst = userId, Details = ticket.Details, Type = ticket.Type }; oticket.CompletedDate = System.DateTime.Now; _contextAdhoc.Entry(oticket).Property("CompletedDate").IsModified = true; _contextAdhoc.Entry(oticket).Property("Status").IsModified = true; _contextAdhoc.Entry(oticket).Property("SupportAnalyst").IsModified = true; _contextAdhoc.Entry(oticket).Property("Details").IsModified = true; _contextAdhoc.Entry(oticket).Property("Type").IsModified = true; } else { Adhoc oticket = new Adhoc { ID = ticket.ID, Status = ticket.Status, SupportAnalyst = userId, Details = ticket.Details, Type = ticket.Type }; _contextAdhoc.Entry(oticket).Property("Status").IsModified = true; _contextAdhoc.Entry(oticket).Property("SupportAnalyst").IsModified = true; _contextAdhoc.Entry(oticket).Property("Details").IsModified = true; _contextAdhoc.Entry(oticket).Property("Type").IsModified = true; } _contextAdhoc.SaveChanges(); TempData["message"] = "Person edited!"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "There has been errors"); return(View(ticket)); }
public void Initialise(PlayerReader playerReader, RequirementFactory requirementFactory, ILogger logger) { Pull.Initialise(playerReader, requirementFactory, logger); Combat.Initialise(playerReader, requirementFactory, logger); Adhoc.Initialise(playerReader, requirementFactory, logger); Parallel.Initialise(playerReader, requirementFactory, logger); ShapeshiftForm.ForEach(i => i.Initialise(playerReader, requirementFactory, logger)); Interact.Key = InteractKey; Interact.Initialise(playerReader, requirementFactory, logger); Blink.Initialise(playerReader, requirementFactory, logger); }
//Method responsible for rounting to ticket edit page public IActionResult Edit(int?id) { if (id == null) { return(NotFound()); } Adhoc ticket = _contextAdhoc.Adhocs.SingleOrDefault(x => x.ID == id); if (ticket == null) { return(NotFound()); } return(View(ticket)); }
//Method responsible for deletion of the ticket public IActionResult Delete(int?id) { if (id == null) { return(NotFound()); } Adhoc ticket = _contextAdhoc.Adhocs.SingleOrDefault(x => x.ID == id); if (ticket == null) { return(NotFound()); } _contextAdhoc.Remove(ticket); _contextAdhoc.SaveChanges(); TempData["message"] = "Ticket Deleted!"; return(RedirectToAction("Index")); }
public IActionResult Create(Adhoc ticket) { if (ModelState.IsValid) { ticket.SubmittedDate = System.DateTime.Now; ticket.Status = "Submitted"; ticket.RequestorID = User.Identity.Name == null ? "Anomymous" : User.Identity.Name; ticket.requestLocation = city; ticket.latitute = latitude; ticket.longtitude = longtitude; _contextAdhoc.Add(ticket); _contextAdhoc.SaveChanges(); TempData["message"] = "Ticket Created!"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "There has been errors"); return(View(ticket)); }
public void Initialise(DataConfig dataConfig, AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger, string?overridePathProfileFile) { SpiritPathFilename = string.Empty; Interact.Key = InteractKey; Interact.Name = "Interact"; Interact.WaitForGCD = false; Interact.DelayAfterCast = 0; Interact.PressDuration = 30; Interact.Initialise(addonReader, requirementFactory, logger); Approach.Key = InteractKey; Approach.Name = "Approach"; Approach.WaitForGCD = false; Approach.DelayAfterCast = 0; Approach.PressDuration = 10; Approach.Cooldown = 150; Approach.Initialise(addonReader, requirementFactory, logger); AutoAttack.Key = InteractKey; AutoAttack.Name = "AutoAttack"; AutoAttack.WaitForGCD = false; AutoAttack.DelayAfterCast = 0; AutoAttack.Initialise(addonReader, requirementFactory, logger); StopAttack.PressDuration = 10; InitializeKeyActions(Pull, Interact, Approach, AutoAttack); InitializeKeyActions(Combat, Interact, Approach, AutoAttack); logger.LogInformation("[Form] Initialise KeyActions."); Form.ForEach(i => i.InitialiseForm(addonReader, requirementFactory, logger)); Pull.Initialise("Pull", addonReader, requirementFactory, logger); Combat.Initialise("Combat", addonReader, requirementFactory, logger); Adhoc.Initialise("Adhoc", addonReader, requirementFactory, logger); NPC.Initialise("AdhocNpc", addonReader, requirementFactory, logger); Parallel.Initialise("Parallel", addonReader, requirementFactory, logger); Jump.Key = JumpKey; Jump.Initialise(addonReader, requirementFactory, logger); TargetLastTarget.Key = TargetLastTargetKey; TargetLastTarget.Initialise(addonReader, requirementFactory, logger); StandUp.Key = StandUpKey; StandUp.Initialise(addonReader, requirementFactory, logger); ClearTarget.Key = ClearTargetKey; ClearTarget.Initialise(addonReader, requirementFactory, logger); StopAttack.Key = StopAttackKey; StopAttack.Initialise(addonReader, requirementFactory, logger); TargetNearestTarget.Key = TargetNearestTargetKey; TargetNearestTarget.Initialise(addonReader, requirementFactory, logger); TargetPet.Key = TargetPetKey; TargetPet.Initialise(addonReader, requirementFactory, logger); TargetTargetOfTarget.Key = TargetTargetOfTargetKey; TargetTargetOfTarget.Initialise(addonReader, requirementFactory, logger); PetAttack.Key = PetAttackKey; PetAttack.PressDuration = 10; PetAttack.Initialise(addonReader, requirementFactory, logger); Mount.Key = MountKey; Mount.Initialise(addonReader, requirementFactory, logger); GatherFindKeys.ForEach(key => { GatherFindKeyConfig.Add(new KeyAction { Key = key }); GatherFindKeyConfig.Last().Initialise(addonReader, requirementFactory, logger); }); OverridePathFilename = overridePathProfileFile; if (!string.IsNullOrEmpty(OverridePathFilename)) { PathFilename = OverridePathFilename; } if (!File.Exists(Path.Join(dataConfig.Path, PathFilename))) { if (!string.IsNullOrEmpty(OverridePathFilename)) { throw new Exception($"The `{OverridePathFilename}` path file does not exists!"); } else { throw new Exception($"The loaded class config contains not existing `{PathFilename}` path file!"); } } CheckConfigConsistency(logger); }
public void Initialise(DataConfig dataConfig, PlayerReader playerReader, RequirementFactory requirementFactory, ILogger logger, string?overridePathProfileFile) { SpiritPathFilename = string.Empty; Interact.Key = InteractKey; Interact.Name = "Interact"; Interact.Initialise(playerReader, requirementFactory, logger); Approach.Key = InteractKey; Approach.Name = "Approach"; Approach.Initialise(playerReader, requirementFactory, logger); AutoAttack.Key = InteractKey; AutoAttack.Name = "AutoAttack"; AutoAttack.DelayAfterCast = 0; AutoAttack.Initialise(playerReader, requirementFactory, logger); InitializeKeyActions(Pull, Interact, Approach, AutoAttack); InitializeKeyActions(Combat, Interact, Approach, AutoAttack); Pull.Initialise(playerReader, requirementFactory, logger); Combat.Initialise(playerReader, requirementFactory, logger); Adhoc.Initialise(playerReader, requirementFactory, logger); NPC.Initialise(playerReader, requirementFactory, logger); Parallel.Initialise(playerReader, requirementFactory, logger); ShapeshiftForm.ForEach(i => i.Initialise(playerReader, requirementFactory, logger)); Jump.Key = JumpKey; Jump.Initialise(playerReader, requirementFactory, logger); TargetLastTarget.Key = TargetLastTargetKey; TargetLastTarget.Initialise(playerReader, requirementFactory, logger); StandUp.Key = StandUpKey; StandUp.Initialise(playerReader, requirementFactory, logger); ClearTarget.Key = ClearTargetKey; ClearTarget.Initialise(playerReader, requirementFactory, logger); StopAttack.Key = StopAttackKey; StopAttack.Initialise(playerReader, requirementFactory, logger); TargetNearestTarget.Key = TargetNearestTargetKey; TargetNearestTarget.Initialise(playerReader, requirementFactory, logger); TargetPet.Key = TargetPetKey; TargetPet.Initialise(playerReader, requirementFactory, logger); TargetTargetOfTarget.Key = TargetTargetOfTargetKey; TargetTargetOfTarget.Initialise(playerReader, requirementFactory, logger); PetAttack.Key = PetAttackKey; PetAttack.Initialise(playerReader, requirementFactory, logger); GatherFindKeys.ForEach(key => { GatherFindKeyConfig.Add(new KeyAction { Key = key }); GatherFindKeyConfig.Last().Initialise(playerReader, requirementFactory, logger); }); OverridePathFilename = overridePathProfileFile; if (!string.IsNullOrEmpty(OverridePathFilename)) { PathFilename = OverridePathFilename; } if (!File.Exists(Path.Join(dataConfig.Path, PathFilename))) { if (!string.IsNullOrEmpty(OverridePathFilename)) { throw new Exception($"The `{OverridePathFilename}` path file does not exists!"); } else { throw new Exception($"The loaded class config contains not existing `{PathFilename}` path file!"); } } }
public IActionResult Post(string id, BookingCreateViewModel viewmodel) { IBooking booking = viewmodel.booking; booking.id = id; // Die Liste der Standorte wird aus dem Cache geladen. List <ILocation> locations = (List <ILocation>)cache.Get(CacheKeys.LOCATION); if (locations == null) { locations = new List <ILocation>(); } // Sollte der Benutzer kein ASSISTANCE sein wird seine E-Mail als die E-Mail des Benutzers gestzt. if (booking.priority == UserType.EMPLOYEE && !this.HttpContext.Session.GetString("role").Equals(UserType.PLANER.ToString())) { booking.user = this.HttpContext.Session.GetString("email"); } // Filtern des richtigen Standorts aus der Liste der Standorte. booking.location = locations.Find(x => x.id.Equals(viewmodel.locationId)); // Befüllen der Liste an Stecker, welche zum Auto des Benutzers passen. List <PlugType> plugs = new List <PlugType>(); if (viewmodel.ccs) { plugs.Add(PlugType.CCS); } if (viewmodel.type2) { plugs.Add(PlugType.TYPE2); } booking.plugs = plugs; bool test = ModelState.IsValid; // Validierung der Buchung, bei Fehlschlag wird an die Create Methode weitergeleited. if (!TryValidateModel(booking, nameof(booking))) { return(RedirectToAction("Create", "Booking", booking)); } // Die Buchungen werden aus dem Cache geladen. var cacheKey = CacheKeys.BOOKING; if (!cache.TryGetValue(cacheKey, out bookings)) { bookings = new List <IBooking>(); } // Im Edit Fall wird die Buchung, welche editiert wurde entfernt. foreach (Booking b in bookings) { if (b.id.Equals(booking.id)) { if (!this.HttpContext.Session.GetString("role").Equals(UserType.ASSISTANCE.ToString())) { booking.priority = b.priority; booking.user = b.user; } bookings.Remove(b); break; } } // Sollte der Benutzer eine Adhoc Buchung vornehmen und VIP sein, wird diese erstellt befüllt, verteilt, dem Cache hinzugefügt und es wird zur Index Methode weitergeleited. if (booking.startTime.Date == DateTime.Now.Date) { if (booking.priority != UserType.VIP) { return(RedirectToAction("Create", "Booking", booking)); } Adhoc adhoc = new Adhoc(false) { capacity = booking.capacity, plugs = booking.plugs, socStart = booking.socStart, socEnd = booking.socEnd, user = booking.user, startTime = booking.startTime, endTime = booking.endTime, active = booking.active, location = booking.location, priority = booking.priority }; bookings.Add(adhoc); cache.Set(cacheKey, bookings); adhoc.triggerBookingDistribution(); return(RedirectToAction("Index", "Booking")); } // Hinzufügen der Buchung zum Cache. bookings.Add(booking); cache.Set(cacheKey, bookings); return(RedirectToAction("Index", "Booking")); }