public ActionResult DeleteConfirmed(int id) { ParkingAdapter parkingAdapter = db.ParkingAdapters.Find(id); db.ParkingAdapters.Remove(parkingAdapter); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ParkingAdapterId,parkingType,SignUpId")] ParkingAdapter parkingAdapter) { if (ModelState.IsValid) { db.Entry(parkingAdapter).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SignUpId = new SelectList(db.SignUps, "SignUpId", "name", parkingAdapter.SignUpId); return(View(parkingAdapter)); }
public ActionResult Create([Bind(Include = "ParkingAdapterId,parkingType,SignUpId")] ParkingAdapter parkingAdapter) { if (ModelState.IsValid) { db.ParkingAdapters.Add(parkingAdapter); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SignUpId = new SelectList(db.SignUps, "SignUpId", "name", parkingAdapter.SignUpId); return(View(parkingAdapter)); }
// GET: ParkingAdapters/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ParkingAdapter parkingAdapter = db.ParkingAdapters.Find(id); if (parkingAdapter == null) { return(HttpNotFound()); } return(View(parkingAdapter)); }
// GET: ParkingAdapters/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ParkingAdapter parkingAdapter = db.ParkingAdapters.Find(id); if (parkingAdapter == null) { return(HttpNotFound()); } ViewBag.SignUpId = new SelectList(db.SignUps, "SignUpId", "name", parkingAdapter.SignUpId); return(View(parkingAdapter)); }
private void InitParkingCommunication(object obj) { foreach (ParkInfo park in ParkBuffer.Current.Parks) { if (park.IsRootPark) { ParkingAdapter pad = new ParkingAdapter(park.ParkAdapterUri); pad.ParkID = park.ParkID; ParkingAdapterManager.Instance.Add(park.ParkID, pad); pad.Reporting += ProcessReport; pad.ParkAdapterConnectFail += new EventHandler(pad_ParkAdapterConnectFail); pad.ParkApaterReconnected += new EventHandler(pad_ParkApaterReconnected); pad.ConnectServer(); } } }
public void Start() { if (_Communication != null) { ConnectCommunication(); } string stationID = AppSettings.CurrentSetting.WorkstationID; if (!string.IsNullOrEmpty(stationID)) { WorkStationInfo.CurrentStation = (new WorkstationBll(AppSettings.CurrentSetting.ParkConnect)).GetWorkStationByID(stationID); } if (WorkStationInfo.CurrentStation == null) { foreach (ParkInfo park in ParkBuffer.Current.Parks) { ParkingAdapter pad = new ParkingAdapter(park.ParkAdapterUri); pad.ParkID = park.ParkID; pad.Reporting += pad_CardEventReporting; if (pad.ConnectServer()) { if (MainForm != null) { MainForm.WriteLine(string.Format("连接{0}服务器成功", park.ParkName)); } } else { if (MainForm != null) { MainForm.WriteLine(string.Format("连接{0}服务器失败", park.ParkName)); } } _Adapters.Add(pad); } } else { //本工作站连接所有的停车场WCF服务 foreach (ParkInfo park in ParkBuffer.Current.Parks) { if (park.IsRootPark && WorkStationInfo.CurrentStation.IsInListenList(park))//如果是托管的停车场或者侦听了事件的停车场 { ParkingAdapter pad = new ParkingAdapter(park.ParkAdapterUri); pad.ParkID = park.ParkID; pad.Reporting += pad_CardEventReporting; if (pad.ConnectServer()) { if (MainForm != null) { MainForm.WriteLine(string.Format("连接{0}服务器成功", park.ParkName)); } } else { if (MainForm != null) { MainForm.WriteLine(string.Format("连接{0}服务器失败", park.ParkName)); } } _Adapters.Add(pad); } } } Thread t = new Thread(CheckConnected_Thread); t.IsBackground = true; t.Start(); Thread t2 = new Thread(SendParkVacant_Thread); t2.IsBackground = true; t2.Start(); Thread t3 = new Thread(Send_Thread); t3.IsBackground = true; t3.Start(); }