示例#1
0
        private bool validate_pdelete(string name)
        {
            Esculape call = new Esculape();


            call.db_connection();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "DELETE patients FROM patients WHERE name = '" + comboBox1.Text + "';";
            cmd.Connection  = call.connect;
            MySqlDataReader delete = cmd.ExecuteReader();

            MessageBox.Show("Supression du patient : " + name + "");


            if (delete.Read())
            {
                call.connect.Close();
                return(true);
            }
            else
            {
                call.connect.Close();
                return(false);
            }
        }
示例#2
0
        private bool validate_mdelete(string name)
        {
            Esculape call = new Esculape();


            call.db_connection();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "DELETE medecins, user_account FROM user_account INNER JOIN medecins ON user_account.ssnumber = medecins.mssnumber WHERE user_account.user_name = '" + comboBox1.Text + "'; ";
            cmd.Connection  = call.connect;
            MySqlDataReader delete = cmd.ExecuteReader();

            MessageBox.Show("Supression du médecin : " + name + "");



            if (delete.Read())
            {
                call.connect.Close();
                return(true);
            }
            else
            {
                call.connect.Close();
                return(false);
            }
        }
        private bool validate_mregister(string name, string surname, string m_username, string m_password, string m_ssnumber)
        {
            Esculape call = new Esculape();
            string   cat  = "medecin";

            call.db_connection();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "INSERT INTO medecins(mname, mregisterdate, msurname, mssnumber) VALUES ('" + mname.Text + "', '" + mregisterdate.Value.Date.ToString("dd/MM/yyyy") + "', '" + msurname.Text + "', '" + mssnumber.Text + "')";
            cmd.Connection  = call.connect;
            MySqlDataReader register = cmd.ExecuteReader();


            call.db_connection();
            MySqlCommand cmd2 = new MySqlCommand();

            cmd2.CommandText = "INSERT INTO user_account(user_name, password, category, ssnumber) VALUES ('" + musername.Text + "', '" + mpassword.Text + "', '" + cat + "', '" + mssnumber.Text + "')";
            cmd2.Connection  = call.connect;
            cmd2.ExecuteNonQuery();



            if (register.Read())
            {
                call.connect.Close();
                return(true);
            }
            else
            {
                call.connect.Close();
                return(false);
            }
        }
示例#4
0
        void Fillcombobox()
        {
            Esculape call = new Esculape();

            call.db_connection();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "SELECT name FROM patients";
            cmd.Connection  = call.connect;
            MySqlDataReader combo = cmd.ExecuteReader();

            while (combo.Read())
            {
                for (int i = 0; i < combo.FieldCount; i++)
                {
                    comboBox1.Items.Add(combo.GetString(i));
                }
            }
            combo.Close();
            call.connect.Close();
        }
示例#5
0
        private bool validate_pregister(string name, string surname, string ssnumber)
        {
            Esculape call = new Esculape();

            call.db_connection();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "INSERT INTO patients(name, bday, ssnumber, surname) VALUES ('" + pname.Text + "', '" + bdayPicker.Value.Date.ToString("dd/MM/yyyy") + "', '" + pssnumber.Text + "', '" + psurname.Text + "') ";
            cmd.Connection  = call.connect;
            MySqlDataReader register = cmd.ExecuteReader();

            if (register.Read())
            {
                call.connect.Close();
                return(true);
            }
            else
            {
                call.connect.Close();
                return(false);
            }
        }