Example #1
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);
        }
Example #2
0
        int IntfDalUSPrixBase.getNiveauPrixBase(string numLieuD, string numLieuF)
        {
            #region declaration
            int       niveau = -1;
            crlUSLieu lieuD  = null;
            crlUSLieu lieuF  = null;
            crlUSZone zoneD  = null;
            crlUSZone zoneF  = null;

            IntfDalUSLieu     serviceUSLieu     = new ImplDalUSLieu();
            IntfDalUSZone     serviceUSZone     = new ImplDalUSZone();
            IntfDalUSPrixBase serviceUSPrixBase = new ImplDalUSPrixBase();
            #endregion

            #region implementation
            if (numLieuD != "" && numLieuF != "")
            {
                lieuD = serviceUSLieu.selectUSLieu(numLieuD);
                lieuF = serviceUSLieu.selectUSLieu(numLieuF);

                if (lieuD != null && lieuF != null)
                {
                    zoneD = serviceUSZone.selectUSZone(lieuD.NumZone);
                    zoneF = serviceUSZone.selectUSZone(lieuF.NumZone);

                    if (zoneD != null && zoneF != null)
                    {
                        if (zoneD.Niveau == 1 && zoneD.Niveau == zoneF.Niveau)
                        {
                            niveau = 1;
                        }
                        else
                        {
                            if (zoneD.Niveau == 1)
                            {
                                niveau = zoneF.Niveau;
                            }
                            else if (zoneF.Niveau == 1)
                            {
                                niveau = zoneD.Niveau;
                            }
                            else
                            {
                                if (serviceUSPrixBase.isMemeAxe(numLieuD, numLieuF))
                                {
                                    niveau = Math.Abs(zoneD.Niveau - zoneF.Niveau) + 1;
                                }
                                else
                                {
                                    niveau = zoneD.Niveau + zoneF.Niveau;
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            return(niveau);
        }
Example #3
0
        void IntfDalUSPrixBase.insertToGridPrixBase(GridView gridView, string param, string paramLike, string valueLike)
        {
            #region declaration
            IntfDalUSPrixBase serviceUSPrixBase = new ImplDalUSPrixBase();
            #endregion

            #region implementation

            this.strCommande  = "SELECT usprixbase.numPrixBase, usprixbase.montantPrixBase,";
            this.strCommande += " usprixbase.descriptionPrixBase, usprixbase.niveauPrixBase";
            this.strCommande += " FROM usprixbase";
            this.strCommande += " WHERE " + paramLike + " LIKE  '%" + valueLike + "%'";
            this.strCommande += " ORDER BY " + param;


            gridView.DataSource = serviceUSPrixBase.getDataTablePrixBase(this.strCommande);
            gridView.DataBind();
            #endregion
        }
Example #4
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);
        }