Example #1
0
        private void loadExm()
        {
            table = new DataTable();
            DataGridTextColumn g0 = new DataGridTextColumn();
            DataGridTextColumn g1 = new DataGridTextColumn();
            DataGridTextColumn g2 = new DataGridTextColumn();

            g0.Binding = new Binding("numero"); g0.Header = ""; g0.MaxWidth = 0;
            g1.Binding = new Binding("type"); g1.Header = "Type Examen"; g0.Width = 150;
            g2.Binding = new Binding("conclusion"); g2.Header = "Conclusion"; g2.MaxWidth = 300; g2.MinWidth = 300;
            DatagGrid.Columns.Add(g0); DatagGrid.Columns.Add(g1); DatagGrid.Columns.Add(g2);
            DatagGrid.Columns[0].DisplayIndex = 3;
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String        Command = "SELECT * from Examen_Complementaire where Id_Dossier=" + IDDOSS;
            SqlCommand    Macmd   = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr      = Macmd.ExecuteReader();

            while (dr.Read())
            {
                DataofExm ordodata = new DataofExm();
                ordodata.numero     = int.Parse(dr[0].ToString());
                ordodata.type       = dr[2].ToString();
                ordodata.conclusion = dr[3].ToString();
                DatagGrid.Items.Add(ordodata);
            }
            dr.Close();
            SqlDataAdapter Daptr = new SqlDataAdapter(Macmd);

            Daptr.Fill(table);
        }
Example #2
0
        private void btnGrid_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;
            int    i;

            if (btn.Content.ToString() == "Activer")
            {
                i           = 1;
                btn.Content = "Désactiver";
            }
            else
            {
                i           = 0;
                btn.Content = "Activer";
            }
            try
            {
                Dataofgrid   dfg   = (Dataofgrid)(DatagGrid.SelectedItem);
                ConnexionBDD Datab = new ConnexionBDD();
                Datab.connecter();
                String     Command = "update Doctor set EtatCompte=" + i + " where Username='******'";
                SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);
                Macmd.ExecuteNonQuery();
                Datab.deconnecter();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Example #3
0
        public void get_Patient(int idpat, ref string nomcomplet, ref DateTime datnais)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String Command = @"select Nom,Prenom,Date_de_naissance from Patient LEFT OUTER JOIN Person";

            Command = Command + @" on Patient.Id_Person=Person.Id_Person where Id_Patient=" + idpat;
            SqlCommand    Macmd = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr    = Macmd.ExecuteReader();

            if (dr.Read())
            {
                nomcomplet = dr[0].ToString() + " " + dr[1].ToString();
                try
                {
                    datnais = DateTime.Parse(dr[2].ToString());
                }
                catch (Exception ex)
                {
                    ex.GetType();
                }
            }
            Datab.deconnecter();
        }
        private void butouisup_Click(object sender, RoutedEventArgs e)
        {
            DataofFiche  dataa = (DataofFiche)(DatagGrid.SelectedItem);
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     Command = "DELETE FROM Prescrire WHERE Id_Ordonnance in ( SELECT Id_Ordonnance FROM Ordonnance WHERE Id_FC=" + dataa.numero + ")";
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
            Command = "DELETE FROM Ordonnance WHERE Id_FC=" + dataa.numero;
            Macmd   = new SqlCommand(Command, Datab.cnx);
            Macmd.ExecuteNonQuery();
            Command = "DELETE FROM Certeficat_medical WHERE Id_FC=" + dataa.numero;
            Macmd   = new SqlCommand(Command, Datab.cnx);
            Macmd.ExecuteNonQuery();
            Command = "DELETE FROM Fiche_Consultation where Id_Fiche_Consultation=" + dataa.numero;
            Macmd   = new SqlCommand(Command, Datab.cnx);
            Macmd.ExecuteNonQuery();
            Datab.deconnecter();
            DatagGrid.Items.Remove(dataa);
            AffichageStack.IsEnabled   = true;
            confirmstacksup.Visibility = System.Windows.Visibility.Hidden;

            StackModif.IsEnabled = true;
        }
