Example #1
0
        bool IntfDalGareRoutiere.deleteGareRoutiere(crlGareRoutiere gareRoutiere)
        {
            #region declaration
            bool isDelete     = false;
            int  nombreDelete = 0;
            #endregion

            #region implementation
            if (gareRoutiere != null)
            {
                if (gareRoutiere.numerosGareRoutiere != "")
                {
                    this.strCommande = "DELETE FROM `gareRoutiere` WHERE (`numerosGareRoutiere` = '" + gareRoutiere.numerosGareRoutiere + "')";
                    this.serviceConnectBase.openConnection();
                    nombreDelete = this.serviceConnectBase.requete(this.strCommande);
                    if (nombreDelete == 1)
                    {
                        isDelete = true;
                    }
                    this.serviceConnectBase.closeConnection();
                }
            }
            #endregion

            return(isDelete);
        }
Example #2
0
        string IntfDalGareRoutiere.insertGareRoutiere(crlGareRoutiere gareRoutiere)
        {
            #region declaration
            IntfDalGareRoutiere serviceGareRoutiere = new ImplDalGareRoutiere();
            int    nombreInsertion     = 0;
            string numerosGareRoutiere = "";
            #endregion

            #region implementation
            if (gareRoutiere != null)
            {
                gareRoutiere.numerosGareRoutiere = serviceGareRoutiere.getNumerosGareRoutiere(gareRoutiere.nomProvince);
                this.strCommande  = "INSERT INTO `gareroutiere` (`numerosGareRoutiere`,`nomProvince`,`localisation`,`sigleGare`,`numVille`) ";
                this.strCommande += "VALUES ('" + gareRoutiere.numerosGareRoutiere + "', '" + gareRoutiere.nomProvince + "','" + gareRoutiere.localisation + "', '" + gareRoutiere.sigleGare.ToUpper() + "','" + gareRoutiere.NumVille + "')";

                this.serviceConnectBase.openConnection();
                nombreInsertion = this.serviceConnectBase.requete(this.strCommande);
                if (nombreInsertion == 1)
                {
                    numerosGareRoutiere = gareRoutiere.numerosGareRoutiere;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numerosGareRoutiere);
        }
Example #3
0
        bool IntfDalGareRoutiere.isGareRoutiere(crlGareRoutiere gareRoutiere)
        {
            #region declaration
            bool isGareRoutiere = false;
            #endregion

            #region implementation
            if (gareRoutiere != null)
            {
                this.strCommande = "SELECT * FROM `gareRoutiere` WHERE (`numerosGareRoutiere`<>'" + gareRoutiere.numerosGareRoutiere + "')";
                this.serviceConnectBase.openConnection();
                reader = this.serviceConnectBase.select(this.strCommande);
                if (reader != null)
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            if (gareRoutiere.sigleGare.Trim().ToLower().Equals(reader["sigleGare"].ToString().Trim().ToLower()))
                            {
                                isGareRoutiere = true;
                                break;
                            }
                        }
                    }
                    reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(isGareRoutiere);
        }
Example #4
0
        bool IntfDalGareRoutiere.updateGareRoutiere(crlGareRoutiere gareRoutiere)
        {
            #region declaration
            bool isUpdate     = false;
            int  nombreUpdate = 0;
            #endregion

            #region implementation
            if (gareRoutiere != null)
            {
                if (gareRoutiere.numerosGareRoutiere != "")
                {
                    this.strCommande  = "UPDATE `gareRoutiere` SET `nomProvince` = '" + gareRoutiere.nomProvince + "', `numVille`='" + gareRoutiere.NumVille + "',";
                    this.strCommande += "`localisation`='" + gareRoutiere.localisation + "', `sigleGare`='" + gareRoutiere.sigleGare + "' ";
                    this.strCommande += "WHERE (`numerosGareRoutiere`='" + gareRoutiere.numerosGareRoutiere + "')";
                    this.serviceConnectBase.openConnection();
                    nombreUpdate = this.serviceConnectBase.requete(this.strCommande);
                    if (nombreUpdate == 1)
                    {
                        isUpdate = true;
                    }
                    this.serviceConnectBase.closeConnection();
                }
            }
            #endregion

            return(isUpdate);
        }
Example #5
0
        crlGareRoutiere IntfDalGareRoutiere.selectGareRoutiere(string numerosGareRoutiere)
        {
            #region declaration
            crlGareRoutiere gareRoutiere = null;
            crlProvince     province     = null;
            IntfDalVille    serviceVille = new ImplDalVille();
            #endregion

            #region implementation
            if (numerosGareRoutiere != "")
            {
                this.strCommande = "SELECT * FROM `gareRoutiere` WHERE (`numerosGareRoutiere`='" + numerosGareRoutiere + "')";
                this.serviceConnectBase.openConnection();
                reader = this.serviceConnectBase.select(this.strCommande);
                if (reader != null)
                {
                    if (reader.HasRows)
                    {
                        if (reader.Read())
                        {
                            gareRoutiere = new crlGareRoutiere();
                            province     = new crlProvince();
                            gareRoutiere.numerosGareRoutiere = reader["numerosGareRoutiere"].ToString();
                            gareRoutiere.nomProvince         = reader["nomProvince"].ToString();
                            gareRoutiere.localisation        = reader["localisation"].ToString();
                            gareRoutiere.sigleGare           = reader["sigleGare"].ToString();
                            gareRoutiere.NumVille            = reader["numVille"].ToString();
                            province.nomProvince             = reader["nomProvince"].ToString();
                            gareRoutiere.province            = province;
                        }
                    }
                    reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                if (gareRoutiere != null)
                {
                    if (gareRoutiere.NumVille != "")
                    {
                        gareRoutiere.ville = serviceVille.selectVille(gareRoutiere.NumVille);
                    }
                }
            }
            #endregion

            return(gareRoutiere);
        }