public ActionResult Edit() { string userId = User.Identity.GetUserId(); Observee observee = db.Observees.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); return(View(observee)); }
public ActionResult Index() { string currentUserId = User.Identity.GetUserId(); Observee user = db.Observees.Where(c => c.ApplicationUserId == currentUserId).FirstOrDefault(); return(View(user)); }
public void MarkAsCollected(string name) { Observee o = observeeDict[name]; o.SendRight(); o.SetIsCollected(true); }
public ActionResult ChangeObserver(ApplicationUser model) { var user = db.Users.Where(u => u.UserName == model.UserName).FirstOrDefault(); if (user == null) { ViewBag.ObserverMessage = "That UserName does not exist in the database."; return(View()); } else { var userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); var roles = userManager.GetRoles(user.Id); if (roles[0].Equals("Observer")) { string userId = User.Identity.GetUserId(); Observee observee = db.Observees.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); Observer observer = db.Observers.Where(o => o.ApplicationUserId == user.Id).FirstOrDefault(); observee.ObserverId = observer.id; db.SaveChanges(); ViewBag.ObserverMessage = "That user has been added as your Observer."; return(RedirectToAction("Index")); } return(View()); } }
public ActionResult ViewSavedRoutes() { string id = User.Identity.GetUserId(); Observee observee = db.Observees.Where(e => e.ApplicationUserId == id).FirstOrDefault(); List <SavedRoute> routes = db.SavedRoutes.Where(e => e.ObserveeId == observee.id).ToList(); return(View(routes)); }
public ActionResult AddCustomAvoidance(AvoidanceRouteViewModel newRoute) { AvoidanceRoute routeToAdd = new AvoidanceRoute(); string userId = User.Identity.GetUserId(); Observer observer = db.Observers.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); newRoute.id = int.Parse(newRoute.ObserveeId); Observee observee = db.Observees.Where(o => o.id == newRoute.id).FirstOrDefault(); float NWLong; float NWLat; float SELong; float SELat; float startlat = newRoute.BottomRightLatitude; float startlong = newRoute.BottomRightLongitude; float stoplat = newRoute.TopLeftLatitude; float stoplong = newRoute.TopLeftLongitude; if (startlat < stoplat && startlong < stoplong) { NWLat = stoplat; NWLong = startlong; SELat = startlat; SELong = stoplong; } else if (startlat > stoplat && startlong < stoplong) { NWLat = startlat; NWLong = startlong; SELat = stoplat; SELong = stoplong; } else if (startlat > stoplat && startlong > stoplong) { NWLat = startlat; NWLong = stoplong; SELat = stoplat; SELong = startlong; } else { NWLat = stoplat; NWLong = stoplong; SELat = startlat; SELong = startlong; } routeToAdd.BottomRightLatitude = SELat; routeToAdd.BottomRightLongitude = SELong; routeToAdd.TopLeftLatitude = NWLat; routeToAdd.TopLeftLongitude = NWLong; routeToAdd.Reason = newRoute.Reason; routeToAdd.RouteName = newRoute.Name; routeToAdd.ObserveeId = observee.id; routeToAdd.ObserverId = observer.id; db.AvoidanceRoutes.Add(routeToAdd); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult LeaveComment() { LocationComment comment = new LocationComment(); string userId = User.Identity.GetUserId(); Observee observee = db.Observees.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); comment.ApplicationUserId = observee.ApplicationUserId; return(View(comment)); }
void OnTriggerEnter2D(Collider2D other) { Debug.Log("something enters the submitted drawing"); if (other.gameObject.CompareTag("Observee") && canSubmit) { Observee ob = other.gameObject.GetComponent <Observee>(); dialogueManager.MakeChoice(ob.choiceIndex); canSubmit = false; observeeManager.ClearAll(); } }
public ActionResult Details() { string userId = User.Identity.GetUserId(); Observee observee = db.Observees.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); observee.ApplicationUser = db.Users.Find(userId); observee.Observer = db.Observers.Where(e => e.id == observee.ObserverId).FirstOrDefault(); string appId = observee.Observer.ApplicationUserId; observee.Observer.ApplicationUser = db.Users.Where(e => e.Id == appId).FirstOrDefault(); return(View(observee)); }
public ActionResult Create(Observee userToAdd) { string currentUserId = User.Identity.GetUserId(); userToAdd.ApplicationUserId = currentUserId; if (ModelState.IsValid) { db.Observees.Add(userToAdd); db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Edit(Observee observee) { string userId = User.Identity.GetUserId(); Observee user = db.Observees.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); if (ModelState.IsValid) { user.FirstName = observee.FirstName; user.LastName = observee.LastName; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(observee)); }
public ActionResult RouteComplete() { routeComplete = true; string id = User.Identity.GetUserId(); Observee observee = db.Observees.Where(e => e.ApplicationUserId == id).FirstOrDefault(); string Message = observee.FirstName + " " + observee.LastName + " has completed their route safely!"; List <string> phoneNumbers = db.PhoneNumbers.Where(e => e.ObserverId == observee.ObserverId).Select(e => e.Number).ToList(); foreach (string x in phoneNumbers) { SendAlert.Send(Message, x); } return(RedirectToAction("Index")); }
public ActionResult RemoveObserver(ApplicationUser model) { string userId = User.Identity.GetUserId(); Observee observee = db.Observees.Where(o => o.ApplicationUserId == userId).FirstOrDefault(); Observer observer = db.Observers.Where(o => o.ApplicationUser.UserName == model.UserName).FirstOrDefault(); if (observer == null) { ViewBag.RemoveObserverMessage = "That Observer UserName is not associated with your account."; return(View("ChangeObserver")); } else { observee.ObserverId = null; db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult PanicButton(int?id) { Observee panicObservee = db.Observees.Find(id); Observer guardian = db.Observers.Where(o => o.id == panicObservee.ObserverId).FirstOrDefault(); Geolocation geo = new Geolocation(); ViewBag.PanicMessage = panicObservee.FirstName + " " + panicObservee.LastName + " has pushed the Panic Alert button. Their location is: " + geo.Retrieve(); try { var phoneNumbers = db.PhoneNumbers.Where(p => p.ObserverId == guardian.id).ToList(); foreach (var number in phoneNumbers) { SendAlert.Send(ViewBag.PanicMessage, number.Number); } } catch { return(View()); } return(View()); }
public void Show() { Settings.SetEarthBased(); Console.WriteLine(Observer.Name + ": Rise and set times for celestial body " + Observee.ToString() + "\n"); DateTime date = TimeFrom; //while (date <= TimeTo) //{ KeplerianCoordinates keplerianCoordinates = new KeplerianCoordinates { Origin = Body.Earth, CoordinateFrame = Frame.EME2000, Depth = KeplerianDepth.PlaneOnly, }; CoordinatesNeeded coordinatesNeeded = new CoordinatesNeeded { Keplerian = true, Cartesian = false, }; CartesianCoordinates cartesianCoordinates = new CartesianCoordinates { Origin = Body.Sun, CoordinateFrame = Frame.EME2000, }; CartesianCoordinates moonCartesianCoordinates = new CartesianCoordinates { Origin = Body.Moon, CoordinateFrame = Frame.EME2000, }; KeplerianCoordinates moonKeplerianCoordinates = new KeplerianCoordinates { Origin = Body.Moon, CoordinateFrame = Frame.EME2000, }; Coordinates earthCoordinates = new Coordinates { Body = Body.Earth, CoordinatesNeeded = coordinatesNeeded, KeplerianCoordinates = keplerianCoordinates, //CartesianCoordinates = new List<CartesianCoordinates> //{ // cartesianCoordinates, //} }; Coordinates sunCoordinates = new Coordinates { Body = Body.Sun, CoordinatesNeeded = coordinatesNeeded, //KeplerianCoordinates = keplerianCoordinates, CartesianCoordinates = new List <CartesianCoordinates> { cartesianCoordinates, } }; Coordinates moonCoordinates = new Coordinates { Body = Body.Moon, CoordinatesNeeded = coordinatesNeeded, KeplerianCoordinates = moonKeplerianCoordinates, CartesianCoordinates = new List <CartesianCoordinates> { moonCartesianCoordinates, } }; List <Coordinates> coordinatesSet = new List <Coordinates> { earthCoordinates, //moonCoordinates, //sunCoordinates, }; State state = new State { Body = Body.Sun, Epoch = date, CoordinatesSet = coordinatesSet, }; //Earth.GetHelioCentricKeplerianElements(date, keplerianCoordinates); //keplerianCoordinates.ArgPer = 0; //keplerianCoordinates.Origin = null; //StateRetriever.GetHelioCentricKeplerianElements(Body.Earth, date, keplerianCoordinates); //Start testing this one //coordinates.KeplerianCoordinates = null; //StateRetriever.GetHelioCentricState(date, moonCoordinates); StateRetriever.GetState(state); //DefaultState defaultState = Sun.GetDefaultState(); //defaultState = null; //defaultState = Earth.GetDefaultState(date); //defaultState = CelestialBodies.GetDefaultState(Body.Sun, date); //stateRetriever.GetBodyCentricState(); //stateRetriever.GetHelioCentricState(Depth.Position); //State bodyState = new State //{ // Epoch = date, // Coordinates = new Coordinates() // { // //Type = Generic.CoordinateType.TopoCentric, // TopoCentricCoordinates = new TopoCentricCoordinates // { // Location = Observer.GeocentricCoordinates, // LocalFrame = Frame.ENU, // }, // } //}; //Observee.GetState(bodyState); //} }
public ActionResult Create() { Observee user = new Observee(); return(View(user)); }