private void Publish(HospitalEvent he) { foreach (var s in _subscriptions) { s.Tell(he); } }
public ActionResult DeleteConfirmed(int id) { HospitalEvent hospitalEvent = db.HospitalEvents.Find(id); db.HospitalEvents.Remove(hospitalEvent); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "eventsId,evntName,evntDatetime,evntDesc,evntLoc,employeeId")] HospitalEvent hospitalEvent) { if (ModelState.IsValid) { db.Entry(hospitalEvent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hospitalEvent)); }
public ActionResult Create([Bind(Include = "eventsId,evntName,evntDatetime,evntDesc,evntLoc,employeeId")] HospitalEvent hospitalEvent) { if (ModelState.IsValid) { db.HospitalEvents.Add(hospitalEvent); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hospitalEvent)); }
// GET: HospitalEvents/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HospitalEvent hospitalEvent = db.HospitalEvents.Find(id); if (hospitalEvent == null) { return(HttpNotFound()); } return(View(hospitalEvent)); }
private HospitalEvent ConvertToActorEvent(Common.Entities.IHospitalEvent dbEvent) { HospitalEvent hospitalEvent = null; switch (dbEvent.EventType) { case HospitalEventType.PatientArrival: hospitalEvent = new RegisterPatient(dbEvent.HospitalId, dbEvent.PatiendId, dbEvent.EventTime, _diseases[dbEvent.DiseaseType.Value]); break; case HospitalEventType.PatientLeaving: hospitalEvent = new UnregisterPatient(dbEvent.HospitalId, dbEvent.PatiendId, dbEvent.EventTime); break; case HospitalEventType.PatientTakenInChargeByDoctor: hospitalEvent = new BeginAppointmentWithDoctor(dbEvent.HospitalId, dbEvent.PatiendId, dbEvent.DoctorId.Value, dbEvent.EventTime, _diseases[dbEvent.DiseaseType.Value]); break; default: throw new ArgumentException("Unexpected hospital event type"); } return(hospitalEvent); }
public static IEnumerable <IHospitalEvent> FindHospitalEventsAfter(int hospitalId, long afterEventId, int maxEventCount) { var events = new List <IHospitalEvent>(); try { using (var conn = new SqlConnection(ConnectionString)) { conn.Open(); using (var cmd = new SqlCommand("HospitalEventSelectCommand", conn)) { cmd.CommandType = CommandType.StoredProcedure; var param = new SqlParameter { ParameterName = "@HospitalId", Value = hospitalId, SqlDbType = SqlDbType.Int }; cmd.Parameters.Add(param); param = new SqlParameter { ParameterName = "@AfterEventId", Value = afterEventId, SqlDbType = SqlDbType.BigInt }; cmd.Parameters.Add(param); param = new SqlParameter { ParameterName = "@MaxEventCount", Value = maxEventCount, SqlDbType = SqlDbType.Int }; cmd.Parameters.Add(param); var dr = cmd.ExecuteReader(); while (dr.Read()) { var e = new HospitalEvent { EventId = dr.GetInt64(0), HospitalId = hospitalId, PatiendId = dr.GetInt32(1), EventType = (HospitalEventType)dr.GetInt16(2), EventTime = dr.GetDateTime(3), DiseaseType = dr.IsDBNull(4) ? (DiseaseType?)null : (DiseaseType)dr.GetInt16(4), DoctorId = dr.IsDBNull(5) ? (int?)null : dr.GetInt32(5) }; events.Add(e); } } conn.Close(); } } catch (Exception ex) { s_logger.Error("ERROR: {0}", ex.Message); } return(events); }
/*Action for event details*/ /*************************/ public ActionResult EventDetails(int?id) { HospitalEvent events = db.HospitalEvents.Single(evnt => evnt.eventsId == id); return(View(events)); }