Пример #1
0
        string IntfDalParamVehicule.insertParamVehicule(crlParamVehicule paramVehicule, string sigleAgence)
        {
            #region declaration
            string numParamVehicule = "";
            IntfDalParamVehicule serviceParamVehicule = new ImplDalParamVehicule();
            int nombreInsert = 0;
            #endregion

            #region implementation
            if (paramVehicule != null)
            {
                if (sigleAgence != "")
                {
                    paramVehicule.NumParamVehicule = serviceParamVehicule.getNumParamVehicule(sigleAgence);

                    this.strCommande  = "INSERT INTO `paramvehicule` (`numParamVehicule`,`nbPassagerMin`,`avanceCarburantMax`,";
                    this.strCommande += " `avanceChauffeurMax`,`poidBagageMax`,`fond`) VALUES";
                    this.strCommande += " ('" + paramVehicule.NumParamVehicule + "', " + paramVehicule.NbPassagerMin + ",";
                    this.strCommande += " '" + paramVehicule.AvanceCarburantMax + "','" + paramVehicule.AvanceChauffeurMax + "',";
                    this.strCommande += " '" + paramVehicule.PoidBagageMax + "','" + paramVehicule.Fond + "')";

                    this.serviceConnection.openConnection();
                    nombreInsert = this.serviceConnection.requete(this.strCommande);
                    if (nombreInsert == 1)
                    {
                        numParamVehicule = paramVehicule.NumParamVehicule;
                    }
                    this.serviceConnection.closeConnection();
                }
            }
            #endregion

            return(numParamVehicule);
        }
Пример #2
0
        crlVehicule IntfDalVehicule.selectVehicule(string numVehicule)
        {
            #region declaration
            crlVehicule vehicule = null;

            IntfDalProprietaire  serviceProprietaire  = new ImplDalProprietaire();
            IntfDalSourceEnergie serviceSourceEnergie = new ImplDalSourceEnergie();
            IntfDalParamVehicule serviceParamVehicule = new ImplDalParamVehicule();
            #endregion

            #region implementation
            if (numVehicule != "")
            {
                this.strCommande = "SELECT * FROM `vehicule` WHERE (`numVehicule`='" + numVehicule + "')";

                this.serviceConnection.openConnection();
                if (this.serviceConnection.IsConnection)
                {
                    this.reader = this.serviceConnection.select(this.strCommande);
                    if (this.reader != null)
                    {
                        if (this.reader.HasRows)
                        {
                            if (this.reader.Read())
                            {
                                vehicule = new crlVehicule();
                                vehicule.MarqueVehicule    = this.reader["marqueVehicule"].ToString();
                                vehicule.NumParamVehicule  = this.reader["numParamVehicule"].ToString();
                                vehicule.MatriculeVehicule = this.reader["matriculeVehicule"].ToString();
                                try
                                {
                                    vehicule.NombreColoneVehicule = int.Parse(this.reader["nombreColoneVehicule"].ToString());
                                }
                                catch (Exception)
                                {
                                }
                                vehicule.NumMoteurVehicule = this.reader["numMoteurVehicule"].ToString();
                                vehicule.NumProprietaire   = this.reader["numProprietaire"].ToString();
                                vehicule.NumSerieVehicule  = this.reader["numSerieVehicule"].ToString();
                                vehicule.NumVehicule       = this.reader["numVehicule"].ToString();
                                vehicule.CouleurVehicule   = this.reader["couleurVehicule"].ToString();
                                try
                                {
                                    vehicule.PlacesAssiseVehicule = int.Parse(this.reader["placesAssiseVehicule"].ToString());
                                }
                                catch (Exception)
                                {
                                }
                                try
                                {
                                    vehicule.PoidsTotalVehicule = double.Parse(this.reader["poidsTotalVehicule"].ToString());
                                }
                                catch (Exception)
                                {
                                }
                                try
                                {
                                    vehicule.PoidsVideVehicule = double.Parse(this.reader["poidsVideVehicule"].ToString());
                                }
                                catch (Exception)
                                {
                                }
                                vehicule.PuissanceVehicule = this.reader["puissanceVehicule"].ToString();
                                vehicule.SourceEnergie     = this.reader["sourceEnergie"].ToString();
                                vehicule.TypeVehicule      = this.reader["typeVehicule"].ToString();
                                vehicule.ImageVehicule     = this.reader["imageVehicule"].ToString();
                            }
                        }
                        this.reader.Dispose();
                    }

                    while (this.serviceConnection.IsConnection)
                    {
                        this.serviceConnection.closeConnection();
                    }
                }

                if (vehicule != null)
                {
                    if (vehicule.SourceEnergie != "")
                    {
                        vehicule.sourceEnergieObj = serviceSourceEnergie.selectSourceEnergie(vehicule.SourceEnergie);
                    }
                    if (vehicule.NumProprietaire != "")
                    {
                        vehicule.proprietaire = serviceProprietaire.selectProprietaire(vehicule.NumProprietaire);
                    }
                    if (vehicule.NumParamVehicule != "")
                    {
                        vehicule.paramVehicule = serviceParamVehicule.selectParamVehicule(vehicule.NumParamVehicule);
                    }
                }
            }
            #endregion

            return(vehicule);
        }