protected void DeletePatientAppointButton_Click(object sender, EventArgs e) { if (ShowPatientAppointments.SelectedRow != null) // if appointment selected to delete on gridview, do this { AppointmentsTable delete = new AppointmentsTable(); string input = ShowPatientAppointments.SelectedValue.ToString(); // gets AppointmentID of selected row int appointmentID = Convert.ToInt32(input); delete = UtilitiesClass.createAppointment(appointmentID); // creates copy of appointment object to delete foreach (AppointmentsTable appointment in dbcon.AppointmentsTables) // check if appointment exists { if (appointment.AppointmentID == delete.AppointmentID) // if appointment exists, delete it { dbcon.AppointmentsTables.Remove(appointment); } } dbcon.SaveChanges(); // save changes to database ShowPatientAppointments.DataBind(); // update changes to grid view displaying patient appointment if (ShowPatientAppointments.Rows.Count == 0) // if no appointments, display message { DisplayNoAppointMessage.Text = "You have no appointments set up."; DisplayNoAppointMessage.Visible = true; DeletePatientAppointButton.Visible = false; // makes delete appointment button invisible } } }
public IHttpActionResult PutPatient(Guid id, Patient patient) { if (id != patient.Id) { return(BadRequest()); } db.Entry(patient).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { if (!PatientExists(id)) { return(StatusCode(HttpStatusCode.InternalServerError)); } else { throw ex; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "id,nombre")] tb_tipo_documento tb_tipo_documento) { if (ModelState.IsValid) { db.tb_tipo_documento.Add(tb_tipo_documento); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tb_tipo_documento)); }
public ActionResult Create([Bind(Include = "id,nombre")] tb_especialidad tb_especialidad) { if (ModelState.IsValid) { db.tb_especialidad.Add(tb_especialidad); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tb_especialidad)); }
public ActionResult Create([Bind(Include = "id,cedula,nombre,apellido,telefono,correo,tipoDocumento")] tb_paciente tb_paciente) { if (ModelState.IsValid) { db.tb_paciente.Add(tb_paciente); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.tipoDocumento = new SelectList(db.tb_tipo_documento, "id", "nombre", tb_paciente.tipoDocumento); return(View(tb_paciente)); }
public ActionResult Create([Bind(Include = "id,descripcion,doctorId,pacienteId,tipoCita,fecha,hora,duracion")] tb_cita tb_cita) { if (ModelState.IsValid) { db.tb_cita.Add(tb_cita); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.doctorId = new SelectList(db.tb_doctor, "id", "cedula", tb_cita.doctorId); ViewBag.pacienteId = new SelectList(db.tb_paciente, "id", "cedula", tb_cita.pacienteId); ViewBag.tipoCita = new SelectList(db.tb_tipo_cita, "id", "nombre", tb_cita.tipoCita); return(View(tb_cita)); }
public ActionResult AddDoctor([Bind(Include = "Doctor_ID,Name_Title,FirstName,LastName,Department, Education, Phone_Number, Email, Address, Salary, JoiningDate")] Doctor DoctorRecord) { try { if (ModelState.IsValid) { db.Doctors.Add(DoctorRecord); db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } catch { return(RedirectToRoute("~/Shared/Error")); } }
//Sends the given message's info to the ViewMessageTextBox public void ViewMessage(int messageID) { MessagesTable mTable = UtilitiesClass.getMessageByID(messageID); CustomMessage mCustom = new CustomMessage(mTable); ViewMessageTextBox.Visible = true; ViewMessageTextBox.Text = $"From: {mCustom.From}\nTo: {mCustom.To}\nDate: {mTable.Date}\n\n{mTable.Message}"; if (mTable.MessageTO.Trim().Equals(Session["LoginName"].ToString().Trim()) && mTable.IsRead == 0) { foreach (MessagesTable m in dbcon.MessagesTables) { if (m.MessageID == messageID) { m.IsRead = 1; } } dbcon.SaveChanges(); loadMessages(Session["LoginName"].ToString()); } }