Exemplo n.º 1
0
        private void chercherRapportJournalier_click(object sender, RoutedEventArgs e)
        {
            string selectedItem = "";

            switch (comboBoxRapportJournalier.SelectionBoxItem.ToString())
            {
            case "Mois":
                selectedItem = "mois";
                break;

            case "Jour":
                selectedItem = "jour";
                break;
            }
            try
            {
                if (DatePickerRapportJournalier.SelectedDate.ToString().Equals(""))
                {
                    rapportJournalierDataGrid.ItemsSource = RapportJournalier.chercherRapportJournalier(selectedItem, RapportJournalierSearchText.Text.Replace("'", "''")).DefaultView;
                }
                else
                {
                    rapportJournalierDataGrid.ItemsSource = RapportJournalier.chercherRapportJournalierAvecDate(selectedItem, RapportJournalierSearchText.Text.Replace("'", "''"), (DateTime)DatePickerRapportJournalier.SelectedDate).DefaultView;
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void DeleteRapportJournalier_Click(object sender, RoutedEventArgs e)
        {
            DataRowView dtr = (DataRowView)rapportJournalierDataGrid.SelectedItem;

            RapportJournalier.deleteRapport(dtr["id"].ToString());
            this.PageWindow_Loaded(sender, e);
        }
Exemplo n.º 3
0
        public static void persistRapport(RapportJournalier r)
        {
            SqlConnection c = Connexion.connect();
            SqlCommand    command;
            DateTime      d   = DateTime.Today;
            string        tab = "rapportJournalier(t1_nc,t1_ac,t2_nc,t2_ac,t3_nc,t3_ac,pec_nc,pec_ac,referee,mois,date_creation,jour)";
            string        v   = "values(" + Convert.ToInt32(r.T1NC) + "," + Convert.ToInt32(r.T1AC) + "," + Convert.ToInt32(r.T2NC) + "," + Convert.ToInt32(r.T2AC) + "," + Convert.ToInt32(r.T3NC) + "," + Convert.ToInt32(r.T3AC) + "," + Convert.ToInt32(r.PECNC) + "," + Convert.ToInt32(r.PECAC) + "," + Convert.ToInt32(r.Referee) + ",'" + r.Mois + "','" + r.DateCreation.Date + "','" + r.Jour + "')";
            string        q   = "insert into " + tab + " " + v;

            try
            {
                c.Open();
                command = new SqlCommand(q, c);
                command.ExecuteNonQuery();
                command.Dispose();
                MessageBox.Show("Rapport Journalier crée");
                c.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        public static void CreerRapport()
        {
            try
            {
                RapportJournalier r = new RapportJournalier();
                System.IO.Directory.CreateDirectory("C:/Users/HP/Desktop/RapportJournalier");
                DateTime firstDay = DateTime.Today;

                r.DateCreation = DateTime.Today;
                r.Mois         = DateTime.Now.AddMonths(0).ToString("MMMM", CultureInfo.CreateSpecificCulture("fr"));
                var culture = new System.Globalization.CultureInfo("fr-FR");
                var day     = culture.DateTimeFormat.GetDayName(DateTime.Today.DayOfWeek);
                r.Jour = day.ToString().ToUpper();

                r.T1NC = RapportJournalier.CPNInscription("CPN1", firstDay, "NI").ToString();
                r.T1AC = RapportJournalier.CPNInscription("CPN1", firstDay, "AI").ToString();
                r.T2NC = RapportJournalier.CPNInscription("CPN2", firstDay, "NI").ToString();
                r.T2AC = RapportJournalier.CPNInscription("CPN2", firstDay, "AI").ToString();
                r.T3NC = RapportJournalier.CPNInscription("CPN3", firstDay, "NI").ToString();
                r.T3AC = RapportJournalier.CPNInscription("CPN3", firstDay, "AI").ToString();

                r.PECNC   = RapportJournalier.CpnGarInscription("PEC", firstDay, "NI").ToString();
                r.PECAC   = RapportJournalier.CpnGarInscription("PEC", firstDay, "AI").ToString();
                r.Referee = RapportJournalier.CpnGar("Référée", firstDay).ToString();

                if (!RapportJournalier.Exist(r.Mois, r.DateCreation))
                {
                    Document  doc = new Document(PageSize.A4);
                    PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("C:/Users/HP/Desktop/RapportJournalier/" + r.DateCreation.Day.ToString() + "-" + r.DateCreation.Month.ToString() + "-" + r.DateCreation.Year.ToString() + ".pdf", FileMode.Create));
                    doc.Open();
                    Paragraph titre = new Paragraph("\nFICHE JOURNALIERE\n\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;
                    doc.Add(creation);
                    doc.Add(titre);

                    PdfPTable table = new PdfPTable(5);
                    PdfPCell  cell  = new PdfPCell(new Phrase("ACTIVITES"));
                    cell.Colspan             = 2;
                    cell.Rowspan             = 2;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.VerticalAlignment   = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                    cell                     = new PdfPCell(new Phrase("DATE"));
                    cell.Rowspan             = 2;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.VerticalAlignment   = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                    cell                     = new PdfPCell(new Phrase(DateTime.Today.Day.ToString() + "/" + DateTime.Today.Month.ToString() + "/" + DateTime.Today.Year.ToString()));
                    cell.Colspan             = 2;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.VerticalAlignment   = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                    table.AddCell("NC");
                    table.AddCell("AC");

                    cell         = new PdfPCell(new Phrase("PRENATALES"));
                    cell.Rowspan = 3;
                    table.AddCell(cell);
                    cell                     = new PdfPCell(new Phrase("TRIM I"));
                    cell.Colspan             = 2;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.VerticalAlignment   = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                    table.AddCell(r.T1NC);
                    table.AddCell(r.T1AC);
                    cell                     = new PdfPCell(new Phrase("TRIM II"));
                    cell.Colspan             = 2;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.VerticalAlignment   = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                    table.AddCell(r.T2NC);
                    table.AddCell(r.T2AC);
                    cell                     = new PdfPCell(new Phrase("TRIM III"));
                    cell.Colspan             = 2;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.VerticalAlignment   = Element.ALIGN_CENTER;
                    table.AddCell(cell);
                    table.AddCell(r.T3NC);
                    table.AddCell(r.T3AC);

                    cell         = new PdfPCell(new Phrase("Grossesse à risques dépistés"));
                    cell.Colspan = 3;
                    table.AddCell(cell);
                    table.AddCell(r.PECNC);
                    table.AddCell(r.PECAC);

                    cell         = new PdfPCell(new Phrase("Grossesse à risques référés"));
                    cell.Colspan = 3;
                    table.AddCell(cell);
                    cell         = new PdfPCell(new Phrase(r.Referee));
                    cell.Colspan = 2;
                    table.AddCell(cell);

                    doc.Add(table);
                    doc.Close();
                    RapportJournalier.persistRapport(r);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
 private void CreerRapport_Click(object sender, RoutedEventArgs e)
 {
     RapportJournalier.CreerRapport();
     this.PageWindow_Loaded(sender, e);
 }