Example #1
0
        string IntfDalArrondissement.isArrondissement(crlArrondissement arrondissement)
        {
            #region declaration
            string numCommune = "";
            #endregion

            #region implementation
            if (arrondissement != null)
            {
                this.strCommande  = "SELECT * FROM `arrondissement` WHERE";
                this.strCommande += " arrondissement.arrondissement = '" + arrondissement.Arrondissement + "' AND";
                this.strCommande += " arrondissement.numCommune = '" + arrondissement.NumCommune + "' AND";
                this.strCommande += " arrondissement.numArrondissement <> '" + arrondissement.NumArrondissement + "'";

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            numCommune = this.reader["numArrondissement"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numCommune);
        }
Example #2
0
        string IntfDalArrondissement.insertArrondissement(crlArrondissement arrondissement, string sigleAgence)
        {
            #region declaration
            IntfDalArrondissement serviceArrondissement = new ImplDalArrondissement();
            string numArrondissement = "";
            int    nbInsert          = 0;
            #endregion

            #region implementation
            if (arrondissement != null)
            {
                arrondissement.NumArrondissement = serviceArrondissement.getNumArrondissement(sigleAgence);
                this.strCommande  = "INSERT INTO `arrondissement` (`numArrondissement`,`arrondissement`,`numCommune`)";
                this.strCommande += " VALUES ('" + arrondissement.NumArrondissement + "','" + arrondissement.Arrondissement + "',";
                this.strCommande += " '" + arrondissement.NumCommune + "')";

                this.serviceConnectBase.openConnection();
                nbInsert = this.serviceConnectBase.requete(this.strCommande);
                if (nbInsert == 1)
                {
                    numArrondissement = arrondissement.NumArrondissement;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numArrondissement);
        }
Example #3
0
        bool IntfDalArrondissement.updateArrondissement(crlArrondissement arrondissement)
        {
            #region declaration
            bool isUpdate = false;
            int  nbUpdate = 0;
            #endregion

            #region implementation
            if (arrondissement != null)
            {
                this.strCommande  = "UPDATE `arrondissement` SET `arrondissement`='" + arrondissement.Arrondissement + "',";
                this.strCommande += " `numCommune`='" + arrondissement.NumCommune + "' WHERE";
                this.strCommande += " `numArrondissement`='" + arrondissement.NumArrondissement + "'";

                this.serviceConnectBase.openConnection();
                nbUpdate = this.serviceConnectBase.requete(this.strCommande);
                if (nbUpdate == 1)
                {
                    isUpdate = true;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(isUpdate);
        }
Example #4
0
        crlArrondissement IntfDalArrondissement.selectArrondissement(string numArrondissement)
        {
            #region declaration
            crlArrondissement arrondissement = null;
            #endregion

            #region implementation
            if (numArrondissement != "")
            {
                this.strCommande = "SELECT * FROM `arrondissement` WHERE `numArrondissement`='" + numArrondissement + "'";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            arrondissement = new crlArrondissement();
                            arrondissement.Arrondissement    = this.reader["arrondissement"].ToString();
                            arrondissement.NumCommune        = this.reader["numCommune"].ToString();
                            arrondissement.NumArrondissement = this.reader["numArrondissement"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(arrondissement);
        }