public Page(string u) { InitializeComponent(); this.user = u; this.hideAllGrids(); CPNNotification.Visibility = Visibility.Hidden; CPoNNotification.Visibility = Visibility.Hidden; Int32 rdv = RDVS.NombreTotalPatient(); TotalPatiente.Content = Convert.ToString(rdv); rdv = RDVS.NombreTotalPatientStatut("En attente"); PatienteEnAttente.Content = rdv.ToString(); rdv = RDVS.NombreTotalPatientStatut("Effectué"); ConsultationEffectuees.Content = rdv.ToString(); rdv = RDVS.NombreTotalPatientType("cpn"); Prenatale.Content = rdv.ToString(); rdv = RDVS.NombreTotalPatientType("cpon"); Postnatale.Content = rdv.ToString(); rdv = RDVS.NombreTotalPatientType("echo"); Echographie.Content = rdv.ToString(); AcceuilGrid.Visibility = Visibility.Visible; if (DateTime.Today.Day.ToString() == "1") { CPNNotification.Visibility = Visibility.Visible; CPoNNotification.Visibility = Visibility.Visible; RapportCPN.CreerRapport(); RapportCPoN.CreerRapport(); } }
private void chercherRapportCPoN_click(object sender, RoutedEventArgs e) { string selectedItem = ""; switch (comboBoxRapportCPoN.SelectionBoxItem.ToString()) { case "Mois": selectedItem = "Mois"; break; } try { if (DatePickerRapportCPoN.SelectedDate.ToString().Equals("")) { rapportCPoNDataGrid.ItemsSource = RapportCPoN.chercherRapportCPoN(selectedItem, RapportCPoNSearchText.Text.Replace("'", "''")).DefaultView; } else { rapportCPoNDataGrid.ItemsSource = RapportCPoN.chercherRapportCPoNAvecDate(selectedItem, RapportCPoNSearchText.Text.Replace("'", "''"), (DateTime)DatePickerRapportCPoN.SelectedDate).DefaultView; } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } }
private void DeleteRapportCPoN_Click(object sender, RoutedEventArgs e) { DataRowView dtr = (DataRowView)rapportCPoNDataGrid.SelectedItem; RapportCPoN.deleteRapport(dtr["id"].ToString()); this.PageWindow_Loaded(sender, e); }
public static void persistRapport(RapportCPoN r) { SqlConnection c = Connexion.connect(); SqlCommand command; DateTime d = DateTime.Today; string tab = "rapportCPoN(Mois,date_creation,precoce,tardive,autre_type,hemorragie,infection,eclampsie,phlebite,mammaire,anemie,autre_complication,pec,referee,fer)"; string v = "values('" + r.Mois + "','" + r.DateCreation.Date + "'," + Convert.ToInt32(r.Precoce) + "," + Convert.ToInt32(r.Tardive) + "," + Convert.ToInt32(r.Autre) + "," + Convert.ToInt32(r.Hemorragie) + "," + Convert.ToInt32(r.Infection) + "," + Convert.ToInt32(r.Eclampsie) + "," + Convert.ToInt32(r.Phlebite) + "," + Convert.ToInt32(r.Mammaire) + "," + Convert.ToInt32(r.Anemie) + "," + Convert.ToInt32(r.AutreComplication) + "," + Convert.ToInt32(r.PEC) + "," + Convert.ToInt32(r.Referee) + "," + Convert.ToInt32(r.Fer) + ")"; string q = "insert into " + tab + " " + v; try { c.Open(); command = new SqlCommand(q, c); command.ExecuteNonQuery(); command.Dispose(); c.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static void CreerRapport() { try { RapportCPoN r = new RapportCPoN(); System.IO.Directory.CreateDirectory("C:/Users/HP/Desktop/RapportCPoN"); var yr = DateTime.Today.Year; var mth = DateTime.Today.Month; DateTime firstDay = new DateTime(yr, mth, 1).AddMonths(-1); DateTime lastDay = new DateTime(yr, mth, 1).AddDays(-1); r.DateCreation = DateTime.Today; r.Mois = DateTime.Now.AddMonths(-1).ToString("MMMM", CultureInfo.CreateSpecificCulture("fr")); r.Precoce = RapportCPoN.NombreCPoN("Précoce", firstDay, lastDay).ToString(); r.Tardive = RapportCPoN.NombreCPoN("Tardive", firstDay, lastDay).ToString(); r.Autre = RapportCPoN.NombreCPoN("Autre", firstDay, lastDay).ToString(); r.Hemorragie = RapportCPoN.NombreCPoNComplication("hemorragie", firstDay, lastDay).ToString(); r.Infection = RapportCPoN.NombreCPoNComplication("infection", firstDay, lastDay).ToString(); r.Eclampsie = RapportCPoN.NombreCPoNComplication("eclampsie", firstDay, lastDay).ToString(); r.Phlebite = RapportCPoN.NombreCPoNComplication("phlebite", firstDay, lastDay).ToString(); r.Mammaire = RapportCPoN.NombreCPoNComplication("mammaire", firstDay, lastDay).ToString(); r.Anemie = RapportCPoN.NombreCPoNComplication("anemie", firstDay, lastDay).ToString(); r.AutreComplication = RapportCPoN.NombreCPoNComplication("autre", firstDay, lastDay).ToString(); r.PEC = RapportCPoN.NombreCponGar("PEC", firstDay, lastDay).ToString(); r.Referee = RapportCPoN.NombreCponGar("Référée", firstDay, lastDay).ToString(); r.Fer = RapportCPoN.NombreCPoNFer(firstDay, lastDay).ToString(); if (!RapportCPoN.Exist(r.Mois, r.DateCreation)) { Document doc = new Document(PageSize.A4); PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("C:/Users/HP/Desktop/RapportCPoN/" + r.DateCreation.Day.ToString() + "-" + r.DateCreation.Month.ToString() + "-" + r.DateCreation.Year.ToString() + ".pdf", FileMode.Create)); doc.Open(); Paragraph titre = new Paragraph("\nCONSULTATION POSTNATALE\n\n"); titre.Alignment = Element.ALIGN_CENTER; Paragraph creation = new Paragraph("Rapport du mois de : " + r.Mois.ToUpper() + "\nDate de création" + r.DateCreation.Date.ToString()); creation.Alignment = Element.ALIGN_RIGHT; Paragraph mois = new Paragraph("Date début :" + firstDay.Date + "\nDate fin :" + lastDay.Date); mois.Alignment = Element.ALIGN_LEFT; doc.Add(creation); doc.Add(mois); doc.Add(titre); PdfPTable table = new PdfPTable(4); PdfPCell cell = new PdfPCell(new Phrase("Performances\n")); cell.Colspan = 3; table.AddCell(cell); table.AddCell("Urbain"); cell = new PdfPCell(new Phrase("Nombre de femmes\nexaminées en consultation\ndu post partum")); cell.Rowspan = 3; table.AddCell(cell); cell = new PdfPCell(new Phrase("Précoce")); cell.Colspan = 2; table.AddCell(cell); table.AddCell(r.Precoce); cell = new PdfPCell(new Phrase("Tardif")); cell.Colspan = 2; table.AddCell(cell); table.AddCell(r.Tardive); cell = new PdfPCell(new Phrase("Autres")); cell.Colspan = 2; table.AddCell(cell); table.AddCell(r.Autre); cell = new PdfPCell(new Phrase("Nombre de cas compliqués\n")); cell.Rowspan = 9; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_CENTER; table.AddCell(cell); cell = new PdfPCell(new Phrase("Complications\n")); cell.Rowspan = 7; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_CENTER; cell.Rotation = 90; table.AddCell(cell); table.AddCell("Hémorragie"); table.AddCell(r.Hemorragie); table.AddCell("Infection puerpérale"); table.AddCell(r.Infection); table.AddCell("Eclampsie"); table.AddCell(r.Eclampsie); table.AddCell("Phlébite"); table.AddCell(r.Phlebite); table.AddCell("Complications mammaires"); table.AddCell(r.Mammaire); table.AddCell("Anémie"); table.AddCell(r.Anemie); table.AddCell("Autres\n"); table.AddCell(r.AutreComplication); cell = new PdfPCell(new Phrase("Nombre de cas compliqués PEC")); cell.Colspan = 2; table.AddCell(cell); table.AddCell(r.PEC); cell = new PdfPCell(new Phrase("Nombre de cas compliqués Référés\n")); cell.Colspan = 2; table.AddCell(cell); table.AddCell(r.Referee); cell = new PdfPCell(new Phrase("Nombre de femmes ayant reçu le Fer")); cell.Colspan = 3; table.AddCell(cell); table.AddCell(r.Fer); doc.Add(table); doc.Close(); RapportCPoN.persistRapport(r); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }