private void Button_Click2(object sender, RoutedEventArgs e) { if (verif()) { String nom = this.nom_med.Text; String adr = this.adr.Text; String spec = this.Spec.Text; String com = this.com.Text; Lettre lettre = new Lettre(nom, spec, adr, com, IDDOSS); lettre.Insert_Nvl_Lettre(); DataofLettre ordodata = new DataofLettre(); ordodata.numero = lettre.Get_id(); ordodata.nom = nom; ordodata.spec = spec; ordodata.adr = adr; ordodata.cmnt = com; DatagGrid.Items.Add(ordodata); string path = ""; DateTime dat = new DateTime(); Misenforme mm = new Misenforme(); mm.get_Patient(IDPAT, ref path, ref dat); SaveFileDialog save = new SaveFileDialog(); save.Filter = "Fichiers PDF|*.pdf"; string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); path = documents + save.InitialDirectory + @"\CureIt\" + path + "_" + IDPAT + @"\Lettres d'orientation"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } save.InitialDirectory = path; save.FileName = "Lettre" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second; if (save.ShowDialog() == true) { string nomdoc = save.FileName; MiseEnFormLettre forme = new MiseEnFormLettre(IDDOSS, IDMED); Document doc = forme.CreateDoc(save.FileName); doc.Open(); doc = forme.Remplir_doc(doc, nom, adr, spec, com, IDMED, IDDOSS); doc.Close(); ConnexionBDD Datab = new ConnexionBDD(); Datab.connecter(); string filename = save.FileName.Replace("'", "''"); String Command = @"update Lettre set Fichier='" + filename + "' where Id_Lettre=" + lettre.Get_id(); SqlCommand Macmd = new SqlCommand(Command, Datab.cnx); Macmd.ExecuteNonQuery(); //App.iff.support_fonction.NavigationService.Navigate(new Page_Lettre_Orientation(IDDOSS, ADMIN, IDMED, true,IDPAT)); //this.AffichageStack.Visibility = Visibility.Hidden; //this.Affichage2.Visibility = Visibility.Visible; } Stackbienajouté.Visibility = System.Windows.Visibility.Hidden; RecStackbienajouté.Visibility = System.Windows.Visibility.Hidden; this.vider(); grdlettre.IsEnabled = true; } else { Stacknonremplett.Visibility = System.Windows.Visibility.Visible; RecStacknonremplett.Visibility = System.Windows.Visibility.Visible; grdlettre.IsEnabled = false; } }
public Document Remplir_doc(Document doc, string com, int i, string period, int id_m, int id_dm) { MiseEnFormLettre forme = new MiseEnFormLettre(id_dm, id_m); String[] Med = forme.Recuperer_info_Docteur(id_m); String[] Pat = forme.Recuperer_info_pat(id_dm); DateTime date = DateTime.Now; iTextSharp.text.Font f1 = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 15f, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK); iTextSharp.text.Font b = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 20f, iTextSharp.text.Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK); iTextSharp.text.Font b1 = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 12f, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK); Paragraph par1 = new Paragraph("Lieu :" + Med[3], f1); Paragraph par2 = new Paragraph(" Téléphone :" + Med[5], f1); Paragraph par3 = new Paragraph(" Email :" + Med[4], f1); String d = date.Day.ToString() + "/" + date.Month.ToString() + "/" + date.Year.ToString(); Paragraph parag0 = new Paragraph("\nLe " + d + "\n\n", b1); parag0.Alignment = Element.ALIGN_RIGHT; doc.Add(par1); doc.Add(par2); doc.Add(par3); doc.Add(parag0); Paragraph parag = new iTextSharp.text.Paragraph("Certificat Medical\n", b); parag.Alignment = Element.ALIGN_CENTER; Paragraph parag1 = new Paragraph("\n\n\n Docteur :" + Med[0] + " " + Med[1] + " Spécialité : " + Med[2], b1); Paragraph parag2 = new Paragraph("\n\n Je soussigné , Docteur :" + Med[0] + " " + Med[1] + " , certifie que l'état de santé de : M." + Pat[0] + " " + Pat[1], b1); Paragraph parag3 = new Paragraph("\nNécessite un traitement avec arret de travail de : " + i + " " + period + " à partir de : " + d, b1); Paragraph parag4 = new Paragraph("\n\n\n\n\n Signature :", b1); doc.Add(parag); doc.Add(parag1); doc.Add(parag2); doc.Add(parag3); doc.Add(parag4); return(doc); }
private void Imprimer_Click(object sender, RoutedEventArgs e) { string typeExa = this.TypeExamen.Text; string cs = this.cause.Text; if (typeExa != "" && cs != "") { // ***************************** USING iTextSharp ************************************ string path = ""; DateTime dat = new DateTime(); Misenforme mm = new Misenforme(); mm.get_Patient(IDPAT, ref path, ref dat); SaveFileDialog save = new SaveFileDialog(); save.Filter = "Fichiers PDF|*.pdf"; string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); path = documents + save.InitialDirectory + @"\CureIt\" + path + "_" + IDPAT + @"\Examens complémentaires"; MessageBox.Show(path); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } save.InitialDirectory = path; save.FileName = "Fiche" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second; if (save.ShowDialog() == true) { MiseEnFormLettre form = new MiseEnFormLettre(IDDOSS, IDMED); String nomdoc = save.FileName; Document doc = form.CreateDoc(nomdoc); doc.Open(); doc = form.Remplir_Exam_comp(doc, IDMED, IDDOSS, typeExa, cs); doc.Close(); System.Diagnostics.Process.Start(nomdoc); } TypeExamen.Text = null; cause.Text = null; } else { //Case vide } }
private void Button_Click2(object sender, RoutedEventArgs e) { if (verif()) { int i = int.Parse(this.nb.Text); if (this.Nbre_jour.Text == "Semaine") { i = i * 7; } if (this.Nbre_jour.Text == "Mois") { i = i * 30; } if (this.Nbre_jour.Text == "Ans") { i = i * 365; } Certaficat_Médical certi = new Certaficat_Médical(i, this.comment.Text); certi.Set_Id_fc(IDFC); certi.insert_nvl_certaficat_medic(); DataofCert ordodata = new DataofCert(); ordodata.numero = certi.Get_Id_Cert(); ordodata.nb = i; ordodata.commentaire = this.comment.Text; DatagGrid.Items.Add(ordodata); //FILEDIALOG string path = ""; DateTime dat = new DateTime(); Misenforme mm = new Misenforme(); mm.get_Patient(this.IDPAT, ref path, ref dat); SaveFileDialog save = new SaveFileDialog(); save.Filter = "Fichiers PDF|*.pdf"; string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); path = documents + save.InitialDirectory + @"\CureIt\" + path + "_" + this.IDPAT + @"\Certificiats"; MessageBox.Show(path); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } save.InitialDirectory = path; save.FileName = "Certificat" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second; if (save.ShowDialog() == true) { string nomdoc = save.FileName; MiseEnFormLettre forme = new MiseEnFormLettre(IDDOSS, IDMED); MiseEnFormCert form = new MiseEnFormCert(IDDOSS, IDMED); Document doc = forme.CreateDoc(nomdoc); doc.Open(); doc = form.Remplir_doc(doc, this.comment.Text, int.Parse(this.nb.Text), this.Nbre_jour.Text, IDMED, IDDOSS); doc.Close(); ConnexionBDD Datab = new ConnexionBDD(); Datab.connecter(); string filename = save.FileName.Replace("'", "''"); String Command = @"update Certeficat_medical set Fichier='" + filename + "' where Id_Cert_Med=" + certi.Get_Id_Cert(); SqlCommand Macmd = new SqlCommand(Command, Datab.cnx); Macmd.ExecuteNonQuery(); App.iff.support_fonction.NavigationService.Navigate(new Page_Certificat(IDFC, IDDOSS, IDMED, ADMIN, true, IDPAT)); this.AffichageStack.Visibility = Visibility.Hidden; this.Affichage2.Visibility = Visibility.Visible; } StackcertbienAjouer.Visibility = System.Windows.Visibility.Visible; RecStackcertbienAjouer.Visibility = System.Windows.Visibility.Visible; grdcert.IsEnabled = false; } else { Stacknonrempcert.Visibility = System.Windows.Visibility.Visible; RecStacknonrempcert.Visibility = System.Windows.Visibility.Visible; grdcert.IsEnabled = false; } }