예제 #1
0
        public static void reinitialiserMotPasseVeto(Veterinaires veto,
                                                     string pNouveauCode, string pVerifCode)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                List <Veterinaires> listeVeto  = new List <Veterinaires>();
                SqlDataAdapter      monAdapter = new SqlDataAdapter();
                DataTable           resultat   = new DataTable();
                if (pNouveauCode.Equals(pVerifCode))
                {
                    SqlParameter monParametre;
                    SqlCommand   cmd = (SqlCommand)cnx.CreateCommand();
                    cmd.CommandText = "update Veterinaires set MotPasse = @MotPasse where CodeVeto = @codeVeto";
                    monParametre    = new SqlParameter("@MotPasse", pNouveauCode);
                    cmd.Parameters.Add(monParametre);
                    monParametre = new SqlParameter("@codeVeto", veto.CodeVeto);
                    cmd.Parameters.Add(monParametre);
                    monAdapter.SelectCommand = cmd;
                    monAdapter.Fill(resultat);

                    foreach (DataRow unVeto in resultat.Rows)
                    {
                        listeVeto.Add(new Veterinaires(unVeto));
                    }
                }
            }
        }
예제 #2
0
        public static Veterinaires getOneVeto(Guid pCodeVeto)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                Veterinaires   unVeto      = new Veterinaires();
                SqlDataAdapter monAdapter  = new SqlDataAdapter();
                DataTable      maDataTable = new DataTable();
                SqlParameter   monParametre;

                SqlCommand cmd = (SqlCommand)cnx.CreateCommand();
                cmd.CommandText = " SELECT * " +
                                  " FROM Veterinaires" +
                                  " WHERE CodeVeto = @codeVeto";

                monParametre = new SqlParameter("@codeVeto", pCodeVeto);
                cmd.Parameters.Add(monParametre);

                monAdapter.SelectCommand = cmd;
                monAdapter.Fill(maDataTable);

                foreach (DataRow uneOccurence in maDataTable.Rows)
                {
                    unVeto = new Veterinaires(uneOccurence);
                }


                return(unVeto);
            }
        }
예제 #3
0
        public static void supprimerVeto(Veterinaires veto)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                List <Veterinaires> listeVeto  = new List <Veterinaires>();
                SqlDataAdapter      monAdapter = new SqlDataAdapter();
                DataTable           resultat   = new DataTable();
                SqlCommand          cmd        = (SqlCommand)cnx.CreateCommand();
                cmd.CommandText          = "update Veterinaires set Archive = 1 where CodeVeto = '" + veto.CodeVeto + "'";
                monAdapter.SelectCommand = cmd;
                monAdapter.Fill(resultat);

                foreach (DataRow unVeto in resultat.Rows)
                {
                    listeVeto.Add(new Veterinaires(unVeto));
                }
            }
        }
예제 #4
0
        public static void ajouterDeuxLignesNonFacture(Consultation consultation)
        {
            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                ADO_Animal   monAnimalDAL = new ADO_Animal();
                Veterinaires _veto        = ADO_Veterinaires.getOneVeto(consultation.CodeVeto.Value);
                Animaux      _animaux     = monAnimalDAL.GetOne(consultation.CodeAnimal.Value);

                SqlParameter monParametre;
                SqlCommand   cmd = (SqlCommand)cnx.CreateCommand();

                cmd.CommandText = " exec ajout_Consultation2 @DateConsultation, @nomVeto, @nomAnimal";

                monParametre = new SqlParameter("@nomVeto", _veto.NomVeto);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@nomAnimal", _animaux.NomAnimal);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@DateConsultation", consultation.DateConsultation.Value);
                cmd.Parameters.Add(monParametre);

                cmd.ExecuteNonQuery();
            }
        }
        public static void Add(Agendas monAgenda)
        {
            ADO_Animal  animalDAL = new ADO_Animal();
            ADO_Clients clientDAL = new ADO_Clients();

            Animaux      monAnimal = animalDAL.GetOne(monAgenda.CodeAnimal.Value);
            Clients      monClient = clientDAL.GetOne(monAnimal.CodeClient.Value);
            Veterinaires monVeto   = ADO_Veterinaires.getOneVeto(monAgenda.CodeVeto.Value);

            using (DbConnection cnx = ConnectionBDD.SeConnecter())
            {
                SqlParameter monParametre;

                SqlCommand cmd = (SqlCommand)cnx.CreateCommand();
                cmd.CommandText = " exec ajout_agenda @nomClient, @prenomClient, @nomAnimal, @nomVeto, @dateRdv ;";

                monParametre = new SqlParameter("@nomClient", monClient.NomClient);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@prenomClient", monClient.PrenomClient);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@nomAnimal", monAnimal.NomAnimal);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@nomVeto", monVeto.NomVeto);
                cmd.Parameters.Add(monParametre);
                monParametre = new SqlParameter("@dateRdv", monAgenda.DateRDV);
                cmd.Parameters.Add(monParametre);

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw new Exception("Echec de l'insertion dans l'agnda :\n" + ex.Message);
                }
            }
        }