public bus RecuperaDati(int idBus) { bus b = new bus(); try { using (SqlConnection con = new SqlConnection(StringaDiConnessione)) { con.Open(); string query = "SELECT * FROM info WHERE id = @id"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@id", idBus); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { b.id = 0; b.id = (int)reader["Id"]; b.lat = (string)reader["LatPartenza"]; b.lon = (string)reader["LongPartenza"]; b.posti = (int)reader["nPosti"]; b.fermate = (int)reader["nFermate"]; } reader.Close(); } } catch (Exception e) { Errore = e.Message; Console.WriteLine(Errore); } return(b); }
//Dang ki private void bunifuFlatButton1_Click(object sender, EventArgs e) { if (ckKiemtra.Checked) { if (txtPassword.Text != "" && txtPasswordComfirm.Text != "" && txtUserName.Text != "") { if (txtPassword.Text == txtPasswordComfirm.Text) { dto thongtin = new dto(txtName.Text, txtUserName.Text, txtPassword.Text); func = new bus(); if (func.AddTv(thongtin)) { MessageBox.Show("Đăng kí thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Đăng kí thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } else { MessageBox.Show("Mật khẩu không giống nhau !", "Thông Báo"); } } else { MessageBox.Show("Mời bạn nhập đầy đủ !!!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Mời Bạn Nhập Mọi Thứ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public ActionResult DeleteConfirmed(int id) { bus bus = db.bus.Find(id); db.bus.Remove(bus); db.SaveChanges(); return(RedirectToAction("Index")); }
public void wait(bus bus1) { System.Threading.Thread.Sleep(1000); if (bus1.state != "empty") { wait(bus1); } }
public async Task <ActionResult> DeleteConfirmed(int id) { bus bus = await db.buses.FindAsync(id); db.buses.Remove(bus); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID_bus,board_number,regist_number,number_of_places,mark")] bus bus) { if (ModelState.IsValid) { db.Entry(bus).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bus)); }
public ActionResult Edit([Bind(Include = "Idbus,asientos,pantente,estado")] bus bus) { if (ModelState.IsValid) { db.Entry(bus).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bus)); }
public ActionResult Create([Bind(Include = "ID_bus,board_number,regist_number,number_of_places,mark")] bus bus) { if (ModelState.IsValid) { db.bus.Add(bus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bus)); }
public ActionResult Create([Bind(Include = "Idbus,asientos,pantente,estado")] bus bus) { if (ModelState.IsValid) { db.bus.Add(bus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bus)); }
public ActionResult Create([Bind(Include = "plate,capacity")] bus bus) { if (ModelState.IsValid) { db.buses.Add(bus); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(bus)); }
public async Task <ActionResult> Edit([Bind(Include = "bus_id,bus_name,bus_type_id,total_seats")] bus bus) { if (ModelState.IsValid) { db.Entry(bus).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.bus_type_id = new SelectList(db.buses_type, "bus_type_id", "name", bus.bus_type_id); return(View(bus)); }
static void Main(string[] args) { IVehicle myvhicle = new truck(); myvhicle.running(); IVehicle yourv = new Car(); yourv.stopped(); IVehicle hisv = new bus(); hisv.fillingfuel(); }
public ActionResult Edit([Bind(Include = "bus_id,bus_type_id,company_id")] bus bus) { if (ModelState.IsValid) { db.Entry(bus).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.bus_type_id = new SelectList(db.bus_type, "bus_type_id", "bus_type_name", bus.bus_type_id); ViewBag.company_id = new SelectList(db.companies, "company_id", "company_name", bus.company_id); return(View(bus)); }
public ActionResult Create([Bind(Include = "bus_id,bus_type_id,company_id")] bus bus) { if (ModelState.IsValid) { db.buses.Add(bus); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.bus_type_id = new SelectList(db.bus_type, "bus_type_id", "bus_type_name", bus.bus_type_id); ViewBag.company_id = new SelectList(db.companies, "company_id", "company_name", bus.company_id); return(View(bus)); }
public Form1() { bus1 = new bus(); pc pc1 = new pc(); pc pc2 = new pc(); pcList.Add(pc1); pcList.Add(pc2); InitializeComponent(); label1.Text = pc1.state; }
// GET: buses/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } bus bus = db.bus.Find(id); if (bus == null) { return(HttpNotFound()); } return(View(bus)); }
// GET: buses/Details/5 /// <summary> /// Fectching Details of Buses based on Unique ID /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } bus bus = await db.buses.FindAsync(id); if (bus == null) { return(HttpNotFound()); } return(View(bus)); }
public static void TestCache() { var cache = new Cache <bus>(); var bus = new bus { id = 0, name = "no hay" }; Func <bus> onMiss = () => bus; var data = cache.Get(28, onMiss); Assert.AreEqual(bus, data); }
public ActionResult Create(Buses xx) { BusdbEntities db = new BusdbEntities(); bus r = new bus(); r.bid = xx.Busid; r.bname = xx.BusName; r.btype = xx.BusType; r.max_seats = xx.MaxSeat; db.buses.Add(r); db.SaveChanges(); return(RedirectToAction("index")); }
// GET: buses/Edit/5 /// <summary> /// Editing of Bus detailes based on Unique ID /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } bus bus = await db.buses.FindAsync(id); if (bus == null) { return(HttpNotFound()); } ViewBag.bus_type_id = new SelectList(db.buses_type, "bus_type_id", "name", bus.bus_type_id); return(View(bus)); }
// GET: /Bus/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } bus bus = db.buses.Find(id); if (bus == null) { return(HttpNotFound()); } ViewBag.bus_type_id = new SelectList(db.bus_type, "bus_type_id", "bus_type_name", bus.bus_type_id); ViewBag.company_id = new SelectList(db.companies, "company_id", "company_name", bus.company_id); return(View(bus)); }
void ApplyRules() { GameObject[] gos; gos = globalBus.allFish; Vector3 vcentre = Vector3.zero; Vector3 vavoid = Vector3.zero; float gspeed = 0.1f; Vector3 goalPos = globalBus.goalPos; float dist; int groupSize = 0; foreach (GameObject go in gos) { if (go != this.gameObject) { dist = Vector3.Distance(go.transform.position, this.transform.position); if (dist <= neighbourDistance) { vcentre += go.transform.position; groupSize++; if (dist < 1.0f) { vavoid = vavoid + (this.transform.position - go.transform.position); } bus anotherFlock = go.GetComponent <bus> (); gspeed = gspeed + anotherFlock.speed; } } } if (groupSize > 0) { vcentre = vcentre / groupSize + (goalPos - this.transform.position); speed = gspeed / groupSize; Vector3 direction = (vcentre + vavoid) - transform.position; if (direction != Vector3.zero) { transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), rotationSpeed * Time.deltaTime); } } }
/* * send(frame) * wait_until (end_of_frame) or (collision) * if collision detected: * stop transmitting * send(jamming) * k = min (10, N) * r = random(0, 2k - 1) * slotTime * wait(r*slotTime) */ public void send(bus bus1, pc act_pc) { act_pc.state = "want to send"; wait(bus1); bus1.state = "start_send"; // SO MUCH ANIMÁCIÓ // wait /* * if (state == "idle") * { * state = "want_to_send"; * if (bus1.state.Equals("empty")) * { * state = "start_send"; * bus1.state = "busy"; * state = "send"; * } * * } */ }
public ActionResult Create([Bind(Include = "route_trip_id,route_id,number_of_trips,arrival_time,departure_time")] route_trip route_trip, [Bind(Include = "bus_id")] bus busid, [Bind(Include = "driver_id")] driver driverid) { // if (ModelState.IsValid) // { db.route_trip.Add(route_trip); db.SaveChanges(); bus_trip trip = new bus_trip(); // ViewBag.driver_id = new SelectList(db.drivers, "driver_id", "driver_name", trip.driver_id); // ViewBag.bus_id = new SelectList(db.buses, "bus_id", "bus_id", trip.driver_id); trip.bus_id = busid.bus_id; trip.bus_trip_date = DateTime.Now; trip.start_time = route_trip.arrival_time; trip.end_time = route_trip.departure_time; trip.driver_id = driverid.driver_id; trip.route_trip_id = route_trip.route_trip_id; db.bus_trip.Add(trip); db.SaveChanges(); // } // ViewBag.route_id = new SelectList(db.routes, "route_id", "source", route_trip.route_id); ViewBag.route_id = from r in db.routes.ToList() select new { id = r.route_id, about_route = r.source + " - " + r.destination }; ViewBag.bus_id = new SelectList(db.buses, "bus_id", "bus_id"); ViewBag.driver_id = new SelectList(db.drivers, "driver_id", "driver_name"); return(RedirectToAction("Index")); // return View(route_trip); }
foreach (var(bus, index) in rules)