Example #5
0
        private void ajouterlesMedic(int idOrdo, Word.Document doc)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String        Command = @"select Id_Medicament,Forme,Dose,Quantité,Nbre_Utilisation,Dure from Prescrire where Id_Ordonnance=" + idOrdo;
            SqlCommand    Macmd = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr = Macmd.ExecuteReader();
            int           cpt = 1, nb = Nb_Medicament(idOrdo);
            bool          fin = false;

            while (dr.Read())
            {
                string nomedic = dr[0].ToString();
                string forme   = dr[1].ToString();
                string dose    = dr[2].ToString();
                int    quant   = int.Parse(dr[3].ToString());
                string util    = dr[4].ToString();
                string dure    = dr[5].ToString();
                if (cpt == nb)
                {
                    fin = true;
                }
                Ecrire_Medic(doc, cpt, nomedic, forme, dose, quant, util, dure, fin);
                cpt++;
            }
        }
Example #6
0
        private void Button_Click_Modifier(object sender, RoutedEventArgs e)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            if (!BienSelect)
            {
                /*this.Etat_dajoutTxt.Content = "Médicament non valide";
                 * this.Etat_dajoutTxt.Visibility = System.Windows.Visibility.Visible;
                 * this.Etat_dajout.Source = Animations.GetImage(@"False.png");
                 * this.Etat_dajout.Visibility = System.Windows.Visibility.Visible;*/
            }
            else
            {
                String     nomedic = Nom_Medic.Text; String forme = Forme_Medic.Text; String utilis = Nbre_fois.Text + " chaque " + frequence.Text;
                String     dose = Dose_Medic.Text; int quan = int.Parse(Quant_Medic.Text); String durer = Dure.Text;
                String     Command = @"UPDATE Prescrire SET Id_Medicament='" + nomedic + "', Dose='" + dose + "', Forme='" + forme + "', Dure='" + durer + "', Quantité=" + quan + ", Nbre_Utilisation='" + utilis + "' " + medic.Chaine();
                SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);
                Macmd.ExecuteNonQuery();
                this.vider();
                this.addtoListview();
                this.Etat_dajoutTxt.Content    = "Medicament modifié avec succés";
                this.Etat_dajoutTxt.Visibility = System.Windows.Visibility.Visible;
                this.Etat_dajout.Source        = Animations.GetImage(@"True.png");
                this.Etat_dajout.Visibility    = System.Windows.Visibility.Visible;
                addButton.IsEnabled            = true; updateButton.IsEnabled = false;
                Datab.deconnecter();
            }
        }
Example #7
0
        public void Load_Rdv()
        {
            DataGridTextColumn g0 = new DataGridTextColumn(); g0.Binding = new Binding("numero"); g0.Header = ""; g0.MaxWidth = 0;
            DataGridTextColumn g1 = new DataGridTextColumn(); g1.Binding = new Binding("date"); g1.Header = "Date"; g1.MaxWidth = 120; g1.MinWidth = 120;
            DataGridTextColumn g2 = new DataGridTextColumn(); g2.Binding = new Binding("important"); g2.Header = "A notifier"; g2.MaxWidth = 0;
            DataGridTextColumn g3 = new DataGridTextColumn(); g3.Binding = new Binding("lieu"); g3.Header = "Lieu";
            DataGridTextColumn g4 = new DataGridTextColumn(); g4.Binding = new Binding("commentaire"); g4.Header = "Commentaire";
            DataGridTextColumn g5 = new DataGridTextColumn(); g5.Binding = new Binding("nom"); g5.Header = "Nom Patient";

            Rdv_DataGrid.Columns.Add(g0); Rdv_DataGrid.Columns.Add(g1); Rdv_DataGrid.Columns.Add(g2);
            Rdv_DataGrid.Columns.Add(g3); Rdv_DataGrid.Columns.Add(g4); Rdv_DataGrid.Columns.Add(g5);
            g1.ClipboardContentBinding.StringFormat = @"dd/MM/yyyy HH:mm";
            Rdv_DataGrid.Columns[0].DisplayIndex    = 7;
            Rdv_DataGrid.Columns[1].DisplayIndex    = 6;
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string Command = @"select Id_RDV,Date_Rdv,Important,Lieu,Commentaire,Nom,Prenom from [Rendez-vous] LEFT OUTER JOIN Patient";

            Command += @" on [Rendez-vous].Id_Patient=Patient.Id_Patient LEFT OUTER JOIN Person on Patient.Id_Person=Person.Id_Person";
            Command += @" where Id_Rdv in ( SELECT Id_RDV FROM Avoir_RDV WHERE Id_Doctor=" + this.Idmedc + ") order by [Rendez-vous].Date_Rdv";
            SqlCommand    Macmd = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr    = Macmd.ExecuteReader();

            while (dr.Read())
            {
                this.Ajouter_DataGrid(int.Parse(dr[0].ToString()), dr[1].ToString(), int.Parse(dr[2].ToString()), dr[3].ToString(),
                                      dr[4].ToString(), dr[5].ToString() + " " + dr[6].ToString());
            }
            dr.Close();
            Datab.deconnecter();
        }
