private void Grid1_SelectionChanged(object sender, SelectionChangedEventArgs e) { //on vérifie si la ligne choisie contient bien un enregistrement if (dataGrid.SelectedItem != null) { //on crée deux objets (medecin et patient) Medecin m = new Medecin(); Patient p = new Patient(); //on transforme la ligne du grid choisie en objet RDV RDV r = (RDV)dataGrid.SelectedItem; //ensuite on lance les methodes de recherche seek (pour patient et medecin) dans la bdd en passant //en paramètre le codePatient et codeMedecin contenus dans le l'objet rdv crée juste au dessus Medecin.Seek(r.CodeMedecin, ref m); Patient.Seek(r.CodePatient, ref p); textBox1.Text = m.NomMedecin; textBox2.Text = m.SpecialiteMedecin; textBox3.Text = p.NomPatient; textBox4.Text = p.DateNaissance.ToString(); if (p.SexePatient == "H") { radiobutton1.IsChecked = true; } else { radiobutton2.IsChecked = true; } } }
// GET: RDVs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RDV rDV = uow.RDVRepository.GetByID((int)id); if (rDV == null) { return(HttpNotFound()); } RDVDetailsViewModel viewModel = new RDVDetailsViewModel(); IEnumerable <Tax> Taxes = uow.TaxRepository.Get(); viewModel.RDV = rDV; viewModel.CoutTPS = rDV.CoutTotalAvantTaxes * (Taxes.Where(x => x.TaxeID == 1).First().Pourcentage / 100); viewModel.CoutTVQ = rDV.CoutTotalAvantTaxes * (Taxes.Where(x => x.TaxeID == 2).First().Pourcentage / 100); viewModel.Agent = rDV.Agent; viewModel.Forfait = rDV.Forfait; viewModel.Photos = rDV.PhotoProprietes; viewModel.Statut = rDV.CurrentStatut; return(View(viewModel)); }
public ActionResult CreateRDV(string Message, RDV consultRDV) { //var UserId = User.Identity.GetUserId(); var ConsultationID = (int)Session["ConsultationID"]; //Patients patients = new Patients(); RDV job = new RDV { ConsultationID = ConsultationID, Message = Message, ApplyDate = DateTime.Now }; db.RDV.Add(job); db.SaveChanges(); var OneBlog = (from e in db.RDV join p in db.Consultations on e.ConsultationID equals p.ConsultationID join s in db.Patients on p.idPatients equals s.IdPatients join t in db.Users on p.UserID equals t.Id where e.ConsultationID == p.ConsultationID select new { Message = e.Message, ApplyDate = e.ApplyDate, MatriculePatients = s.MatriculePatients, NomPatient = s.NomPatient, PrenomPatient = s.PrenomPatient, UserName = t.UserName, ConsultationID = p.ConsultationID }).ToList(); var last = OneBlog.Last(); ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Report"), "CrystalReport1.rpt")); //rd.SetDataSource(last); rd.SetDataSource(new[] { last }); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "LettreConfrere.pdf")); // return View(); }
private void buttonOK_Click(object sender, RoutedEventArgs e) { // o ncrée un nouveau Patient Patient p = new Patient(); p.CodePatient = textBox1.Text; //et on lance la méthode de classe pour le rechercher dans la bdd qui ensuite remplira les propriétés de l'objet crée avec //les infos de la bdd Patient.Seek(textBox1.Text, ref p); textBox2.Text = p.NomPatient; textBox3.Text = p.DateNaissance.ToString(); richTextBox1.AppendText(p.AdressePatient); if (p.SexePatient == "H") { radioButton1.IsChecked = true; } else { radioButton2.IsChecked = true; } RDV.Rdv.Clear(); //on la remplit à nouveau avec cette fois la methode qui cherche que les rdv par le patient choisi RDV.FillListWithChosenPatient(p.CodePatient); //on remplit la datagrid avec le contenu de la liste dataGrid.ItemsSource = RDV.Rdv; }
public HttpResponseMessage Put(int id, [FromBody] RDV V) { try { using (USERSDBEntities entities = new USERSDBEntities()) { var entity = entities.RDVs.FirstOrDefault(e => e.ID == id); if (entity == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, " with ID = " + id.ToString() + " not found")); } else { entity.ETAT = V.ETAT; entity.DATER = V.DATER; entities.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, entity)); } } } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e)); } }
public static bool RechercherRDV(int num, RDV r) { //methode de classe permettant de chercher un medecin via un code choisi //si on le trouve on modifie l'objet medecin passé en paramètre par référence string request = "SELECT * FROM RDV WHERE NumeroRDV=@num"; command = new SqlCommand(request, Database.connection); command.Parameters.Add(new SqlParameter("@num", num)); Database.connection.Open(); SqlDataReader dataReader = command.ExecuteReader(); //on teste d'abord s'il a trouvé un enregistrement if (dataReader.HasRows) { dataReader.Read(); r.NumeroRDV = num; r.DateRDV = (DateTime)dataReader["DateRDV"]; r.HeureRDV = (string)dataReader["HeureRDV"]; r.Code_Medecin = (string)dataReader["Code_Medecin"]; r.Mail_Patient = (string)dataReader["Mail_Patient"]; dataReader.Close(); Database.connection.Close(); return(true); } else { dataReader.Close(); Database.connection.Close(); return(false); } }
public IActionResult SubmitFormAjoutRDVFromPatient(DateTime dateRDV, string inputHeure, string inputCodeMedecin, string inputMailPatient) { if (dateRDV != null && inputHeure != null && inputCodeMedecin != null && inputMailPatient != null) { RDV r = new RDV(); r.DateRDV = dateRDV; r.HeureRDV = inputHeure; r.Code_Medecin = inputCodeMedecin; r.Mail_Patient = inputMailPatient; if (RDV.Save(r)) { Patient p = new Patient(); Patient.Seek(inputMailPatient, ref p); return(RedirectToAction("MesRDV", "Patient", p)); } else { return(RedirectToAction("MesRDV", "Patient", new { message = "Erreur le rendez-vous n'a pas été ajouté dans la base de données" })); } } else { return(RedirectToAction("MesRDV", "Patient", new { message = "Merci de remplir tous les champs" })); } }
public IActionResult SubmitFormModifyRDVFromPatient(int inputNum, DateTime inputDate, string inputHeure, string inputCode) { if (inputDate != null && inputHeure != null) { RDV r = new RDV(); //Database.RechercherRDV(inputNum, r); r.NumeroRDV = inputNum; r.DateRDV = inputDate; r.HeureRDV = inputHeure; r.Code_Medecin = inputCode; r.Mail_Patient = HttpContext.Session.GetString("MailPatient"); if (RDV.Modify(r)) { Patient p = new Patient(); p.Mail_Patient = HttpContext.Session.GetString("MailPatient"); Patient.Seek(p.Mail_Patient, ref p); return(RedirectToAction("MesRDV", "Patient", p)); } else { return(RedirectToAction("MesRDV", "Patient", new { message = "Erreur le rendez-vous n'a pas été modifié dans la base de données" })); } } else { return(RedirectToAction("MesRDV", "Patient", new { message = "Merci de remplir tous les champs" })); } }
public ActionResult Cancel(int rdvID) { RDV rdv = rs.GetById(rdvID); if (rdv.state.Equals(stateRDV.accepted)) { DateTime d1 = DateTime.Now; DateTime d2 = d1.AddDays(1); int res = DateTime.Compare(d2, rdv.date); if (res < 0) { rdv.state = stateRDV.canceled; rs.Update(rdv); rs.Commit(); SetFlash(FlashMessageType.Success, "RDV canceled"); } else { SetFlash(FlashMessageType.Error, "Too Late to cancel RDV"); } } else { SetFlash(FlashMessageType.Warning, "Can't cancele RDV"); } return(RedirectToAction("Index")); }
private void Modifier_Click(object sender, RoutedEventArgs e) { if (data.SelectedItems.Count > 0) { for (int i = 0; i < data.SelectedItems.Count; i++) { //suppression RDV selectedFile = (RDV)data.SelectedItems[i]; int str = Convert.ToInt32(selectedFile.ID); MessageBox.Show("veuillez modifier la date et l'heure seulement "); var item = LS_R.Find(x => x.ID == str); LS_R.Remove(item); //nouvelle creation avec modification cree.Visibility = Visibility.Visible; Conslter.Visibility = Visibility.Collapsed; ajouterP.Visibility = Visibility.Collapsed; ListeP.Visibility = Visibility.Collapsed; a1.Text = Convert.ToString(selectedFile.Nom); a6.Text = Convert.ToString(selectedFile.Date); a2.Text = Convert.ToString(selectedFile.Prenom); a7.Text = Convert.ToString(selectedFile.Heure); a8.Text = Convert.ToString(selectedFile.Objet); id.Text = Convert.ToString(selectedFile.ID); } } }
public List <RDV> SearchByDateDebutAndDateFin(DateTime dd, DateTime df) { List <RDV> ListeDate = new List <RDV>(); try { if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from RDV where DateRDV between '" + dd + "' and '" + df + "'"; cmd.Connection = cn; SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { RDV r = new RDV(); r.CinRDV1 = dr["CinRDV"].ToString(); r.DateRDV1 = Convert.ToDateTime(dr["DateRDV"]); r.Nom1 = dr["Nom"].ToString(); r.Cause1 = dr["Cause"].ToString(); ListeDate.Add(r); } dr.Close(); cn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(ListeDate); }
public static bool ModifierRdv(RDV r) { int i = 0; //on modifie dans la bdd le rdv en question string request = "update RDV set DateRDV=@date,HeureRDV=@heure where (NumeroRDV=@num)"; command = new SqlCommand(request, Database.connection); command.Parameters.Add(new SqlParameter("@num", r.NumeroRDV)); command.Parameters.Add(new SqlParameter("@date", r.DateRDV)); command.Parameters.Add(new SqlParameter("@heure", r.HeureRDV)); Database.connection.Open(); i = command.ExecuteNonQuery(); command.Dispose(); Database.connection.Close(); if (i != 0) { return(true); } else { return(false); } }
public List <RDV> GetRDVByNomAndCIN(string cnf) { List <RDV> ListeDesRecherche = new List <RDV>(); try { if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from RDV where CinRDV like @a or Nom like @b"; cmd.Connection = cn; SqlParameter p1 = new SqlParameter("@a", "%" + cnf + "%"); SqlParameter p2 = new SqlParameter("@b", "%" + cnf + "%"); cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { RDV r = new RDV(); r.CinRDV1 = dr["CinRDV"].ToString(); r.DateRDV1 = Convert.ToDateTime(dr["DateRDV"]); r.Nom1 = dr["Nom"].ToString(); r.Cause1 = dr["Cause"].ToString(); } dr.Close(); cn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(ListeDesRecherche); }
// méthode d'ajoute d'un RDV : public void AddRDV(RDV r) { if (cn.State == ConnectionState.Closed) { cn.Open(); } try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "insert into RDV(CinRDV,DateRDV,Nom,Cause) values(@id,@date,@nom,@cause)"; SqlParameter p1 = new SqlParameter("@id", r.CinRDV1); SqlParameter p2 = new SqlParameter("@date", r.DateRDV1); SqlParameter p3 = new SqlParameter("@nom", r.Nom1); SqlParameter p4 = new SqlParameter("@cause", r.Cause1);; cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.Parameters.Add(p4); cmd.ExecuteNonQuery(); MessageBox.Show("لقد تم اضافة الموعد بنجاح"); } catch (Exception ex) { MessageBox.Show(ex.Message); } cn.Close(); }
public ActionResult Create(RDVModels Rd, int id1) { try { RDV r = new RDV { date = Rd.date, maladi = Rd.maladi, nom = Rd.nom, prenom = Rd.prenom, ville = Rd.ville, id = Rd.id, idMedecin = id1, idPatient = 41, }; Rod.Add(r); Rod.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void UpdateRDV(string cin) { if (cn.State == ConnectionState.Closed) { cn.Open(); } try { RDV r = new RDV(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "update RDV set DateRDV = @date , Nom= @nom , Cause = @cause where CinRDV=" + cin + ""; cmd.Connection = cn; SqlParameter p2 = new SqlParameter("@date", r.DateRDV1); SqlParameter p3 = new SqlParameter("@nom", r.Nom1); SqlParameter p4 = new SqlParameter("@cause", r.Cause1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.Parameters.Add(p4); cmd.ExecuteNonQuery(); cn.Close(); MessageBox.Show("لقد ثم التعديل بنجاح ", "التعديل", MessageBoxButtons.OK); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public List <RDV> listeRDV() { List <RDV> LesRDV = new List <RDV>(); try { if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from RDV "; cmd.Connection = cn; SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { RDV r = new RDV(); r.CinRDV1 = dr["CinRDV"].ToString(); r.DateRDV1 = Convert.ToDateTime(dr["DateRDV"]); r.Nom1 = dr["Nom"].ToString(); r.Cause1 = dr["Cause"].ToString(); LesRDV.Add(r); } dr.Close(); cn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(LesRDV); }
private bool Is4hoursApart(RDV rdvCourant, TimeSpan timeOfDay) { IEnumerable <RDV> rdvs = uow.RDVRepository.Get(); bool IsValid = true; foreach (RDV rdv in rdvs) { if (rdv != null && rdv.RDVID != rdvCourant.RDVID) { if (rdv.DateRDV != null && rdv.HeureRDV != null) { DateTime dateCourante = (DateTime)rdvCourant.DateRDV; dateCourante = dateCourante.AddHours(timeOfDay.Hours).AddMinutes(timeOfDay.Minutes); DateTime tempDate = (DateTime)rdv.DateRDV; tempDate = tempDate.Add((TimeSpan)rdv.HeureRDV); TimeSpan fourHours = new TimeSpan(4, 0, 0); if (tempDate.DayOfYear == dateCourante.DayOfYear) { if (tempDate.TimeOfDay >= dateCourante.TimeOfDay.Subtract(fourHours) && tempDate.TimeOfDay <= dateCourante.TimeOfDay.Add(fourHours)) { IsValid = false; } } } } } return(IsValid); }
public MemoryStream ZipPhotos(RDV rdv) { var outputStream = new MemoryStream(); using (var zip = new ZipFile()) { int i = 1; foreach (PhotoPropriete photo in GetForRDV(rdv.RDVID)) { string ext = System.IO.Path.GetExtension(photo.Url); if (rdv.DateRDV == null) { zip.AddFile(HostingEnvironment.MapPath(photo.Url)).FileName = i + ext; } else { zip.AddFile(HostingEnvironment.MapPath(photo.Url)).FileName = ((DateTime)rdv.DateRDV).ToShortDateString() + "_" + i + ext; } i++; } zip.Save(outputStream); } outputStream.Position = 0; return(outputStream); }
public ActionResult DeleteConfirmed(int id) { RDV rDV = uow.RDVRepository.GetByID((int)id); uow.RDVRepository.DeleteRDV(rDV, uow); uow.Save(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { RDV rDV = db.RDVs.Find(id); db.RDVs.Remove(rDV); db.SaveChanges(); return(RedirectToAction("Index")); }
private void buttonOK_Click(object sender, RoutedEventArgs e) { //on nettoie la liste des rdv de classe RDV.Rdv.Clear(); //on la remplit à nouveau avec cette fois la methode qui cherche que les rdv par date RDV.FillListWithSelectedDate(dateTimePicker1.SelectedDate.Value); //on remplit la datagrid avec le contenu de la liste dataGrid.ItemsSource = RDV.Rdv; }
private void radButRDV_Checked(object sender, RoutedEventArgs e) { //on clear la liste des rdv pour ne pas afficher la liste des rdv en doublons RDV.Rdv.Clear(); //et on la remplit à nouveau RDV.FillList(); //puis on affiche son contenu dans dataGrid.ItemsSource = RDV.Rdv; }
//evenement ajouté dans le xml Title="GestionRDV" Height="377" Width="683" Loaded="OnLoad"> private void OnLoad(object sender, EventArgs e) { List <string> codesMed = new List <string>(); List <string> codesPat = new List <string>(); //on injecte dans nos deux listes les codes patients et codes medecins RDV.InitBoxes(codesMed, codesPat); comboBox1.ItemsSource = codesPat; comboBox2.ItemsSource = codesMed; }
public JsonResult editRendezVous(int id, int userId, [Bind(Include = "date")] RDV rDV) { rDV = db.RDV.Find(id); rDV.state = stateRDV.demand; db.RDV.Attach(rDV); db.SaveChanges(); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult UploadPhoto(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RDV rDV = uow.RDVRepository.GetByID((int)id); return(View(rDV)); }
public JsonResult refusRendezVous(int id) { RDV rDV = db.RDV.Find(id); rDV.state = stateRDV.refused; rs.Update(rDV); rs.Commit(); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Create([Bind(Include = "RDVID,DateRDV,CodePostal,HeureRDV,Commentaire,NomProprietaire,PrenomProprietaire,TelPrincipalProprietaire,TelSecondaire,AdressePropriete,EmailProprietaire,ForfaitID,Ville,AgentID")] RDV rDV) { if (ModelState.IsValid) { rDV.DateDemande = DateTime.Now; uow.RDVRepository.InsertRDV(rDV); uow.Save(); return(RedirectToAction("Index")); } ViewBag.Forfaits = uow.ForfaitRepository.Get(); return(View(rDV)); }
public ActionResult Edit([Bind(Include = "RDVID,DateRDV,HeureRDV,Commentaire,NomProprietaire,PrenomProprietaire,TelPrincipalProprietaire,TelSecondaire,AdressePropriete,EmailProprietaire,ForfaitID,Ville,VisiteVirtuelle,Deplacement,CodePostal,DateDemande,AgentID")] RDV rDV) { if (ModelState.IsValid) { uow.RDVRepository.Update(rDV); uow.Save(); return(RedirectToAction("Index")); } ViewBag.Forfaits = uow.ForfaitRepository.Get(); ViewBag.AgentID = new SelectList(uow.AgentRepository.Get(), "AgentID", "NomAgent", rDV.AgentID); return(View(rDV)); }
public ActionResult Edit([Bind(Include = "RdvID,PatientID,PersonnelID,DateHeureRdv,Motif")] RDV rDV) { if (ModelState.IsValid) { db.Entry(rDV).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "Nom", rDV.PatientID); ViewBag.PersonnelID = new SelectList(db.Personnels, "PersonnelID", "Nom", rDV.PersonnelID); return(View(rDV)); }