Exemplo n.º 1
0
 private void ouvr_Click(object sender, RoutedEventArgs e)
 {
     if (DatagGrid.SelectedIndex != -1)
     {
         DataofOrdo dfg = (DataofOrdo)(DatagGrid.SelectedItem);
         for (int i = 0; i < table.Rows.Count; i++)
         {
             DataRow row = table.Rows[i];
             if (row[0].ToString() == dfg.numero.ToString())
             {
                 string path = row[3].ToString();
                 if (!File.Exists(path))
                 {
                     MessageBox.Show("Le fichier est invalide!");
                 }
                 else
                 {
                     Visualisation.Visibility = Visibility.Visible;
                     Affichage2.Visibility    = Visibility.Hidden;
                     string      convertedXpsDoc = string.Concat(System.IO.Path.GetTempPath(), "\\", Guid.NewGuid().ToString(), ".xps");
                     XpsDocument xpsDocument     = ConvertWordToXps(path, convertedXpsDoc);
                     if (xpsDocument != null)
                     {
                         Viewer.Document = xpsDocument.GetFixedDocumentSequence();
                     }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Aucune ligne sélectionnée!");
     }
 }
Exemplo n.º 2
0
 private void openDirectory_Click(object sender, RoutedEventArgs e)
 {
     if (DatagGrid.SelectedIndex != -1)
     {
         DataofOrdo dfg = (DataofOrdo)(DatagGrid.SelectedItem);
         for (int i = 0; i < table.Rows.Count; i++)
         {
             DataRow row = table.Rows[i];
             if (row[0].ToString() == dfg.numero.ToString())
             {
                 string path = row[3].ToString();
                 path = path.Remove(path.LastIndexOf(@"\"));
                 try
                 {
                     System.Diagnostics.Process process = new System.Diagnostics.Process();
                     process.StartInfo.FileName = path;
                     process.Start();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message.ToString());
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Aucune ligne sélectionnée!");
     }
 }
Exemplo n.º 3
0
 private void Supprimer_Click_1(object sender, RoutedEventArgs e)
 {
     if (DatagGrid.SelectedIndex >= 0)
     {
         DataofOrdo   dataa = (DataofOrdo)(DatagGrid.SelectedItem);
         ConnexionBDD Datab = new ConnexionBDD();
         Datab.connecter();
         String     Command = "DELETE FROM Ordonnance where Id_Ordonnance=" + dataa.numero;
         SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);
         Macmd.ExecuteNonQuery();
         Datab.deconnecter();
         DatagGrid.Items.Remove(dataa);
     }
 }
Exemplo n.º 4
0
 private void Rempliravec(DataTable tmp)
 {
     for (int i = DatagGrid.Items.Count - 1; i >= 0; i--)
     {
         DatagGrid.Items.RemoveAt(i);
     }
     for (int i = tmp.Rows.Count - 1; i >= 0; i--)
     {
         DataRow    dr       = tmp.Rows[i];
         DataofOrdo ordodata = new DataofOrdo();
         ordodata.numero = int.Parse(dr[0].ToString());
         ordodata.date   = DateTime.Parse(dr[2].ToString());
         DatagGrid.Items.Add(ordodata);
     }
 }
Exemplo n.º 5
0
 private void Terminer_Click(object sender, RoutedEventArgs e)
 {
     if (nbre_medic > 0)
     {
         //
         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 Word|*.docx";
         string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
         path = documents + save.InitialDirectory + @"\CureIt\" + path + "_" + this.idPat + @"\Ordonnances";
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         save.InitialDirectory = path;
         save.FileName         = "Ordonnance" + ordonn.Get_Ordo();
         if (save.ShowDialog() == true)
         {
             string     sav = save.FileName;
             Misenforme mis = new Misenforme();
             mis.CreateWordDocument(sav, this.idMed, this.idPat, this.idOrdo);
             ConnexionBDD Datab = new ConnexionBDD();
             Datab.connecter();
             string     filename = save.FileName.Replace("'", "''");
             String     Command  = "update Ordonnance set Fichier_Ordo='" + filename + "' where Id_Ordonnance=" + ordonn.Get_Ordo();
             SqlCommand Macmd    = new SqlCommand(Command, Datab.cnx);
             Macmd.ExecuteNonQuery();
         }
         //
         vider();
         DataofOrdo ordodata = new DataofOrdo();
         ordodata.numero = ordonn.Get_Ordo();
         ordodata.date   = DateTime.Now;
         DatagGrid.Items.Add(ordodata);
         var dataa = new DataTable();
         Affich_Medic_Ajouté.ItemsSource = dataa.DefaultView;
         nbre_medic = 0;
         App.iff.support_fonction.NavigationService.Navigate(new Page_Ordonnance(idPat, idMed, IDFC, IDDOSS, ADMIN, true));
         this.AffichageStack.Visibility = Visibility.Hidden;
         this.Affichage2.Visibility     = Visibility.Visible;
         //for (int i = Affich_Medic_Ajouté.Items.Count - 1; i >= 0; i--) Affich_Medic_Ajouté.Items.RemoveAt(i);
         //ffich_Medic_Ajouté.Items.Clear();
     }
 }
Exemplo n.º 6
0
        //private void Button_Click(object sender, RoutedEventArgs e)
        //{
        //    int index = int.Parse(((Button)e.Source).Uid);
        //    GridCursor.Margin = new Thickness(10 + (200 * index), 45, 0, 10);

        //    switch (index)
        //    {
        //        case 0:
        //            this.AffichageStack.Visibility = Visibility.Visible;
        //            this.Affichage2.Visibility = Visibility.Hidden;
        //            break;
        //        case 1:
        //            this.AffichageStack.Visibility = Visibility.Hidden;
        //            this.Affichage2.Visibility = Visibility.Visible;
        //            break;
        //    }
        //}
        private void loadOrdo()
        {
            table = new DataTable();
            DataGridTextColumn g0 = new DataGridTextColumn();
            DataGridTextColumn g1 = new DataGridTextColumn();

            g0.Binding = new Binding("numero"); g0.Header = ""; g0.MaxWidth = 0;
            g1.Binding = new Binding("date"); g1.Header = "Date"; g1.ClipboardContentBinding.StringFormat = "d";
            DatagGrid.Columns.Add(g0); DatagGrid.Columns.Add(g1);
            DatagGrid.Columns[0].DisplayIndex = 2;
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String Command;

            if (ADMIN)
            {
                Command = "SELECT * from Ordonnance where Id_FC in (SELECT Id_FC from Contient where Id_DM=" + IDDOSS + ")";
            }
            else
            {
                Command = "SELECT * from Ordonnance where Id_FC in (select Id_Fiche_Consultation from Fiche_Consultation where Id_Fiche_Consultation in (SELECT Id_FC from Contient where Id_DM=" + IDDOSS + ") and Id_Med=" + idMed + ")";
            }
            SqlCommand    Macmd = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr    = Macmd.ExecuteReader();

            while (dr.Read())
            {
                DataofOrdo ordodata = new DataofOrdo();
                ordodata.numero = int.Parse(dr[0].ToString());
                ordodata.date   = DateTime.Parse(dr[2].ToString());
                DatagGrid.Items.Add(ordodata);
            }
            dr.Close();
            SqlDataAdapter Daptr = new SqlDataAdapter(Macmd);

            Daptr.Fill(table);
        }
Exemplo n.º 7
0
 private void btnGrid_Click(object sender, RoutedEventArgs e)
 {
     if (DatagGrid.SelectedIndex != -1)
     {
         DataofOrdo dfg = (DataofOrdo)(DatagGrid.SelectedItem);
         for (int i = 0; i < table.Rows.Count; i++)
         {
             DataRow row = table.Rows[i];
             if (row[0].ToString() == dfg.numero.ToString())
             {
                 string path = row[3].ToString();
                 if (File.Exists((string)path))
                 {
                     try
                     {
                         System.Diagnostics.Process process = new System.Diagnostics.Process();
                         process.StartInfo.FileName = path;
                         process.Start();
                     }
                     catch (Exception ex)
                     {
                         MessageBox.Show(ex.Message.ToString());
                     }
                 }
                 else
                 {
                     //Fichier n'existe pas vous voulez creer un nouveau ?
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Aucun compte sélectionné");
     }
 }