Example #8
0
        private void doctorMail_LostFocus(object sender, RoutedEventArgs e)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String        Command = @"SELECT COUNT(*) FROM Person WHERE Email='" + this.doctorMail.Text + "'";
            SqlCommand    Macmd   = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr      = Macmd.ExecuteReader();

            if (dr.Read())
            {
                int nb = (int)dr[0];
                if (nb != 0)
                {
                    this.doctorMail.Width       = 100;
                    this.mailpic.Visibility     = vizibl;
                    this.mailWarning.Content    = "Cet Email est déja utilisé";
                    this.mailWarning.Visibility = vizibl;
                    emailverif = false;
                }
                else
                {
                    this.doctorMail.Width       = 160;
                    this.mailpic.Visibility     = Nonvizibl;
                    this.mailWarning.Visibility = Nonvizibl;
                    emailverif = true;
                }
            }
            Datab.deconnecter();
        }
        public void Insert_Exm_Comp()
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            Datab.cmd.CommandType = CommandType.StoredProcedure;
            Datab.cmd.CommandText = "Insert_Examen_Complementaire";
            Datab.cmd.Parameters.Add("@param1", SqlDbType.NVarChar, 50).Value   = this.Type;
            Datab.cmd.Parameters.Add("@param2", SqlDbType.NVarChar, 1000).Value = this.Conclusion;
            Datab.cmd.Parameters.Add("@param3", SqlDbType.Int).Value            = iddoss;
            if (this.Fichier_Relatif != "")
            {
                Datab.cmd.Parameters.Add("@param", SqlDbType.NVarChar).Value = Fichier_Relatif;
            }
            else
            {
                Datab.cmd.Parameters.Add("@param", SqlDbType.NVarChar).Value = "";
            }
            SqlParameter Sort = new SqlParameter("@id", SqlDbType.Int);

            Sort.Direction = ParameterDirection.Output;
            Datab.cmd.Parameters.Add(Sort);
            Datab.cmd.Connection = Datab.cnx;
            Datab.cmd.ExecuteNonQuery();
            Id_Ex_Comp = ((int)Sort.Value);
        }
