public static void HW_Park() { g_bAtHome = false; g_bAtPark = false; g_dTargetAz = g_dSetPark; g_eSlewing = Going.slewPark; }
public static void HW_Move(double Az) { g_bAtHome = false; g_bAtPark = false; g_dTargetAz = Az; g_eSlewing = Going.slewSomewhere; }
public static void HW_FindHome() { g_bAtHome = false; g_bAtPark = false; g_dTargetAz = g_dSetHome; g_eSlewing = Going.slewHome; }
public void AddOrRemoveGoing(int eventid, string currentuserid) { Going NewGoing = new Going(); Going Temp = new Going(); NewGoing.EventId = eventid; NewGoing.UserId = currentuserid; Temp = _context.Goings.FirstOrDefault(a => a.EventId == eventid && a.UserId == currentuserid); var IfContainsEditorEvent = _context.EditorPickEvents.FirstOrDefault(a => a.EventId == eventid); if (Temp != null) //ako postoji onda mičemo par { _context.Goings.Remove(Temp); _context.Events.FirstOrDefault(a => a.Id == eventid).NumberOfAttenders--; //smanjujemo broj posjetitelja za 1 if (IfContainsEditorEvent != null) { IfContainsEditorEvent.NumberOfAttenders--; } } else { _context.Goings.Add(NewGoing); //ako ne postoji onda dodajemo par _context.Events.FirstOrDefault(a => a.Id == eventid).NumberOfAttenders++; //uvećavamo broj posjetitelja za 1 if (IfContainsEditorEvent != null) { IfContainsEditorEvent.NumberOfAttenders++; } } _context.SaveChanges(); }
public IActionResult Leave(int id) { Going RetrievedGoing = dbContext.Goings.SingleOrDefault(Going => Going.GoingId == id); dbContext.Goings.Remove(RetrievedGoing); dbContext.SaveChanges(); return(Redirect("/home")); }
private void Start() { if (destination != null) { agent.destination = destination.position; } if (walkingAnimator != null) { StartCoroutine(RefreshingAnimationState()); } state = Going.ToDestination; }
public IActionResult NotGoing(int Id) { User currUser = _context.User.SingleOrDefault(c => c.UserId == HttpContext.Session.GetInt32("user_id")); if (currUser != null) { Going notGoing = _context.Going.SingleOrDefault(x => x.Event_Id == Id && x.User_Id == currUser.UserId); if (notGoing != null) { _context.Going.Remove(notGoing); _context.SaveChanges(); } return(RedirectToAction("Dashboard")); } else { return(Redirect("/")); } }
public IActionResult Join(int id) { int? cu = HttpContext.Session.GetInt32("logID"); int CurrUser = cu ?? default(int); Plan RetrievedPlan = dbContext.Plans.SingleOrDefault(Plan => Plan.PlanId == id); if (CurrUser == RetrievedPlan.CreatedBy) { return(Redirect("/home")); } else { Going newGoing = new Going(); newGoing.UserId = CurrUser; newGoing.PlanId = id; dbContext.Goings.Add(newGoing); dbContext.SaveChanges(); return(Redirect("/home")); } }
public IActionResult Going(int Id) { User currUser = _context.User.SingleOrDefault(c => c.UserId == HttpContext.Session.GetInt32("user_id")); if (currUser != null) { Events thisEvent = _context.Event.Include(x => x.Going).ThenInclude(x => x.user).SingleOrDefault(x => x.Id == Id); Going newCommer = new Going() { User_Id = currUser.UserId, Event_Id = Id }; _context.Going.Add(newCommer); _context.SaveChanges(); return(RedirectToAction("Dashboard")); } else { return(RedirectToAction("Index")); } }
public static void HW_Halt() { g_dTargetAlt = g_dDomeAlt; g_eSlewing = Going.slewNowhere; // clear home / park (state is fragile in standard) if (g_bStandardAtPark) { g_bAtPark = false; } if (g_bStandardAtHome) { g_bAtHome = false; } // If the shutter is in motion, then cause it to jam if (g_dOCProgress > 0) { g_dOCProgress = 0; g_eShutterState = ShutterState.Error; } }
public ViewResult MeetingDetails(int id) { Meeting meeting = SessionService.DbContainer.Resolve <MeetingDataManager>().GetById(id); var model = new MeetingsDetailsModel(); model.MeetingId = id; Country country = SessionService.DbContainer.Resolve <CountrysDataManager>().GetById(meeting.CountryId); model.CountryCode = country == null?"":country.Code; RaceCourse raceCourse = SessionService.DbContainer.Resolve <RacecourseDataManager>().GetById(meeting.RaceCourseId); model.RaceCourseCode = raceCourse == null?"":raceCourse.Code;; model.Date = meeting.MeetingDate.ToShortDateString(); Weather weather = SessionService.DbContainer.Resolve <WeatherDataManager>().GetById(meeting.WeatherId); model.WeatherName = weather == null?"":weather.Name; Going going = SessionService.DbContainer.Resolve <GoingDataManager>().GetById(meeting.DefaultGoingId); model.GoingName = going == null?"":going.Name; model.DayNight = model.CountryCode.Contains("HK")?((meeting.HK_isNightMeet != null && (bool)meeting.HK_isNightMeet)?MeetingType.nigth.ToString():MeetingType.day.ToString()):string.Empty; CourseVariant courseVariant = SessionService.DbContainer.Resolve <CourseVariantDataManager>().GetById(meeting.CourseVariantId); model.CourseVariantName = courseVariant == null?"":courseVariant.Name; model.NumberOfRaces = SessionService.DbContainer.Resolve <MeetingDataManager>().GetById(id).NumberOfRaces; model.Races = SessionService.DbContainer.Resolve <RaceDataManager>().GetByMeetingId(id); return(View("Details", model)); }
public static void HW_Sync(double Az) { g_eSlewing = Going.slewNowhere; g_dTargetAz = Az; g_dDomeAz = g_dTargetAz; // Handle standard (fragile) and non-standard park/home changes if (g_bStandardAtHome) { g_bAtHome = false; // Fragile (standard) } else { g_bAtHome = HW_AtHome;// Position (non-standard) } if (g_bStandardAtPark) { g_bAtPark = false; // Fragile (standard) } else { g_bAtPark = HW_AtPark;// Position (non-standard) } }
public static void HW_Run(bool Dir) { g_bAtHome = false; g_bAtPark = false; g_eSlewing = Dir ? Going.slewCW : Going.slewCCW; }
private static void OnTimedEvent(Object source, ElapsedEventArgs e) { double slew; double distance; // Azimuth slew simulation if (g_eSlewing != Going.slewNowhere) { slew = g_dAzRate * TIMER_INTERVAL; if (g_eSlewing > Going.slewCW) { distance = g_dTargetAz - g_dDomeAz; if (distance < 0) { slew = -slew; } if (distance > 180) { slew = -slew; } if (distance < -180) { slew = -slew; } } else { distance = slew * 2; slew = slew * (int)g_eSlewing; } // Are we there yet ? if (System.Math.Abs(distance) < System.Math.Abs(slew)) { g_dDomeAz = g_dTargetAz; // Handle standard (fragile) and non-standard park/home changes if (g_bStandardAtHome) { if (g_eSlewing == Going.slewHome) { g_bAtHome = true; // Fragile (standard) } } else { g_bAtHome = HW_AtHome;// Position (non-standard) } if (g_bStandardAtPark) { if (g_eSlewing == Going.slewPark) { g_bAtPark = true; // Fragile (standard) } } else { g_bAtPark = HW_AtPark;// Position (non-standard) } g_eSlewing = Going.slewNowhere; } else { g_dDomeAz = AzScale(g_dDomeAz + slew); } } // shutter altitude control simulation if ((g_dDomeAlt != g_dTargetAlt)) { slew = g_dAltRate * TIMER_INTERVAL; distance = g_dTargetAlt - g_dDomeAlt; if (distance < 0) { slew = -slew; } // Are we there yet ? if (System.Math.Abs(distance) < System.Math.Abs(slew)) { g_dDomeAlt = g_dTargetAlt; } else { g_dDomeAlt = g_dDomeAlt + slew; } } // shutter open/close simulation if (g_dOCProgress > 0) { g_dOCProgress = g_dOCProgress - TIMER_INTERVAL; if (g_dOCProgress <= 0) { if (g_eShutterState == ShutterState.Opening) { g_eShutterState = ShutterState.Open; } else { g_eShutterState = ShutterState.Closed; } } } /*if (g_dDomeAz == INVALID_COORDINATE) * this.txtDomeAz.Text = "---.-"; * else * this.txtDomeAz.Text = Format(AzScale(g_dDomeAz), "000.0"); * // Shutter = g_dDomeAlt * if (g_dDomeAlt == INVALID_COORDINATE | !g_bCanSetShutter) * this.txtShutter.Text = "----"; * else * switch (g_eShutterState) * { * case object _ when ShutterState.shutterOpen: * { * if (g_bCanSetAltitude) * this.txtShutter.Text = Format(g_dDomeAlt, "0.0"); * else * this.txtShutter.Text = "Open"; * break; * } * * case object _ when ShutterState.shutterClosed: * { * this.txtShutter.Text = "Closed"; * break; * } * * case object _ when ShutterState.shutterOpening: * { * this.txtShutter.Text = "Opening"; * break; * } * * case object _ when ShutterState.shutterClosing: * { * this.txtShutter.Text = "Closing"; * break; * } * * case object _ when ShutterState.shutterError: * { * this.txtShutter.Text = "Error"; * break; * } * }*/ }