Exemple #1
0
        string IntfDalUSPrixBase.isUSPrixBase(crlUSPrixBase prixBase)
        {
            #region declaration
            string numPrixBase = "";
            #endregion

            #region implementation
            if (prixBase != null)
            {
                this.strCommande  = "SELECT * FROM `usprixbase` WHERE (`numPrixBase`<>'" + prixBase.NumPrixBase + "'";
                this.strCommande += " AND `niveauPrixBase`='" + prixBase.NiveauPrixBase + "')";

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

            return(numPrixBase);
        }
Exemple #2
0
        string IntfDalUSPrixBase.insertUSPrixBase(crlUSPrixBase prixBase, string sigleAgence)
        {
            #region declaration
            string            numPrixBase       = "";
            IntfDalUSPrixBase serviceUSPrixBase = new ImplDalUSPrixBase();
            int nbInsert = 0;
            #endregion

            #region implemenation
            if (prixBase != null && sigleAgence != "")
            {
                prixBase.NumPrixBase = serviceUSPrixBase.getNumUSPrixBase(sigleAgence);
                this.strCommande     = "INSERT INTO `usprixbase` (`numPrixBase`,`montantPrixBase`,";
                this.strCommande    += " `descriptionPrixBase`,`niveauPrixBase`)";
                this.strCommande    += " VALUES ('" + prixBase.NumPrixBase + "','" + prixBase.MontantPrixBase.ToString("0") + "',";
                this.strCommande    += " '" + prixBase.DescriptionPrixBase + "','" + prixBase.NiveauPrixBase.ToString("0") + "')";

                this.serviceConnectBase.openConnection();
                nbInsert = this.serviceConnectBase.requete(this.strCommande);
                if (nbInsert == 1)
                {
                    numPrixBase = prixBase.NumPrixBase;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numPrixBase);
        }
Exemple #3
0
        bool IntfDalUSPrixBase.updateUSPrixBase(crlUSPrixBase prixBase)
        {
            #region declaration
            bool isUpdate = false;
            int  nbUpdate = 0;
            #endregion

            #region implementation
            if (prixBase != null)
            {
                this.strCommande  = "UPDATE `usprixbase` SET `montantPrixBase`='" + prixBase.MontantPrixBase.ToString("0") + "',";
                this.strCommande += " `descriptionPrixBase`='" + prixBase.DescriptionPrixBase + "',";
                this.strCommande += " `niveauPrixBase`='" + prixBase.NiveauPrixBase.ToString("0") + "' WHERE";
                this.strCommande += " `numPrixBase`='" + prixBase.NumPrixBase + "'";

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

            return(isUpdate);
        }
Exemple #4
0
        crlUSPrixBase IntfDalUSPrixBase.selectUSPrixBase(int niveau)
        {
            #region declaration
            crlUSPrixBase prixBase = null;
            #endregion

            #region implementation
            if (niveau >= 0)
            {
                this.strCommande = "SELECT * FROM `usprixbase` WHERE (`niveauPrixBase`='" + niveau + "')";

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            prixBase                     = new crlUSPrixBase();
                            prixBase.NumPrixBase         = this.reader["numPrixBase"].ToString();
                            prixBase.DescriptionPrixBase = this.reader["descriptionPrixBase"].ToString();
                            try
                            {
                                prixBase.NiveauPrixBase = int.Parse(this.reader["niveauPrixBase"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            try
                            {
                                prixBase.MontantPrixBase = double.Parse(this.reader["montantPrixBase"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(prixBase);
        }
Exemple #5
0
        DataTable IntfDalUSInfoPasse.getDataTableInfoPasse(string strRqst)
        {
            #region declaration
            DataTable                  dataTable                  = new DataTable();
            IntfDalGeneral             serviceGeneral             = new ImplDalGeneral();
            IntfDalUSPlageNombreBillet serviceUSPlageNombreBillet = new ImplDalUSPlageNombreBillet();
            IntfDalUSReductionBillet   serviceUSReductionBillet   = new ImplDalUSReductionBillet();
            IntfDalUSPrixBase          serviceUSPrixBase          = new ImplDalUSPrixBase();
            crlUSReductionBillet       reduction                  = null;
            crlUSPlageNombreBillet     plageNombreBillet          = null;
            crlUSPrixBase              prixBase = null;
            #endregion

            #region implementation

            #region initialisation du dataTable
            dataTable = new DataTable();
            dataTable.Columns.Add("numInfoPasse", typeof(string));
            dataTable.Columns.Add("nombrePasse", typeof(string));
            dataTable.Columns.Add("niveau", typeof(string));
            dataTable.Columns.Add("prixUnitaire", typeof(string));
            dataTable.Columns.Add("dureeValidite", typeof(string));

            DataRow dr;
            #endregion

            this.serviceConnectBase.openConnection();
            this.reader = this.serviceConnectBase.select(strRqst);
            if (this.reader != null)
            {
                if (this.reader.HasRows)
                {
                    while (this.reader.Read())
                    {
                        dr = dataTable.NewRow();

                        dr["numInfoPasse"] = reader["numInfoPasse"].ToString();
                        dr["nombrePasse"]  = reader["nombrePasse"].ToString();
                        dr["niveau"]       = reader["niveau"].ToString();

                        reduction = serviceUSReductionBillet.selectUSReductionBillet(this.reader["numReductionBillet"].ToString());
                        try
                        {
                            prixBase = serviceUSPrixBase.selectUSPrixBase(int.Parse(reader["niveau"].ToString()));
                        }
                        catch (Exception) { }
                        try
                        {
                            plageNombreBillet = serviceUSPlageNombreBillet.getPlageNombreBillet(int.Parse(reader["nombrePasse"].ToString()));
                        }
                        catch (Exception) { }


                        if (prixBase != null)
                        {
                            if (reduction != null)
                            {
                                if (reduction.ReductionMontant > 0)
                                {
                                    dr["prixUnitaire"] = serviceGeneral.separateurDesMilles((prixBase.MontantPrixBase - reduction.ReductionMontant).ToString("0")) + " Ar";
                                }
                                else
                                {
                                    dr["prixUnitaire"] = serviceGeneral.separateurDesMilles((prixBase.MontantPrixBase - (prixBase.MontantPrixBase * reduction.ReductionPourcentage / 100)).ToString("0")) + " Ar";
                                }
                            }
                            else
                            {
                                dr["prixUnitaire"] = serviceGeneral.separateurDesMilles(prixBase.MontantPrixBase.ToString("0")) + " Ar";
                            }
                        }
                        else
                        {
                            dr["prixUnitaire"] = "";
                        }

                        if (plageNombreBillet != null)
                        {
                            dr["dureeValidite"] = serviceGeneral.getTextTimeSpan(serviceGeneral.getStringTimeSpan(plageNombreBillet.DureeDeValidite));
                        }
                        else
                        {
                            dr["dureeValidite"] = "";
                        }


                        reduction         = null;
                        prixBase          = null;
                        plageNombreBillet = null;


                        dataTable.Rows.Add(dr);
                    }
                }
                this.reader.Dispose();
            }
            this.serviceConnectBase.closeConnection();

            #endregion

            return(dataTable);
        }