Example #10
0
        public App()
        {
            int notif = int.Parse(WpfApplication1.Properties.Settings.Default["Notification"].ToString());
            int deco  = int.Parse(WpfApplication1.Properties.Settings.Default["Deconnexion"].ToString());

            if (notif == 0)
            {
                WpfApplication1.Properties.Settings.Default["Notification"] = 8;
                WpfApplication1.Properties.Settings.Default.Save();
            }
            if (deco == 0)
            {
                WpfApplication1.Properties.Settings.Default["Deconnexion"] = 5;
                WpfApplication1.Properties.Settings.Default.Save();
            }
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string     Command = @"SELECT * FROM DOCTOR";
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
            authent = new auth();
            authent.Show();
        }
        private void loadFiche()
        {
            table = new DataTable();
            DataGridTextColumn g0 = new DataGridTextColumn(); g0.Binding = new Binding("numero"); g0.Header = ""; g0.MaxWidth = 0;
            DataGridTextColumn g1 = new DataGridTextColumn(); g1.Binding = new Binding("date"); g1.Header = "Date";
            DataGridTextColumn g2 = new DataGridTextColumn(); g2.Binding = new Binding("diagnostique"); g2.Header = "Diagnostique"; g2.MaxWidth = 150;
            DataGridTextColumn g3 = new DataGridTextColumn(); g3.Binding = new Binding("taillepoids"); g3.Header = "Taille et Poids";
            DataGridTextColumn g4 = new DataGridTextColumn(); g4.Binding = new Binding("tempe"); g4.Header = "Temperature";
            DataGridTextColumn g5 = new DataGridTextColumn(); g5.Binding = new Binding("tention"); g5.Header = "Tention";
            DataGridTextColumn g6 = new DataGridTextColumn(); g6.Binding = new Binding("nomprenom"); g6.Header = "Fait par:";

            DatagGrid.Columns.Add(g0); DatagGrid.Columns.Add(g1); DatagGrid.Columns.Add(g2);
            DatagGrid.Columns.Add(g3); DatagGrid.Columns.Add(g4); DatagGrid.Columns.Add(g5); DatagGrid.Columns.Add(g6);
            g1.ClipboardContentBinding.StringFormat = "d";
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String Command = "select Id_Fiche_Consultation,Date_F,Diagnostique,[Taille ],Poids,Temperature,Tension,Nom,Prenom from";

            Command += " Fiche_Consultation LEFT OUTER JOIN Doctor on Fiche_Consultation.Id_Med=Doctor.Id_Doctor LEFT OUTER JOIN";
            Command += " Person on Doctor.Id_Person=Person.Id_Person";
            if (!ADMIN)
            {
                Command += " where Id_Doctor=" + IDMED;
            }
            SqlCommand    Macmd = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr    = Macmd.ExecuteReader();

            while (dr.Read())
            {
                DataofFiche datfich = new DataofFiche();
                datfich.numero       = int.Parse(dr[0].ToString());
                datfich.date         = DateTime.Parse(dr[1].ToString());
                datfich.diagnostique = dr[2].ToString();
                datfich.taillepoids  = dr[3].ToString() + " - " + dr[4].ToString();
                datfich.tempe        = dr[5].ToString();
                datfich.tention      = dr[6].ToString();
                datfich.nomprenom    = dr[7].ToString() + " " + dr[8].ToString();
                if ((datfich.taillepoids == " - ") || (datfich.taillepoids == "0 - 0"))
                {
                    datfich.taillepoids = "";
                }
                if (datfich.tempe == "0")
                {
                    datfich.tempe = "";
                }
                if (datfich.tention == "0")
                {
                    datfich.tention = "";
                }
                DatagGrid.Items.Add(datfich);
            }
            dr.Close();
            SqlDataAdapter Daptr = new SqlDataAdapter(Macmd);

            Daptr.Fill(table);
            Datab.deconnecter();
        }
Example #12
0
        public void Update2(String Attribut, int NvlValeur)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string     Command = @"Update Rendez-vous SET " + Attribut + "=" + NvlValeur + " where Id_RDV=" + Id_Rdv;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #13
0
        public void Update_Date(DateTime NvlValeur)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string     Command = @"Update Rendez-vous SET " + "Date_Heure" + "='" + NvlValeur + "' where Id_RDV=" + Id_Rdv;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #14
0
        public void Delete_Fiche_Consultation()
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     Command = "DELETE FROM Fiche_Consultation where Fiche_Consultation.Id_Fiche_Consultation=" + this.Id_FC;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #15
0
        public void Update(String Attribut, String NvlValeur)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string     Command = @"Update Doctor SET " + Attribut + "='" + NvlValeur + "' where Id_Doctor=" + Id_Doc;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #16
0
        public void Ajouter_Asso(String Table, String Attribut, int Id_Att)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     command = @"INSERT INTO " + Table + " (Id_DM," + Attribut + ") values (" + Id_DM + "," + Id_Att + ")";
            SqlCommand Macmd   = new SqlCommand(command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
        private void CreerNvExamen()
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     Command = @"INSERT INTO Examen_Clinique (Id_FC) values (" + IDFC + ")";
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #18
0
        public void Update_Date(String Attribut, DateTime NvlDate)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string     Command = @"Update Examen SET " + "Date_comp" + "='" + NvlDate.Date + "' where Id_Doctor=" + Id_Examen;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #19
0
        public void update_Id_pat(int Id_pat)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            string     Command = @"Update [Rendez-vous] SET Id_Patient = " + Id_pat + " WHERE Id_RDV=" + Id_Rdv;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #20
0
        private void DeleteRdv(int id)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     Command = @"DELETE FROM [Rendez-vous] where Id_RDV=" + id;
            SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
        }
