public void NextScene() { DeactivateCurrentChapter(); TrainingEvent evt = new TrainingEvent(TrainingEvent.restart); EventManager.instance.dispatchEvent(evt); }
public TrainingEventDto(TrainingEvent trainingEvent) { Id = trainingEvent.Id; Title = trainingEvent.Title; StartTimeAsUtc = trainingEvent.StartTimeAsUtc; ImageUrl = trainingEvent.ImageUrl; Description = Description; Location = new TrainingEventLocationDto() { City = trainingEvent.Location.City, Country = trainingEvent.Location.Country, State = trainingEvent.Location.State, Location = new GeoLocationDto() { Latitude = trainingEvent.Location.LatLon.Coordinates.Latitude, Longitude = trainingEvent.Location.LatLon.Coordinates.Longitude } }; AvailableSeats = trainingEvent.AvailableSeats.Select(a => new AvailableSeatDto() { SeatId = a.SeatId }); LastUpdated = trainingEvent.LastModified; CreatedOn = trainingEvent.CreatedOn; }
/// <summary> /// Test whether there are any Events remaining in this EventReader. /// </summary> /// <returns> /// true if this EventReader has more Events /// </returns> public virtual bool HasNext() { while (mNextEvent == null && mDataReader.HasNext()) { mNextEvent = CreateEvent(mDataReader.NextToken()); } return(mNextEvent != null); }
private void OnRestart() { OptionPanel.SetActive(false); GlobalSceneState.Instance.DeactivateCurrentChapter(); TrainingEvent evt = new TrainingEvent(TrainingEvent.restart); EventManager.instance.dispatchEvent(evt); }
public async Task <ActionResult> DeleteConfirmed(int id) { TrainingEvent trainingEvent = await db.Events.FindAsync(id); db.Events.Remove(trainingEvent); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
/// <summary> /// Constructor sets up the training event reader based on a stream of training data. /// </summary> /// <param name="dataReader"> /// Stream of training data. /// </param> public BasicEventReader(ITrainingDataReader <string> dataReader) { mContext = new BasicContextGenerator(); mDataReader = dataReader; if (mDataReader.HasNext()) { mNextEvent = CreateEvent(mDataReader.NextToken()); } }
public virtual TrainingEvent ReadNextEvent() { var nextToken = _dataReader.NextToken(); // split on tab var parts = nextToken.Split('\t'); var isInvalid = parts.Last() == "1"; var type = isInvalid ? "INV" : "OK"; var email = parts.First(); var nextEvent = new TrainingEvent(type, _contextGenerator.GetContext(email)); return(nextEvent); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Duration,Date,IsReady,CityId,CourseId")] TrainingEvent trainingEvent) { if (ModelState.IsValid) { db.Entry(trainingEvent).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", trainingEvent.CityId); ViewBag.CourseId = new SelectList(db.Courses, "Id", "Title", trainingEvent.CourseId); return(View(trainingEvent)); }
public TrainingEvent ReadNextEvent() { // read current email/flag var emailAndValidity = _emailsAndValidities[_currentIndex]; var type = emailAndValidity.IsInvalid ? "INV" : "OK"; var email = emailAndValidity.Email; // create event var nextEvent = new TrainingEvent(type, _contextGenerator.GetContext(email)); // increase current index _currentIndex++; return(nextEvent); }
// GET: TrainingEvents/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TrainingEvent trainingEvent = await db.Events.FindAsync(id); if (trainingEvent == null) { return(HttpNotFound()); } return(View(trainingEvent)); }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here var model = TrainingEvent.GetById(id); TryUpdateModel(model); model.SaveOrUpDate(); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: TrainingEvents/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TrainingEvent trainingEvent = await db.Events.FindAsync(id); if (trainingEvent == null) { return(HttpNotFound()); } ViewBag.Category = new SelectList(db.Categories, "Id", "Name", trainingEvent.Course.CategoryId); ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", trainingEvent.CityId); ViewBag.CourseId = new SelectList(db.Courses, "Id", "Title", trainingEvent.CourseId); return(View(trainingEvent)); }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here var model = new TrainingEvent(); TryUpdateModel(model); model.CreatedAt = DateTime.Now; model.CreatedBy = SessionItems.CurrentUser.UserID; model.Insert(); return(RedirectToAction("Index")); } catch { return(View()); } }
/// <summary> /// Returns the next Event object held in this EventReader. Each call to ReadNextEvent advances the EventReader. /// </summary> /// <returns> /// the Event object which is next in this EventReader /// </returns> public virtual TrainingEvent ReadNextEvent() { while (mNextEvent == null && mDataReader.HasNext()) { mNextEvent = CreateEvent(mDataReader.NextToken()); } TrainingEvent currentEvent = mNextEvent; if (mDataReader.HasNext()) { mNextEvent = CreateEvent(mDataReader.NextToken()); } else { mNextEvent = null; } return(currentEvent); }
public void ParseCourses() { var courses = db.Courses.ToList(); var cities = db.Cities.ToList(); foreach (DataTable table in GetDate(@"G:\Documents\Requirements\Isolutions\2015 Training Plan (2).xlsx").Tables) { foreach (DataRow row in table.Rows) { var code = int.Parse(row[0].ToString()); var date = Convert.ToDateTime(row[2].ToString().Remove(3, 3)); var TEvenet = new TrainingEvent() { CityId = cities.Single(c => c.Name == row[4].ToString()).Id, CourseId = courses.Single(c => c.Code == code).Id, Date = date, IsReady = true, Duration = int.Parse(row[3].ToString().Substring(0, 1)) }; db.Events.Add(TEvenet); } } //db.SaveChanges(); }
private bool CheckDates(TrainingItem cycle, TrainingEvent type) { bool inUpperCycle = false, intersects = false, newMacros = false, newMesos = false, newMicros = false; foreach (TrainingItem item in _items) { if (item == cycle && _items.Count == 1) { inUpperCycle = true; continue; } else if (item == cycle) continue; if (cycle.Type == TrainingEvent.Season) inUpperCycle = true; else if (cycle.Type == TrainingEvent.Macrocycle && item.Type == TrainingEvent.Season) newMacros = true; else if (cycle.Type == TrainingEvent.Mesocycle && item.Type == TrainingEvent.Macrocycle) newMesos = true; else if (cycle.Type == TrainingEvent.Microcycle && item.Type == TrainingEvent.Mesocycle) newMicros = true; if (cycle.Type == TrainingEvent.TrainingSession && item.Type == type && cycle.StartDate >= item.StartDate && cycle.StartDate < item.EndDate) inUpperCycle = true; // distingo entre sesiones y resto de ciclos, comprobando en éstas solo la fecha de inicio else if (cycle.Type != TrainingEvent.TrainingSession && item.Type == type && cycle.StartDate >= item.StartDate && cycle.EndDate <= item.EndDate) inUpperCycle = true; // en el resto de ciclos compruebo que se encuentre desde el inicio al fin dentro del ciclo superior if (item.Type == cycle.Type && item.Type != TrainingEvent.TrainingSession && cycle.StartDate <= item.EndDate && item.StartDate <= cycle.EndDate) { if (item.isValid) intersects = true; } } if (cycle.Type == TrainingEvent.Macrocycle && !newMacros) return false; if (cycle.Type == TrainingEvent.Mesocycle && !newMesos) return false; if (cycle.Type == TrainingEvent.Microcycle && !newMicros) return false; return inUpperCycle && !intersects; }
// GET: TrainingEvent/Edit/5 public ActionResult Edit(int id) { return(View(TrainingEvent.GetById(id))); }
public void ShowMenu() { TrainingEvent evt = new TrainingEvent(TrainingEvent.open_menu); EventManager.instance.dispatchEvent(evt); }
// GET: TrainingEvent public ActionResult Index() { return(View(TrainingEvent.GetAll())); }
public void HideMenu() { TrainingEvent evt = new TrainingEvent(TrainingEvent.close_menu); EventManager.instance.dispatchEvent(evt); }
public TrainingItem(DateTime startDate, DateTime endDate, TrainingEvent type) { _startDate = startDate; _endDate = endDate; _type = type; }
public static string ToString(TrainingEvent type, bool spanish) { switch (type) { case TrainingEvent.Season: return spanish? "temporada": "season"; case TrainingEvent.Macrocycle: return spanish ? "macrociclo" : "macrocycle"; case TrainingEvent.Mesocycle: return spanish ? "mesociclo" : "mesocycle"; case TrainingEvent.Microcycle: return spanish ? "microciclo" : "microcycle"; case TrainingEvent.TrainingSession: return spanish ? "sesión" : "session"; case TrainingEvent.TrainingNote: return spanish ? "nota" : "note"; } return null; }
public static bool CheckDuration(TrainingEvent type, TimeSpan newDuration, ObservableCollection<TrainingItem> items) { foreach (TrainingItem item in items) { if (item.Type == type) { if (item.EndDate.Subtract(item.StartDate) < newDuration) return false; } } return true; }
public TrainingItem(DateTime startDate, DateTime endDate, string text, TrainingEvent type) : this(startDate, endDate, type) { _barText = text; }
public void OnClickESC() { TrainingEvent evt = new TrainingEvent(TrainingEvent.auto_menu); EventManager.instance.dispatchEvent(evt); }