public IHttpActionResult PutClinicTable(int id, ClinicTable clinicTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != clinicTable.Id) { return(BadRequest()); } db.Entry(clinicTable).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClinicTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult EditPatient() { using (ClinicEntities entities = new ClinicEntities()) { Guid pId = Guid.Parse(Request["PatientId"]); //Пациенты myP = entities.Пациенты.Where(x => x.ID_пациента == pId).First(); Пациенты myP = entities.Пациенты.Find(pId); myP.C__полиса = Request["Police"]; myP.Фамилия = Request["Surname"]; myP.Имя = Request["Firstname"]; myP.Отчество = Request["Patronomic"]; myP.Дата_рождения = Convert.ToDateTime(Request["BirthDate"]); var deathDate = Request["DeathDate"]; if (deathDate == "") { myP.Дата_смерти = null; } else { myP.Дата_смерти = Convert.ToDateTime(Request["DeathDate"]); } myP.Код_адреса = Convert.ToInt32(Request["AdressList"]); entities.Entry(myP).State = EntityState.Modified; entities.SaveChanges(); } return(View()); }
public ActionResult EditRecept(Прием myP) { using (ClinicEntities entities = new ClinicEntities()) { entities.Entry(myP).State = EntityState.Modified; entities.SaveChanges(); return(RedirectToAction("Index", "Home")); } }
public async Task <ActionResult> Edit([Bind(Include = "patient_id,patient_name,patient_age,patient_visit_date,patient_symptoms,patient_medicine")] patient patient) { if (ModelState.IsValid) { db.Entry(patient).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(patient)); }
public ActionResult Edit([Bind(Include = "ID_Staff,nom,prenom,sexe,phone,email,login,password,role")] Staff staff) { if (ModelState.IsValid) { db.Entry(staff).State = EntityState.Modified; Adress adrc = new Adress(); string pays = Request["adress.pays"].ToString(); string ville = Request["adress.ville"].ToString(); string prefecture = Request["adress.prefecture"].ToString(); string village = Request["adress.village"].ToString(); int idAdrc = db.Adresses.Where(id => id.ID_Staff == staff.ID_Staff).Select(x => x.ID_Adresse).DefaultIfEmpty(0).First(); if (idAdrc > 0) { if (!string.IsNullOrEmpty(pays)) { db.Database.ExecuteSqlCommand("Update Adresses set pays='" + pays.ToString() + "' where ID_Adresse =" + idAdrc); } if (!string.IsNullOrEmpty(ville)) { db.Database.ExecuteSqlCommand("Update Adresses set ville='" + ville.ToString() + "' where ID_Adresse =" + idAdrc); } if (!string.IsNullOrEmpty(prefecture)) { db.Database.ExecuteSqlCommand("Update Adresses set prefecture='" + prefecture.ToString() + "' where ID_Adresse =" + idAdrc); } if (!string.IsNullOrEmpty(village)) { db.Database.ExecuteSqlCommand("Update Adresses set village='" + village.ToString() + "' where ID_Adresse =" + idAdrc); } } if (idAdrc == 0) { if (!string.IsNullOrEmpty(pays) || !string.IsNullOrEmpty(ville) || !string.IsNullOrEmpty(prefecture) || !string.IsNullOrEmpty(village)) { adrc.ID_Staff = staff.ID_Staff; adrc.pays = pays; adrc.ville = ville; adrc.prefecture = prefecture; adrc.village = village; db.Adresses.Add(adrc); } } db.SaveChanges(); return(RedirectToAction("Index")); } return(View(staff)); }
public ActionResult EditUser() { using (ClinicEntities entities = new ClinicEntities()) { Guid pId = Guid.Parse(Request["UserId"]); Пользователи myP = entities.Пользователи.Find(pId); myP.login = Request["Login"];; myP.password = Request["Password"]; myP.role = Request["Role"]; entities.Entry(myP).State = EntityState.Modified; entities.SaveChanges(); } return(View()); }
public ActionResult EditStaff() { using (ClinicEntities entities = new ClinicEntities()) { Guid pId = Guid.Parse(Request["StaffId"]); Сотрудники myP = entities.Сотрудники.Find(pId); myP.Фамилия = Request["Surname"]; myP.Имя = Request["Firstname"]; myP.Отчество = Request["Patronymic"]; entities.Entry(myP).State = EntityState.Modified; entities.SaveChanges(); } return(View()); }
public JsonResult Upload() { using (ClinicEntities entities = new ClinicEntities()) { foreach (string file in Request.Files) { var upload = Request.Files[file]; if (upload != null) { Guid pId = Guid.Parse(file); Пользователи myP = entities.Пользователи.Find(pId); // получаем имя файла string fileName = Guid.NewGuid().ToString() + ".jpg"; // сохраняем файл в папку Files в проекте upload.SaveAs(Server.MapPath("~/Files/" + fileName)); myP.Image = fileName; entities.Entry(myP).State = EntityState.Modified; entities.SaveChanges(); } } } return(Json("файл загружен")); }
public ActionResult Edit([Bind(Include = "ID_Consultation,dateCreation,motif,note,poids,taille,temperature,systol,diastol,diagnostique,maladie,ID_Patient,ID_Staff")] Consultation consultation /*[Bind(Include = "id_audit,ID_Consultation,ID_Staff,change_date,change_by")] Audit_Consultation ac*/) { //string medicament = (from o in db.Ordonnances where o.ID_Consultation == consultation.ID_Consultation select new { o.medicament }).Single().medicament; //string prescription = (from o in db.Ordonnances where o.ID_Consultation == consultation.ID_Consultation select new { o.prescription }).Single().prescription; //string vaccin = (from v in db.Vaccins where v.ID_Consultation == consultation.ID_Consultation select new { v.description }).Single().description; //consultation.vaccin.description = getVaccin(consultation.ID_Consultation); //consultation.ordonnance.prescription = getPrecription(consultation.ID_Consultation); //consultation.ordonnance.medicament = getMedicament(consultation.ID_Consultation); if (ModelState.IsValid) { db.Entry(consultation).State = EntityState.Modified; //ac.ID_Consultation = consultation.ID_Consultation; //ac.ID_Staff = consultation.ID_Staff; //ac.change_date = DateTime.Now; Vaccin v = new Vaccin(); Ordonnance o = new Ordonnance(); Antecedent ant = new Antecedent(); var changeBy = (from s in db.Staffs where s.ID_Staff == consultation.ID_Staff select new { s.nom, s.prenom }).Single(); consultation.changeBy = changeBy.nom + " " + changeBy.prenom; consultation.changeDate = DateTime.Now; //db.Audit_Consultation.Add(ac); string viewAntecedent = Request["antecedent.description"].ToString(); string viewVaccin = Request["vaccin.description"].ToString(); string viewPrescription = Request["ordonnance.prescription"].ToString(); string viewMedicament = Request["ordonnance.medicament"].ToString(); int idVac = db.Vaccins.Where(id => id.ID_Consultation == consultation.ID_Consultation).Select(x => x.ID_Vaccin).DefaultIfEmpty(0).First(); int idOrd = db.Ordonnances.Where(id => id.ID_Consultation == consultation.ID_Consultation).Select(x => x.ID_Ordonnance).DefaultIfEmpty(0).First(); int idAnt = db.Antecedents.Where(id => id.ID_Consultation == consultation.ID_Consultation).Select(x => x.ID_Antecedent).DefaultIfEmpty(0).First(); if (idAnt > 0) { if (!string.IsNullOrEmpty(viewAntecedent)) { db.Database.ExecuteSqlCommand("Update Antecedents set description='" + viewAntecedent + "' where ID_Antecedent =" + idAnt); } } if (idAnt == 0) { if (!string.IsNullOrEmpty(viewAntecedent)) { ant.description = viewAntecedent.ToString(); ant.ID_Consultation = consultation.ID_Consultation; ant.ID_Patient = consultation.ID_Patient; db.Antecedents.Add(ant); } } if (idVac > 0) { if (!string.IsNullOrEmpty(viewVaccin)) { db.Database.ExecuteSqlCommand("Update Vaccins set description='" + viewVaccin.ToString() + "' where ID_Vaccin =" + idVac); } } if (idVac == 0) { if (!string.IsNullOrEmpty(viewVaccin)) { v.description = viewVaccin.ToString(); v.ID_Consultation = consultation.ID_Consultation; v.ID_PATIENT = consultation.ID_Patient; v.date = DateTime.Now; db.Vaccins.Add(v); } } if (idOrd > 0) { if (!string.IsNullOrEmpty(viewPrescription)) { db.Database.ExecuteSqlCommand("Update Ordonnances set prescription='" + viewPrescription.ToString() + "' where ID_Ordonnance =" + idOrd); } //else //{ // db.Database.ExecuteSqlCommand("Update Ordonnances set prescription='' where ID_Ordonnance =" + idOrd); //} if (!string.IsNullOrEmpty(viewMedicament)) { db.Database.ExecuteSqlCommand("Update Ordonnances set medicament='" + viewMedicament.ToString() + "' where ID_Ordonnance =" + idOrd); } } if (idOrd == 0) { if (!string.IsNullOrEmpty(viewPrescription)) { o.prescription = viewPrescription.ToString(); o.ID_Consultation = consultation.ID_Consultation; db.Ordonnances.Add(o); } if (!string.IsNullOrEmpty(viewMedicament)) { o.medicament = viewMedicament.ToString(); o.ID_Consultation = consultation.ID_Consultation; db.Ordonnances.Add(o); } } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_Patient = new SelectList(db.Patients, "ID_Patient", "nom", consultation.ID_Patient); ViewBag.ID_Staff = new SelectList(db.Staffs, "ID_Staff", "nom", consultation.ID_Staff); return(View(consultation)); }
public ActionResult EditSh() { using (ClinicEntities entities = new ClinicEntities()) { Guid dId = Guid.Parse(Request["DoctorId"]); var week = Request["Week"]; var mondayS = Request["MondayS"]; var mondayF = Request["MondayF"]; var mondayKab = Request["MondayKab"]; var tuesdayS = Request["TuesdayS"]; var tuesdayF = Request["TuesdayF"]; var tuesdayKab = Request["TuesdayKab"]; var wednesdayS = Request["WednesdayS"]; var wednesdayF = Request["WednesdayF"]; var wednesdayKab = Request["WednesdayKab"]; var thursdayS = Request["ThursdayS"]; var thursdayF = Request["ThursdayF"]; var thursdayKab = Request["ThursdayKab"]; var fridayS = Request["FridayS"]; var fridayF = Request["FridayF"]; var fridayKab = Request["FridayKab"]; var saturdayS = Request["SaturdayS"]; var saturdayF = Request["SaturdayF"]; var saturdayKab = Request["SaturdayKab"]; List <асписание> myEntities = new List <асписание>(); myEntities = entities.асписание.Where(x => x.ID_врача == dId && x.Неделя == week).ToList(); if ((mondayS != "не работает") && (mondayS != "")) { асписание понедельник = null; try { понедельник = myEntities.Where(x => x.Код_дня == 1).First(); } catch (Exception ex) { } if (понедельник == null) { понедельник = new асписание(); понедельник.ID_записи = Guid.NewGuid(); понедельник.ID_врача = dId; понедельник.Код_дня = 1; понедельник.Неделя = week; entities.асписание.Add(понедельник); } else { entities.Entry(понедельник).State = EntityState.Modified; } понедельник.Время_начала = TimeSpan.Parse(mondayS); понедельник.Время_окончания = TimeSpan.Parse(mondayF); понедельник.C__кабинета = Convert.ToInt32(mondayKab); } if ((tuesdayS != "не работает") && (tuesdayS != "")) { асписание вторник = null; try { вторник = myEntities.Where(x => x.Код_дня == 2).First(); } catch (Exception ex) { } if (вторник == null) { вторник = new асписание(); вторник.ID_записи = Guid.NewGuid(); вторник.ID_врача = dId; вторник.Код_дня = 2; вторник.Неделя = week; entities.асписание.Add(вторник); } else { entities.Entry(вторник).State = EntityState.Modified; } вторник.Время_начала = TimeSpan.Parse(tuesdayS); вторник.Время_окончания = TimeSpan.Parse(tuesdayF); вторник.C__кабинета = Convert.ToInt32(tuesdayKab); } if ((wednesdayS != "не работает") && (wednesdayS != "")) { асписание среда = null; try { среда = myEntities.Where(x => x.Код_дня == 3).First(); } catch (Exception ex) { } if (среда == null) { среда = new асписание(); среда.ID_записи = Guid.NewGuid(); среда.ID_врача = dId; среда.Код_дня = 3; среда.Неделя = week; entities.асписание.Add(среда); } else { entities.Entry(среда).State = EntityState.Modified; } среда.Время_начала = TimeSpan.Parse(wednesdayS); среда.Время_окончания = TimeSpan.Parse(wednesdayF); среда.C__кабинета = Convert.ToInt32(wednesdayKab); } if ((thursdayS != "не работает") && (thursdayS != "")) { асписание четверг = null; try { четверг = myEntities.Where(x => x.Код_дня == 4).First(); } catch (Exception ex) { } if (четверг == null) { четверг = new асписание(); четверг.ID_записи = Guid.NewGuid(); четверг.ID_врача = dId; четверг.Код_дня = 4; четверг.Неделя = week; entities.асписание.Add(четверг); } else { entities.Entry(четверг).State = EntityState.Modified; } четверг.Время_начала = TimeSpan.Parse(thursdayS); четверг.Время_окончания = TimeSpan.Parse(thursdayF); четверг.C__кабинета = Convert.ToInt32(thursdayKab); } if ((fridayS != "не работает") && (fridayS != "")) { асписание пятница = null; try { пятница = myEntities.Where(x => x.Код_дня == 5).First(); } catch (Exception ex) { } if (пятница == null) { пятница = new асписание(); пятница.ID_записи = Guid.NewGuid(); пятница.ID_врача = dId; пятница.Код_дня = 5; пятница.Неделя = week; entities.асписание.Add(пятница); } else { entities.Entry(пятница).State = EntityState.Modified; } пятница.Время_начала = TimeSpan.Parse(fridayS); пятница.Время_окончания = TimeSpan.Parse(fridayF); пятница.C__кабинета = Convert.ToInt32(fridayKab); } if ((saturdayS != "не работает") && (saturdayS != "")) { асписание суббота = null; try { суббота = myEntities.Where(x => x.Код_дня == 6).First(); } catch (Exception ex) { } if (суббота == null) { суббота = new асписание(); суббота.ID_записи = Guid.NewGuid(); суббота.ID_врача = dId; суббота.Код_дня = 6; суббота.Неделя = week; entities.асписание.Add(суббота); } else { entities.Entry(суббота).State = EntityState.Modified; } суббота.Время_начала = TimeSpan.Parse(saturdayS); суббота.Время_окончания = TimeSpan.Parse(saturdayF); суббота.C__кабинета = Convert.ToInt32(saturdayKab); } entities.SaveChanges(); } return(View()); }
public ActionResult Edit([Bind(Include = "ID_Patient,nom,prenom,date_naissance,sexe,profession,situation_familial,groupe_sanguin,email,telephone,dateCreation")] Patient patient) { if (ModelState.IsValid) { db.Entry(patient).State = EntityState.Modified; Adress adrc = new Adress(); ContactPAtient cp = new ContactPAtient(); string pays = Request["adress.pays"].ToString(); string ville = Request["adress.ville"].ToString(); string prefecture = Request["adress.prefecture"].ToString(); string village = Request["adress.village"].ToString(); string nomCp = Request["cp.nom"].ToString(); string prenomCp = Request["cp.prenom"].ToString(); string sexeCp = Request["cp.sexe"].ToString(); string professionCp = Request["cp.profession"].ToString(); string emailCp = Request["cp.email"].ToString(); string telephoneCp = Request["cp.telephone"].ToString(); int idAdrc = db.Adresses.Where(id => id.ID_Patient == patient.ID_Patient).Select(x => x.ID_Adresse).DefaultIfEmpty(0).First(); int idCp = db.ContactPAtients.Where(id => id.ID_PATIENT == patient.ID_Patient).Select(x => x.ID_ContactPatient).DefaultIfEmpty(0).First(); if (idAdrc > 0) { if (!string.IsNullOrEmpty(pays)) { db.Database.ExecuteSqlCommand("Update Adresses set pays='" + pays.ToString() + "' where ID_Adresse =" + idAdrc); } if (!string.IsNullOrEmpty(ville)) { db.Database.ExecuteSqlCommand("Update Adresses set ville='" + ville.ToString() + "' where ID_Adresse =" + idAdrc); } if (!string.IsNullOrEmpty(prefecture)) { db.Database.ExecuteSqlCommand("Update Adresses set prefecture='" + prefecture.ToString() + "' where ID_Adresse =" + idAdrc); } if (!string.IsNullOrEmpty(village)) { db.Database.ExecuteSqlCommand("Update Adresses set village='" + village.ToString() + "' where ID_Adresse =" + idAdrc); } } if (idAdrc == 0) { if (!string.IsNullOrEmpty(pays) || !string.IsNullOrEmpty(ville) || !string.IsNullOrEmpty(prefecture) || !string.IsNullOrEmpty(village)) { adrc.ID_Patient = patient.ID_Patient; adrc.pays = pays; adrc.ville = ville; adrc.prefecture = prefecture; adrc.village = village; db.Adresses.Add(adrc); } } if (idCp > 0) { if (!string.IsNullOrEmpty(nomCp)) { db.Database.ExecuteSqlCommand("Update ContactPAtients set nom='" + nomCp.ToString() + "' where ID_ContactPatient =" + idCp); } if (!string.IsNullOrEmpty(prenomCp)) { db.Database.ExecuteSqlCommand("Update ContactPAtients set prenom='" + prenomCp.ToString() + "' where ID_ContactPatient =" + idCp); } if (!string.IsNullOrEmpty(sexeCp)) { db.Database.ExecuteSqlCommand("Update ContactPAtients set sexe='" + sexeCp.ToString() + "' where ID_ContactPatient =" + idCp); } if (!string.IsNullOrEmpty(professionCp)) { db.Database.ExecuteSqlCommand("Update ContactPAtients set profession='" + professionCp.ToString() + "' where ID_ContactPatient =" + idCp); } if (!string.IsNullOrEmpty(emailCp)) { db.Database.ExecuteSqlCommand("Update ContactPAtients set email='" + emailCp.ToString() + "' where ID_ContactPatient =" + idCp); } if (!string.IsNullOrEmpty(telephoneCp)) { db.Database.ExecuteSqlCommand("Update ContactPAtients set telephone='" + telephoneCp.ToString() + "' where ID_ContactPatient =" + idCp); } } if (idCp == 0) { if (!string.IsNullOrEmpty(nomCp) || !string.IsNullOrEmpty(prenomCp) || !string.IsNullOrEmpty(sexeCp) || !string.IsNullOrEmpty(professionCp) || !string.IsNullOrEmpty(emailCp) || !string.IsNullOrEmpty(telephoneCp)) { cp.ID_PATIENT = patient.ID_Patient; cp.nom = nomCp; cp.prenom = prenomCp; cp.sexe = sexeCp; cp.profession = professionCp; cp.email = emailCp; cp.telephone = telephoneCp; db.ContactPAtients.Add(cp); } } db.SaveChanges(); return(RedirectToAction("Index")); } return(View(patient)); }