Esempio n. 1
0
        bool IntfDalCommune.updateCommune(crlCommune commune)
        {
            #region declaration
            bool isUpdate = false;
            int  nbUpdate = 0;
            #endregion

            #region implementation
            if (commune != null)
            {
                this.strCommande  = "UPDATE `commune` SET `commune`='" + commune.Commune + "',";
                this.strCommande += " `numDistrict`='" + commune.NumDistrict + "' WHERE";
                this.strCommande += " `numCommune`='" + commune.NumCommune + "'";

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

            return(isUpdate);
        }
Esempio n. 2
0
        string IntfDalCommune.insertCommune(crlCommune commune, string sigleAgence)
        {
            #region declaration
            IntfDalCommune serviceCommune = new ImplDalCommune();
            string         numCommune     = "";
            int            nbInsert       = 0;
            #endregion

            #region implementation
            if (commune != null)
            {
                commune.NumCommune = serviceCommune.getNumCommune(sigleAgence);
                this.strCommande   = "INSERT INTO `commune` (`numCommune`,`commune`,`numDistrict`)";
                this.strCommande  += " VALUES ('" + commune.NumCommune + "','" + commune.Commune + "',";
                this.strCommande  += " '" + commune.NumDistrict + "')";

                this.serviceConnectBase.openConnection();
                nbInsert = this.serviceConnectBase.requete(this.strCommande);
                if (nbInsert == 1)
                {
                    numCommune = commune.NumCommune;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numCommune);
        }
Esempio n. 3
0
        string IntfDalCommune.isCommune(crlCommune commune)
        {
            #region declaration
            string numCommune = "";
            #endregion

            #region implementation
            if (commune != null)
            {
                this.strCommande  = "SELECT * FROM `commune` WHERE";
                this.strCommande += " commune.commune = '" + commune.Commune + "' AND";
                this.strCommande += " commune.numDistrict = '" + commune.NumDistrict + "' AND";
                this.strCommande += " commune.numCommune <> '" + commune.NumCommune + "'";

                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["numCommune"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numCommune);
        }
Esempio n. 4
0
        crlCommune IntfDalCommune.selectCommune(string numCommune)
        {
            #region declaration
            crlCommune commune = null;
            #endregion

            #region implementation
            if (numCommune != "")
            {
                this.strCommande = "SELECT * FROM `commune` WHERE `numCommune`='" + numCommune + "'";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            commune             = new crlCommune();
                            commune.Commune     = this.reader["commune"].ToString();
                            commune.NumCommune  = this.reader["numCommune"].ToString();
                            commune.NumDistrict = this.reader["numDistrict"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(commune);
        }
Esempio n. 5
0
        private void afficheQuartierRespSociete(string numQuartier)
        {
            #region delcaration
            crlQuartier quartier = null;
            crlCommune  commune  = null;
            crlDistrict district = null;
            crlRegion   region   = null;
            #endregion

            #region implementation
            if (numQuartier != "")
            {
                quartier = serviceQuartier.selectQuartier(numQuartier);
                if (quartier != null)
                {
                    commune = serviceCommune.selectCommune(quartier.NumCommune);
                    if (commune != null)
                    {
                        district = serviceDistrict.selectDistrict(commune.NumDistrict);
                        if (district != null)
                        {
                            region = serviceRegion.selectRegion(district.NomRegion);
                            if (region != null)
                            {
                                try
                                {
                                    ddlprovinceRespSociete.SelectedValue = region.NomProvince;
                                }
                                catch (Exception)
                                {
                                }
                                this.loadDdlRegionRespSociete();
                                try
                                {
                                    ddlRegionRespSociete.SelectedValue = region.NomRegion;
                                }
                                catch (Exception)
                                {
                                }
                                this.loadDdlDistrictRespSociete();
                                try
                                {
                                    ddlDistrictRespSociete.SelectedValue = district.NumDistrict;
                                }
                                catch (Exception)
                                {
                                }
                                this.loadDdlCommuneRespSociete();
                                try
                                {
                                    ddlCommuneRespSociete.SelectedValue = commune.NumCommune;
                                }
                                catch (Exception)
                                {
                                }
                                this.loadDdlArrondissementRespSociete();
                                try
                                {
                                    ddlArrondissementRespSociete.SelectedValue = quartier.NumArrondissement;
                                }
                                catch (Exception)
                                {
                                }
                                TextQuartierRespSociete.Text = quartier.Quartier;
                            }
                            else
                            {
                                this.loadDdlProvinceRespSociete();
                            }
                        }
                        else
                        {
                            this.loadDdlProvinceRespSociete();
                        }
                    }
                    else
                    {
                        this.loadDdlProvinceRespSociete();
                    }
                }
                else
                {
                    this.loadDdlProvinceRespSociete();
                }
            }
            #endregion
        }