public bool GetOperation(byte[] buffer, int bufferLength, ref int currentBufferPosition, bool mustMatchPosition, out int token) { int originalPosition = currentBufferPosition; TrieEvaluator <Token> evaluator = new TrieEvaluator <Token>(this); TrieEvaluationDriver <Token> driver = new TrieEvaluationDriver <Token>(evaluator); if (mustMatchPosition) { bufferLength = Math.Min(bufferLength, currentBufferPosition + MaxLength); } TerminalLocation <Token> location = driver.Evaluate(buffer, bufferLength, true, 0, ref currentBufferPosition); if (location != null && (!mustMatchPosition || (currentBufferPosition - location.Terminal.Length == originalPosition))) { token = location.Terminal.Index; currentBufferPosition = location.Location + location.Terminal.End - location.Terminal.Start + 1; return(true); } if (mustMatchPosition) { currentBufferPosition = originalPosition; } else { currentBufferPosition = bufferLength - MaxLength + 1; } token = -1; return(false); }
public ActionResult DeleteConfirmed(int id) { TerminalLocation terminalLocation = db.TerminalLocation.Find(id); db.TerminalLocation.Remove(terminalLocation); db.SaveChanges(); return(RedirectToAction("Index")); }
//[ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "Id,IdTerminal,Longth,Width")] TerminalLocation terminalLocation) { if (ModelState.IsValid) { db.Entry(terminalLocation).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdTerminal = new SelectList(db.TerminalInf, "Id", "NomerTerminal", terminalLocation.IdTerminal); return(View(terminalLocation)); }
// [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "Id,IdTerminal,Longth,Width")] TerminalLocation terminalLocation) { if (ModelState.IsValid) { db.TerminalLocation.Add(terminalLocation); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdTerminal = new SelectList(db.TerminalInf, "Id", "NomerTerminal", terminalLocation.IdTerminal); return(View(terminalLocation)); }
// GET: TerminalLocations/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TerminalLocation terminalLocation = db.TerminalLocation.Find(id); if (terminalLocation == null) { return(HttpNotFound()); } return(View(terminalLocation)); }
// GET: TerminalLocations/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TerminalLocation terminalLocation = db.TerminalLocation.Find(id); if (terminalLocation == null) { return(HttpNotFound()); } ViewBag.IdTerminal = new SelectList(db.TerminalInf, "Id", "NomerTerminal", terminalLocation.IdTerminal); return(View(terminalLocation)); }
internal long Add(long scheduleId, TerminalLocation location) { var databaseId = GetNewId(); var row = Table.NewRow(); row["Id"] = databaseId; row["ScheduleId"] = scheduleId; row["LocationId"] = _lookup.Find(location.Location); row["Sequence"] = location.Sequence; row["WorkingArrival"] = (object)location.WorkingArrival ?? DBNull.Value; row["PublicArrival"] = (object)location.PublicArrival ?? DBNull.Value; row["Platform"] = location.Platform; row["Path"] = location.Path; row["Activities"] = location.Activities; Table.Rows.Add(row); return(databaseId); }
public bool GetOperation(byte[] buffer, int bufferLength, ref int currentBufferPosition, out int token) { int originalPosition = currentBufferPosition; TrieEvaluator <Token> evaluator = new TrieEvaluator <Token>(this); TrieEvaluationDriver <Token> driver = new TrieEvaluationDriver <Token>(evaluator); TerminalLocation <Token> location = driver.Evaluate(buffer, bufferLength, true, 0, ref currentBufferPosition); if (location != null && currentBufferPosition - location.Terminal.Length == originalPosition) { token = location.Terminal.Index; currentBufferPosition = location.Location + location.Terminal.End - location.Terminal.Start + 1; return(true); } currentBufferPosition = originalPosition; token = -1; return(false); }