Example #21
0
        //private void Id_box_TextChanged(object sender, TextChangedEventArgs e)
        //{
        //    if (Id_box.Text != "")
        //    {
        //        int ii_pp = -1;
        //        ConnexionBDD Datab = new ConnexionBDD();
        //        Datab.connecter();
        //        String command = "SELECT Id_Person From Patient WHERE Id_Patient=" + Id_box.Text;
        //        SqlCommand Macmd = new SqlCommand(command, Datab.cnx);
        //        SqlDataReader dr;
        //        dr = Macmd.ExecuteReader();
        //        if (dr.Read())
        //        {
        //            ii_pp = (int)dr["Id_Person"];
        //        }
        //        dr.Close();
        //        if (ii_pp != -1)
        //        {
        //            String command1 = "SELECT * FROM Person WHERE Id_Person=" + ii_pp;
        //            SqlCommand Macmd1 = new SqlCommand(command1, Datab.cnx);
        //            dr = Macmd1.ExecuteReader();
        //            if (dr.Read())
        //            {
        //                nom_patt = dr["Nom"].ToString();
        //                prenom_patt = dr["Prenom"].ToString();
        //            }
        //            dr.Close();
        //            textbox_name_pat.Text = nom_patt + " " + prenom_patt;
        //        }
        //        else
        //        {
        //            textbox_name_pat.Clear();
        //        }
        //    }

        //    else
        //    {
        //        textbox_name_pat.Clear();
        //    }
        //}
        private void Insert_av_rdv()
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     command = "INSERT INTO Avoir_RDV Values (" + Rdv.get_Id_RDV() + "," + Idmedc + ")";
            SqlCommand Macmd   = new SqlCommand(command, Datab.cnx);

            Macmd.ExecuteNonQuery();
            Datab.deconnecter();
        }
Example #22
0
        private void Lier()
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     command = "INSERT INTO Contient values (" + this.id_dm + "," + this.id_fc + ")";
            SqlCommand Macmd   = new SqlCommand(command, Datab.cnx);

            Macmd.ExecuteNonQuery();
            Datab.deconnecter();
        }
Example #23
0
 private void DeleteRdv(int id)
 {
     if (App.acc != null)
     {
         ConnexionBDD Datab = new ConnexionBDD();
         Datab.connecter();
         String     Command = @"DELETE FROM [Rendez-vous] where Id_RDV=" + id;
         SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);
         Macmd.ExecuteNonQuery();
         App.acc.pagerdv.supprRow(id);
     }
 }
        private void ic_valider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String Command = "Update Fiche_Consultation  SET Tension='" + Tent.Text + "'";

            Command = Command + ", Poids=";
            if (Pds.Text != "")
            {
                Command = Command + "TRY_CONVERT(float,'" + Pds.Text + "')";
            }
            else
            {
                Command = Command + "null";
            }
            Command = Command + ", Taille=";
            if (Tay.Text != "")
            {
                Command = Command + int.Parse(Tay.Text);
            }
            else
            {
                Command = Command + "null";
            }
            Command = Command + ", Temperature=";
            if (Temp.Text != "")
            {
                Command = Command + "TRY_CONVERT(float,'" + Temp.Text + "')";
            }
            else
            {
                Command = Command + "null";
            }
            Command = Command + ", Diagnostique='" + diagno.Text + "'";
            Command = Command + " where Id_Fiche_Consultation=" + this.id_fich;
            SqlCommand Macmd = new SqlCommand(Command, Datab.cnx);

            Macmd.ExecuteNonQuery();
            StackModif.Visibility    = System.Windows.Visibility.Hidden;
            RecStackModif.Visibility = System.Windows.Visibility.Hidden;
            DataofFiche dofich = new DataofFiche();

            dofich.tention      = Tent.Text; dofich.taillepoids = Tay.Text + " - " + Pds.Text; dofich.tempe = Temp.Text;
            dofich.diagnostique = diagno.Text;
            DataofFiche dof = (DataofFiche)(this.DatagGrid.SelectedItem);

            dofich.date = dof.date; dofich.nomprenom = dof.nomprenom; dofich.numero = dof.numero;
            DatagGrid.Items.Insert(DatagGrid.SelectedIndex, dofich);
            DatagGrid.Items.Remove(dof);
            AffichageStack.IsEnabled = true;
        }
