Exemple #1
0
        string IntfDalAbonnement.insertAbonnement(crlAbonnement Abonnement)
        {
            #region declaration
            IntfDalAbonnement serviceAbonnement = new ImplDalAbonnement();
            int    nombreInsertion      = 0;
            string numAbonnement        = "";
            string strValueNumSociete   = "";
            string strValueNumOrganisme = "";
            string strIndividu          = "";
            #endregion

            #region implementation
            if (Abonnement != null)
            {
                Abonnement.NumAbonnement = serviceAbonnement.getNumAbonnement(Abonnement.agent.agence.SigleAgence);

                if (Abonnement.NumSociete != "")
                {
                    strValueNumSociete = "'" + Abonnement.NumSociete + "'";
                }
                else
                {
                    strValueNumSociete = "NULL";
                }
                if (Abonnement.NumOrganisme != "")
                {
                    strValueNumOrganisme = "'" + Abonnement.NumOrganisme + "'";
                }
                else
                {
                    strValueNumOrganisme = "NULL";
                }
                if (Abonnement.NumIndividu != "")
                {
                    strIndividu = "'" + Abonnement.NumIndividu + "'";
                }
                else
                {
                    strIndividu = "NULL";
                }

                this.strCommande  = "INSERT INTO `abonnement` (`numAbonnement`,`numIndividu`,`matriculeAgent`,`numSociete`,`numOrganisme`,`dateAbonnement`,";
                this.strCommande += " `imageAbonner`) VALUES ('" + Abonnement.NumAbonnement + "'," + strIndividu + ",";
                this.strCommande += " '" + Abonnement.MatriculeAgent + "'," + strValueNumSociete + "," + strValueNumOrganisme + ",'" + Abonnement.DateAbonnement.ToString("yyyy-MM-dd") + "',";
                this.strCommande += " '" + Abonnement.ImageAbonner + "')";

                this.serviceConnectBase.openConnection();
                nombreInsertion = this.serviceConnectBase.requete(this.strCommande);
                if (nombreInsertion == 1)
                {
                    numAbonnement = Abonnement.NumAbonnement;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numAbonnement);
        }
Exemple #2
0
        bool IntfDalAbonnement.updateAbonnement(crlAbonnement Abonnement)
        {
            #region declaration
            bool   isUpdate             = false;
            int    nbUpdate             = 0;
            string strValueNumSociete   = "";
            string strValueNumOrganisme = "";
            string strIndividu          = "";
            #endregion

            #region implementation
            if (Abonnement != null)
            {
                if (Abonnement.NumSociete != "")
                {
                    strValueNumSociete = "'" + Abonnement.NumSociete + "'";
                }
                else
                {
                    strValueNumSociete = "NULL";
                }
                if (Abonnement.NumOrganisme != "")
                {
                    strValueNumOrganisme = "'" + Abonnement.NumOrganisme + "'";
                }
                else
                {
                    strValueNumOrganisme = "NULL";
                }
                if (Abonnement.NumIndividu != "")
                {
                    strIndividu = "'" + Abonnement.NumIndividu + "'";
                }
                else
                {
                    strIndividu = "NULL";
                }

                this.strCommande  = "UPDATE `abonnement` SET `matriculeAgent`='" + Abonnement.MatriculeAgent + "',";
                this.strCommande += " `numIndividu`=" + strIndividu + ", `numOrganisme`=" + strValueNumOrganisme + ",";
                this.strCommande += " `numSociete`=" + strValueNumSociete + ", `dateAbonnement`='" + Abonnement.DateAbonnement.ToString("yyyy-MM-dd") + "',";
                this.strCommande += " `imageAbonner`='" + Abonnement.ImageAbonner + "'";
                this.strCommande += " WHERE `numAbonnement`='" + Abonnement.NumAbonnement + "'";

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

            return(isUpdate);
        }
Exemple #3
0
        string IntfDalAbonnement.isAbonnement(crlAbonnement abonnement)
        {
            #region declaration
            string numAbonnement     = "";
            string strWhereSociete   = "";
            string strWhereOrganisme = "";
            string strWhereClient    = "";
            #endregion


            #region implementation
            if (abonnement != null)
            {
                if (abonnement.NumSociete != "")
                {
                    strWhereSociete = "`numSociete`='" + abonnement.NumSociete + "'";
                }
                else if (abonnement.NumOrganisme != "")
                {
                    strWhereOrganisme = "`numOrganisme`='" + abonnement.NumOrganisme + "'";
                }
                else if (abonnement.NumIndividu != "")
                {
                    strWhereClient = "`numIndividu`='" + abonnement.NumIndividu + "'";
                }

                this.strCommande  = "SELECT * FROM `abonnement` WHERE " + strWhereSociete + " " + strWhereOrganisme + " " + strWhereClient + " AND";
                this.strCommande += " `numAbonnement` <> '" + abonnement.NumAbonnement + "'";

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

            return(numAbonnement);
        }
Exemple #4
0
        crlAbonnement IntfDalAbonnement.selectAbonnement(string numAbonnement)
        {
            #region declaration
            IntfDalIndividu  serviceIndividu  = new ImplDalIndividu();
            IntfDalAgent     serviceAgent     = new ImplDalAgent();
            IntfDalOrganisme serviceOrganisme = new ImplDalOrganisme();
            IntfDalSociete   serviceSociete   = new ImplDalSociete();
            crlAbonnement    Abonnement       = null;
            #endregion

            #region implementation
            if (numAbonnement != "")
            {
                this.strCommande  = "SELECT * FROM `abonnement` WHERE `numAbonnement`='" + numAbonnement + "' OR";
                this.strCommande += " `numIndividu`='" + numAbonnement + "' OR `numSociete`='" + numAbonnement + "' OR";
                this.strCommande += " `numOrganisme`='" + numAbonnement + "'";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        Abonnement = new crlAbonnement();
                        if (this.reader.Read())
                        {
                            Abonnement.NumAbonnement  = this.reader["numAbonnement"].ToString();
                            Abonnement.NumIndividu    = this.reader["numIndividu"].ToString();
                            Abonnement.MatriculeAgent = this.reader["matriculeAgent"].ToString();
                            Abonnement.NumOrganisme   = this.reader["numOrganisme"].ToString();
                            Abonnement.NumSociete     = this.reader["numSociete"].ToString();
                            try
                            {
                                Abonnement.DateAbonnement = Convert.ToDateTime(this.reader["dateAbonnement"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            Abonnement.ImageAbonner = this.reader["imageAbonner"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                if (Abonnement != null)
                {
                    if (Abonnement.NumIndividu != "")
                    {
                        Abonnement.individu = serviceIndividu.selectIndividu(Abonnement.NumIndividu);
                    }
                    if (Abonnement.MatriculeAgent != "")
                    {
                        Abonnement.agent = serviceAgent.selectAgent(Abonnement.MatriculeAgent);
                    }
                    if (Abonnement.NumOrganisme != "")
                    {
                        Abonnement.organisme = serviceOrganisme.selectOrganisme(Abonnement.NumOrganisme);
                    }
                    if (Abonnement.NumSociete != "")
                    {
                        Abonnement.societe = serviceSociete.selectSociete(Abonnement.NumSociete);
                    }
                }
            }
            #endregion

            return(Abonnement);
        }
Exemple #5
0
        bool IntfDalAbonnement.updateAbonnementAll(crlAbonnement Abonnement)
        {
            #region declaration
            bool              isUpdate          = false;
            string            numAbonnement     = "";
            string            numSociete        = "";
            string            numOrganisme      = "";
            string            numClient         = "";
            IntfDalAbonnement serviceAbonnement = new ImplDalAbonnement();
            IntfDalSociete    serviceSociete    = new ImplDalSociete();
            IntfDalOrganisme  serviceOrganisme  = new ImplDalOrganisme();
            IntfDalIndividu   serviceIndividu   = new ImplDalIndividu();
            #endregion

            #region implementation
            if (Abonnement != null)
            {
                if (Abonnement.agent != null)
                {
                    #region client
                    if (Abonnement.individu != null)
                    {
                        if (Abonnement.individu.NumIndividu != "")
                        {
                            numClient = serviceIndividu.isIndividu(Abonnement.individu);
                            if (numClient == "")
                            {
                                serviceIndividu.updateIndividu(Abonnement.individu);
                            }
                        }
                        else
                        {
                            Abonnement.individu.NumIndividu = serviceIndividu.isIndividu(Abonnement.individu);
                            if (Abonnement.individu.NumIndividu == "")
                            {
                                Abonnement.individu.NumIndividu = serviceIndividu.insertIndividu(Abonnement.individu, Abonnement.agent.agence.SigleAgence);
                            }
                            else
                            {
                                serviceIndividu.updateIndividu(Abonnement.individu);
                            }
                        }

                        if (Abonnement.individu.NumIndividu != "")
                        {
                            Abonnement.NumIndividu = Abonnement.individu.NumIndividu;
                        }
                    }
                    #endregion

                    #region SOciete
                    if (Abonnement.societe != null)
                    {
                        if (Abonnement.societe.NumSociete != "")
                        {
                            numSociete = serviceSociete.isSociete(Abonnement.societe);
                            if (numSociete == "")
                            {
                                serviceSociete.updateSociete(Abonnement.societe);
                            }
                        }
                        else
                        {
                            Abonnement.societe.NumSociete = serviceSociete.isSociete(Abonnement.societe);
                            if (Abonnement.societe.NumSociete == "")
                            {
                                Abonnement.societe.NumSociete = serviceSociete.insertSociete(Abonnement.societe, Abonnement.agent.agence.SigleAgence);
                            }
                            else
                            {
                                serviceSociete.updateSociete(Abonnement.societe);
                            }
                        }



                        if (Abonnement.societe.NumSociete != "")
                        {
                            Abonnement.NumSociete = Abonnement.societe.NumSociete;
                        }
                    }

                    #endregion

                    #region Organisme
                    if (Abonnement.organisme != null)
                    {
                        if (Abonnement.organisme.NumOrganisme != "")
                        {
                            numOrganisme = serviceOrganisme.isOrganisme(Abonnement.organisme);
                            if (numOrganisme == "")
                            {
                                serviceOrganisme.updateOrganisme(Abonnement.organisme);
                            }
                        }
                        else
                        {
                            Abonnement.organisme.NumOrganisme = serviceOrganisme.isOrganisme(Abonnement.organisme);
                            if (Abonnement.organisme.NumOrganisme == "")
                            {
                                Abonnement.organisme.NumOrganisme = serviceOrganisme.insertOrganisme(Abonnement.organisme, Abonnement.agent.agence.SigleAgence);
                            }
                            else
                            {
                                serviceOrganisme.updateOrganisme(Abonnement.organisme);
                            }
                        }

                        if (Abonnement.organisme.NumOrganisme != "")
                        {
                            Abonnement.NumOrganisme = Abonnement.organisme.NumOrganisme;
                        }
                    }
                    #endregion

                    if (Abonnement.MatriculeAgent != "")
                    {
                        numAbonnement = serviceAbonnement.isAbonnement(Abonnement);

                        if (numAbonnement == "")
                        {
                            isUpdate = serviceAbonnement.updateAbonnement(Abonnement);
                        }
                    }
                }
            }
            #endregion

            return(isUpdate);
        }