Beispiel #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);
        }
Beispiel #2
0
        crlUSCarte IntfDalUSCarte.selectUSCarte(string numCarte)
        {
            #region declaration
            crlUSCarte                    carte                         = null;
            IntfDalAbonnement             serviceAbonnement             = new ImplDalAbonnement();
            IntfDalUSReductionParticulier serviceUSReductionParticulier = new ImplDalUSReductionParticulier();
            #endregion

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

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            carte                           = new crlUSCarte();
                            carte.NumCarte                  = this.reader["numCarte"].ToString();
                            carte.NumAbonnement             = this.reader["numAbonnement"].ToString();
                            carte.NumUSReductionParticulier = this.reader["numUSReductionParticulier"].ToString();
                            carte.NumUSValidationReduction  = this.reader["numUSValidationReduction"].ToString();
                            try
                            {
                                carte.PrixCarte = double.Parse(this.reader["prixCarte"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            carte.NumAgence            = this.reader["numAgence"].ToString();
                            carte.NumAbonnementNV      = this.reader["numAbonnementNV"].ToString();
                            carte.NumAbonnementNVDevis = this.reader["numAbonnementNVDevis"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                if (carte != null)
                {
                    if (carte.NumAbonnement != "")
                    {
                        carte.abonnement = serviceAbonnement.selectAbonnement(carte.NumAbonnement);
                    }
                    if (carte.NumUSReductionParticulier != "")
                    {
                        carte.reductionParticulier = serviceUSReductionParticulier.selectUSReductionParticulier(carte.NumUSReductionParticulier);
                    }
                }
            }
            #endregion

            return(carte);
        }
Beispiel #3
0
        void IntfDalAbonnement.insertToGridAbonnement(GridView gridView, string param, string paramLike, string valueLike)
        {
            #region declaration
            IntfDalAbonnement serviceAbonnement = new ImplDalAbonnement();
            #endregion

            #region implementation

            this.strCommande  = "SELECT abonnement.numAbonnement, abonnement.matriculeAgent,";
            this.strCommande += " abonnement.numSociete, abonnement.numOrganisme,";
            this.strCommande += " abonnement.numIndividu, abonnement.dateAbonnement,";
            this.strCommande += " abonnement.imageAbonner FROM abonnement";
            this.strCommande += " Left Join individu ON individu.numIndividu = abonnement.numIndividu";
            this.strCommande += " Left Join societe ON societe.numSociete = abonnement.numSociete";
            this.strCommande += " Left Join organisme ON organisme.numOrganisme = abonnement.numOrganisme";
            this.strCommande += " WHERE " + paramLike + " LIKE '%" + valueLike + "%'";
            this.strCommande += " ORDER BY " + param;

            gridView.DataSource = serviceAbonnement.getDataTableAbonnement(this.strCommande);
            gridView.DataBind();

            #endregion
        }
Beispiel #4
0
        crlDureeAbonnement IntfDalDureeAbonnement.selectDureeAbonnement(string numDureeAbonnement)
        {
            #region declaration
            crlDureeAbonnement dureeAbonnement = null;

            IntfDalAgent                 serviceAgent                 = new ImplDalAgent();
            IntfDalTrajet                serviceTrajet                = new ImplDalTrajet();
            IntfDalZone                  serviceZone                  = new ImplDalZone();
            IntfDalAbonnement            serviceAbonnement            = new ImplDalAbonnement();
            IntfDalCalculCategorieBillet serviceCalculCategorieBillet = new ImplDalCalculCategorieBillet();
            IntfDalCalculReductionBillet serviceCalculReductionBillet = new ImplDalCalculReductionBillet();
            #endregion

            #region implementation
            if (numDureeAbonnement != "")
            {
                this.strCommande = "SELECT * FROM `dureeabonnement` WHERE (`numDureeAbonnement`='" + numDureeAbonnement + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            dureeAbonnement = new crlDureeAbonnement();
                            try
                            {
                                dureeAbonnement.DateDureeAbonnement = Convert.ToDateTime(this.reader["dateDureeAbonnement"].ToString());
                            }
                            catch (Exception) { }
                            dureeAbonnement.MatriculeAgent     = this.reader["matriculeAgent"].ToString();
                            dureeAbonnement.NumAbonnement      = this.reader["numAbonnement"].ToString();
                            dureeAbonnement.NumDureeAbonnement = this.reader["numDureeAbonnement"].ToString();
                            dureeAbonnement.NumTrajet          = this.reader["numTrajet"].ToString();
                            try
                            {
                                dureeAbonnement.PrixTotal = double.Parse(this.reader["prixTotal"].ToString());
                            }
                            catch (Exception) { }
                            try
                            {
                                dureeAbonnement.PrixUnitaire = double.Parse(this.reader["prixUnitaire"].ToString());
                            }
                            catch (Exception) { }
                            try
                            {
                                dureeAbonnement.ValideAu = Convert.ToDateTime(this.reader["valideAu"].ToString());
                            }
                            catch (Exception) { }
                            try
                            {
                                dureeAbonnement.ValideDu = Convert.ToDateTime(this.reader["valideDu"].ToString());
                            }
                            catch (Exception) { }
                            dureeAbonnement.Zone = this.reader["zone"].ToString();
                            dureeAbonnement.NumCalculCategorieBillet = this.reader["numCalculCategorieBillet"].ToString();
                            dureeAbonnement.NumCalculReductionBillet = this.reader["numCalculReductionBillet"].ToString();
                            dureeAbonnement.ModePaiement             = this.reader["modePaiement"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                if (dureeAbonnement != null)
                {
                    if (dureeAbonnement.MatriculeAgent != "")
                    {
                        dureeAbonnement.agent = serviceAgent.selectAgent(dureeAbonnement.MatriculeAgent);
                    }
                    if (dureeAbonnement.NumAbonnement != "")
                    {
                        dureeAbonnement.abonnement = serviceAbonnement.selectAbonnement(dureeAbonnement.NumAbonnement);
                    }
                    if (dureeAbonnement.NumTrajet != "")
                    {
                        dureeAbonnement.trajet = serviceTrajet.selectTrajet(dureeAbonnement.NumTrajet);
                    }
                    if (dureeAbonnement.Zone != "")
                    {
                        dureeAbonnement.zoneObj = serviceZone.selectZone(dureeAbonnement.Zone);
                    }
                    if (dureeAbonnement.NumCalculCategorieBillet != "")
                    {
                        dureeAbonnement.calculCategorieBillet = serviceCalculCategorieBillet.selectCalculCategorieBillet(dureeAbonnement.NumCalculCategorieBillet);
                    }
                    if (dureeAbonnement.NumCalculReductionBillet != "")
                    {
                        dureeAbonnement.calculReductionBillet = serviceCalculReductionBillet.selectCalculReductionBillet(dureeAbonnement.NumCalculReductionBillet);
                    }
                }
            }
            #endregion

            return(dureeAbonnement);
        }
Beispiel #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);
        }