Example #25
0
        /*Recherche des medicaments qui commence par la chaine Medic*/
        public static void Select_Medic(DataTable DATBL)
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String     command = @"select Medicament from Medicaments";
            SqlCommand Macmd   = new SqlCommand(command, Datab.cnx);

            Macmd.ExecuteNonQuery();
            SqlDataAdapter Daptr = new SqlDataAdapter(Macmd);

            Daptr.Fill(DATBL);
        }
Example #26
0
 private void doctorUsername_LostFocus(object sender, RoutedEventArgs e)
 {
     saisiFrame.Visibility = Nonvizibl;
     if (this.doctorUsername.Text.Trim() == "")
     {
         this.doctorUsername.Width       = 100;
         this.usernamepic.Visibility     = vizibl;
         this.usernameWarning.Content    = "Non Rempli!";
         this.usernameWarning.Visibility = vizibl;
         userverif = false;
     }
     else
     {
         if (this.doctorUsername.Text.Length <= 5)
         {
             this.doctorUsername.Width       = 100;
             this.usernamepic.Visibility     = vizibl;
             this.usernameWarning.Content    = "Nom d'utilisateur trés court";
             this.usernameWarning.Visibility = vizibl;
             userverif = false;
         }
         else
         {
             ConnexionBDD Datab = new ConnexionBDD();
             Datab.connecter();
             String        Command = @"SELECT COUNT(*) FROM Doctor WHERE Username='******'";
             SqlCommand    Macmd   = new SqlCommand(Command, Datab.cnx);
             SqlDataReader dr      = Macmd.ExecuteReader();
             if (dr.Read())
             {
                 int nb = (int)dr[0];
                 if (nb != 0)
                 {
                     this.doctorUsername.Width       = 100;
                     this.usernamepic.Visibility     = vizibl;
                     this.usernameWarning.Content    = "Nom d'utilisateur déja utilisé";
                     this.usernameWarning.Visibility = vizibl;
                     userverif = false;
                 }
                 else
                 {
                     this.doctorUsername.Width       = 160;
                     this.usernamepic.Visibility     = Nonvizibl;
                     this.usernameWarning.Visibility = Nonvizibl;
                     userverif = true;
                 }
             }
             Datab.deconnecter();
         }
     }
 }
 private void Supprimer_Click_1(object sender, RoutedEventArgs e)
 {
     if (DatagGrid.SelectedIndex >= 0)
     {
         DataofLettre dataa = (DataofLettre)(DatagGrid.SelectedItem);
         ConnexionBDD Datab = new ConnexionBDD();
         Datab.connecter();
         String     Command = "DELETE FROM Lettre where Id_Lettre=" + dataa.numero;
         SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);
         Macmd.ExecuteNonQuery();
         Datab.deconnecter();
         DatagGrid.Items.Remove(dataa);
     }
 }
Example #28
0
        private void loadCompte()
        {
            table = new DataTable();
            DataGridTextColumn g0 = new DataGridTextColumn();
            DataGridTextColumn g1 = new DataGridTextColumn();
            DataGridTextColumn g2 = new DataGridTextColumn();
            DataGridTextColumn g3 = new DataGridTextColumn();
            DataGridTextColumn g4 = new DataGridTextColumn();
            DataGridTextColumn g5 = new DataGridTextColumn();

            g0.Binding = new Binding("Nom");
            g1.Binding = new Binding("Prenom");
            g2.Binding = new Binding("Spécialité");
            g3.Binding = new Binding("Username");
            g4.Binding = new Binding("Type");
            g5.Binding = new Binding("Etat");
            g0.Header  = "Nom"; g1.Header = "Prenom"; g2.Header = "Spécialité";
            g3.Header  = "Username"; g4.Header = "Type compte"; g5.Header = "Etat";
            DatagGrid.Columns.Add(g0); DatagGrid.Columns.Add(g1); DatagGrid.Columns.Add(g2);
            DatagGrid.Columns.Add(g3); DatagGrid.Columns.Add(g4); DatagGrid.Columns.Add(g5);
            DatagGrid.Columns[0].DisplayIndex = 6;
            DatagGrid.Columns.Remove(g5);
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            String        Command = "Select Nom,Prenom,Spécialité,Username,CompteAdmin as [Type compte],EtatCompte as [Etat compte],Passwordd from Doctor LEFT OUTER JOIN Person on Doctor.Id_Person=Person.Id_Person where CompteAdmin!='Admin'";
            SqlCommand    Macmd   = new SqlCommand(Command, Datab.cnx);
            SqlDataReader dr      = Macmd.ExecuteReader();

            while (dr.Read())
            {
                Dataofgrid gg = new Dataofgrid();
                gg.Nom        = dr[0].ToString(); gg.Prenom = dr[1].ToString();
                gg.Spécialité = dr[2].ToString(); gg.Username = dr[3].ToString();
                gg.Type       = dr[4].ToString();
                if (dr[5].ToString() == "1")
                {
                    gg.Etat = "Désactiver";
                }
                else
                {
                    gg.Etat = "Activer";
                }
                DatagGrid.Items.Add(gg);
            }
            dr.Close();
            SqlDataAdapter Daptr = new SqlDataAdapter(Macmd);

            Daptr.Fill(table);
        }
