public MedecinDetailsViewModel() { using (var sQLiteOperation = new SQLiteOperation(".\\AquaDB.db")) { sQLiteOperation.Get <Medecin>().ForEach(med => { var medecin = new MedecinModel { IdMedecin = med.IdMedecin, Nom = med.Nom, Prenom = med.Prenom, Date_Naiss = med.Date_Naiss.ToShortDateString(), Adresse = med.Adresse, Num_Tel = med.Num_Tel, Email = med.Email, Specialite = med.Specialite, Date_Inscr = med.Date_Inscr.ToShortDateString(), IsSelected = false }; LstMedecin.Add(medecin); }); } }
public Réserver(MedecinModel m, ServiceModel s, int patientID) { InitializeComponent(); dateTimePicker2.MinDate = DateTime.Today; medec = m; idService = s.ServiceID; label1.Text = s.ServiceNom; label2.Text = m.NomPrenom; var client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:61585/api"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = client.GetAsync(client.BaseAddress + "/Patients/" + patientID).Result; if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync().Result; var p = new PatientModel(); Newtonsoft.Json.JsonConvert.PopulateObject(data.ToString(), p); label8.Text = p.NomPrenom; patien = p; } }
private void button1_Click_1(object sender, EventArgs e) { MedecinModel md = (MedecinModel)metroComboBox1.SelectedItem; ServiceModel s = (ServiceModel)metroComboBox2.SelectedItem; Réserver r = new Réserver(md, s, idPatient); r.Show(); }
public static MedecinModel ToModel(this Medecin dto) { MedecinModel result = new MedecinModel(); result.Id = dto.Id; result.CoupeId = dto.CoupeId; result.Nom = dto.Nom; result.Prenom = dto.Prenom; result.Telephone = dto.Telephone; result.MailContact = dto.MailContact; return(result); }
public JsonResult Delete(MedecinModel model) { try { var dbItem = this.repository.Read(model.Id); this.repository.Delete(dbItem); return(Json(model)); } catch { throw; } }
public JsonResult Update(MedecinModel model) { try { var dbmodel = this.repository.Read(m => m.Id == model.Id).First(); dbmodel.MailContact = model.MailContact; dbmodel.Nom = model.Nom; dbmodel.Prenom = model.Prenom; dbmodel.Telephone = model.Telephone; this.repository.Update(dbmodel); return(Json(dbmodel.ToModel())); } catch { throw; } }
public Medecin(int id) { InitializeComponent(); var client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:61585/api"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = client.GetAsync(client.BaseAddress + "/Medecin/get/" + id).Result; if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync().Result; Newtonsoft.Json.JsonConvert.PopulateObject(data.ToString(), mdc); MessageBox.Show("Bonjour " + mdc.MedecinNom + " " + mdc.MedecinPrenom); } else { mdc = null; } }
public JsonResult Create(MedecinModel medecin) { try { this.repository.Create(new Medecin { Nom = medecin.Nom, Prenom = medecin.Prenom, Telephone = medecin.Telephone, MailContact = medecin.MailContact, CoupeId = 1 }); var dbItem = this.repository.Read(m => m.Nom == medecin.Nom && m.Prenom == medecin.Prenom).First(); medecin.Id = dbItem.Id; return(Json(medecin)); } catch { throw; } }
private void button3_Click(object sender, EventArgs e) { MedecinModel md = (MedecinModel)metroComboBox1.SelectedItem; string g = metroDateTime1.Value.Year + "-" + metroDateTime1.Value.Month + "-" + metroDateTime1.Value.Day; var client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:61585/api");//ywali medecin selectionne client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = client.GetAsync(client.BaseAddress + "/Rdvs/disponibilities/" + md.MedecinID + "/" + g).Result; if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync().Result; var dayIntervals = new List <DayIntervals>(); Newtonsoft.Json.JsonConvert.PopulateObject(data.ToString(), dayIntervals); int i = 0; foreach (DayIntervals d in dayIntervals) { Panel p = new System.Windows.Forms.Panel(); p.Size = new Size(152, 322); p.BackColor = Color.White; Panel tete = new System.Windows.Forms.Panel(); tete.Size = new Size(152, 63); tete.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); Label l = new System.Windows.Forms.Label(); l.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); l.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); l.ForeColor = System.Drawing.Color.White; //nom du jour i l.Text = d.day.ToString("dddd"); l.Location = new System.Drawing.Point(3, 4); tete.Controls.Add(l); Label lm = new System.Windows.Forms.Label(); lm.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); lm.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lm.ForeColor = System.Drawing.Color.White; //date lm.Text = d.day.ToString(); lm.Location = new System.Drawing.Point(3, 28); tete.Controls.Add(lm); p.Controls.Add(tete); int j = 0; foreach (Interval inter in d.intervals) { Label lp = new Label(); lp.BackColor = System.Drawing.Color.DarkGray; lp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lp.ForeColor = System.Drawing.Color.White; //disponbilite lp.Text = "de " + inter.debut.ToString("HH:mm") + " à " + inter.fin.ToString("HH:mm"); lp.AutoSize = true; lp.Location = new System.Drawing.Point(3, 60 + (j + 1) * 28); p.Controls.Add(lp); j++; } p.Location = new System.Drawing.Point(i * 160, 0); i++; panel3.Controls.Add(p); } panel3.Visible = true; button1.Visible = true; } }