Example #29
0
        private void update_table_rdv()
        {
            ConnexionBDD Datab = new ConnexionBDD();

            Datab.connecter();
            SqlCommand cmd = new SqlCommand("SP_Update_table_rdv", Datab.cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param;

            param       = cmd.Parameters.Add("@dt", SqlDbType.DateTime);
            param.Value = DateTime.Now;
            cmd.ExecuteNonQuery();
            Datab.deconnecter();
        }
Example #30
0
        private void butouisup_Click(object sender, RoutedEventArgs e)
        {
            //DataGrid Dg = (Rdv_DataGrid) as DataGrid;
            //DataRowView Drv = Dg.SelectedItem as DataRowView;
            //if (Drv != null)
            //{
            //    ConnexionBDD Datab = new ConnexionBDD();
            //    Datab.connecter();
            //    DateTime dt = (DateTime)Drv["Date"];
            //    this.deletefromNotif(dt);
            //    int imp = (int)Drv["Important"];
            //    String lieu = Drv["Lieu"].ToString();
            //    String cmnt = Drv["Commentaire"].ToString();
            //    SqlCommand cmd = new SqlCommand("SP_DELETE_RDV", Datab.cnx);
            //    cmd.CommandType = CommandType.StoredProcedure;
            //    SqlParameter param1, param2, param3, param4;
            //    param1 = cmd.Parameters.Add("@dt", SqlDbType.DateTime);
            //    param1.Value = dt;
            //    param2 = cmd.Parameters.Add("@imp", SqlDbType.Int);
            //    param2.Value = imp;
            //    param3 = cmd.Parameters.Add("@lieu", SqlDbType.NVarChar, 50);
            //    param3.Value = lieu;
            //    param4 = cmd.Parameters.Add("@cmnt", SqlDbType.NVarChar, 1000);
            //    param4.Value = cmnt;
            //    cmd.ExecuteNonQuery();
            //    load_tab_grid();

            //}
            if (Rdv_DataGrid.SelectedIndex > -1)
            {
                DataOfRdv    datardv = (DataOfRdv)(Rdv_DataGrid.SelectedItem);
                ConnexionBDD Datab   = new ConnexionBDD();
                Datab.connecter();
                string     Command = @"DELETE FROM [Rendez-vous] where Id_RDV=" + datardv.numero;
                SqlCommand Macmd   = new SqlCommand(Command, Datab.cnx);
                Macmd.ExecuteNonQuery();
                Command = @"DELETE from Avoir_RDV where Id_RDV=" + datardv.numero;
                Macmd   = new SqlCommand(Command, Datab.cnx);
                Macmd.ExecuteNonQuery();
                Rdv_DataGrid.Items.Remove(datardv);
                confirmsupp.Visibility      = System.Windows.Visibility.Hidden;
                Recconfirmsupp.Visibility   = System.Windows.Visibility.Hidden;
                Stacksuppsucc.Visibility    = System.Windows.Visibility.Visible;
                RecStacksuppsucc.Visibility = System.Windows.Visibility.Visible;
                RdvGrd.IsEnabled            = false;
                this.vider();
            }
        }