Exemple #1
0
        bool IntfDalTrajet.updateTrajet(crlTrajet Trajet)
        {
            #region declaration
            bool isUpdate     = false;
            int  nombreUpdate = 0;
            #endregion

            #region implementation
            if (Trajet != null)
            {
                if (Trajet.NumTrajet != "")
                {
                    this.strCommande  = "UPDATE `trajet` SET `numTarifBaseBillet`='" + Trajet.NumTarifBaseBillet + "',`distanceTrajet`='" + Trajet.DistanceTrajet + "',";
                    this.strCommande += " `dureeTrajet`='" + Trajet.DureeTrajet + "',`numVilleD`='" + Trajet.NumVilleD + "',";
                    this.strCommande += " `numVilleF`='" + Trajet.NumVilleF + "'";
                    this.strCommande += " WHERE (`numTrajet`='" + Trajet.NumTrajet + "')";

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

            return(isUpdate);
        }
Exemple #2
0
        bool IntfDalTrajet.deleteTrajet(crlTrajet Trajet)
        {
            #region declaration
            bool          isDelete      = false;
            int           nombreDelete  = 0;
            IntfDalTrajet serviceTrajet = new ImplDalTrajet();
            #endregion

            #region implementation
            if (Trajet != null)
            {
                if (Trajet.NumTrajet != "")
                {
                    serviceTrajet.deleteAssociationVilleTrajet(Trajet.NumTrajet);
                    this.strCommande = "DELETE FROM `trajet` WHERE (`numTrajet` = '" + Trajet.NumTrajet + "')";
                    this.serviceConnectBase.openConnection();
                    nombreDelete = this.serviceConnectBase.requete(this.strCommande);
                    if (nombreDelete == 1)
                    {
                        isDelete = true;
                    }
                    this.serviceConnectBase.closeConnection();
                }
            }
            #endregion

            return(isDelete);
        }
        DataTable IntfDalCommissionDevis.getDataTableCommissionDevis(string strRqst)
        {
            #region declaration
            DataTable dataTable = new DataTable();

            IntfDalGeneral serviceGeneral = new ImplDalGeneral();
            IntfDalTrajet  serviceTrajet  = new ImplDalTrajet();
            crlTrajet      trajet         = null;
            #endregion

            #region implementation

            #region initialisation du dataTable
            dataTable = new DataTable();
            dataTable.Columns.Add("idCommissionDevis", typeof(string));
            dataTable.Columns.Add("destination", typeof(string));
            dataTable.Columns.Add("prixTotalfraisEnvoi", typeof(string));
            dataTable.Columns.Add("trajet", 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["idCommissionDevis"] = reader["idCommissionDevis"].ToString();
                        dr["destination"]       = reader["destination"].ToString();

                        dr["prixTotalfraisEnvoi"] = serviceGeneral.separateurDesMilles(this.reader["fraisEnvoi"].ToString()) + "Ar";

                        trajet = serviceTrajet.selectTrajet(this.reader["numTrajet"].ToString());
                        if (trajet != null)
                        {
                            dr["trajet"] = trajet.villeD.NomVille + "-" + trajet.villeF.NomVille;
                        }
                        else
                        {
                            dr["trajet"] = "";
                        }
                        trajet = null;
                        dataTable.Rows.Add(dr);
                    }
                }
                this.reader.Dispose();
            }
            this.serviceConnectBase.closeConnection();

            #endregion

            return(dataTable);
        }
Exemple #4
0
        string IntfDalTrajet.isTrajet(crlTrajet Trajet)
        {
            #region declaration
            string isTrajet = "";
            //List<crlTrajet> Trajets = null;
            //IntfDalTrajet serviceTrajet = new ImplDalTrajet();
            #endregion

            #region implementation

            if (Trajet != null)
            {
                this.strCommande  = "SELECT trajet.numTrajet FROM trajet WHERE";
                this.strCommande += " ((trajet.numVilleD = '" + Trajet.NumVilleD + "' AND trajet.numVilleF = '" + Trajet.NumVilleF + "') OR";
                this.strCommande += " (trajet.numVilleF =  '" + Trajet.NumVilleD + "' AND trajet.numVilleD = '" + Trajet.NumVilleF + "')) AND";
                this.strCommande += " trajet.distanceTrajet = '" + Trajet.DistanceTrajet + "' AND";
                this.strCommande += " trajet.numTrajet <> '" + Trajet.NumTrajet + "'";

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

            /*if (Trajet != null)
             * {
             *  Trajets = serviceTrajet.selectTrajets(Trajet.NumTrajet);
             *  if (Trajets != null)
             *  {
             *      for (int i = 0; i < Trajets.Count; i++)
             *      {
             *          if (((Trajets[i].villeD.NumVille.Trim().ToLower().Equals(Trajet.villeD.NumVille.Trim().ToLower()) && Trajets[i].villeF.NumVille.Trim().ToLower().Equals(Trajet.villeF.NumVille.Trim().ToLower())) ||
             *              (Trajets[i].villeF.NumVille.Trim().ToLower().Equals(Trajet.villeD.NumVille.Trim().ToLower()) && Trajets[i].villeD.NumVille.Trim().ToLower().Equals(Trajet.villeF.NumVille.Trim().ToLower()))) &&
             *              Trajets[i].DistanceTrajet == Trajet.DistanceTrajet)
             *          {
             *              isTrajet = Trajets[i].NumTrajet;
             *              break;
             *          }
             *      }
             *  }
             * }*/
            #endregion

            return(isTrajet);
        }
Exemple #5
0
        List <crlTrajet> IntfDalTrajet.selectTrajets(string idItineraire)
        {
            #region declaration
            List <crlTrajet> Trajets       = null;
            crlTrajet        tempTrajet    = null;
            IntfDalTrajet    serviceTrajet = new ImplDalTrajet();
            #endregion

            #region implementation
            this.strCommande  = "SELECT trajet.numTrajet, trajet.numTarifBaseBillet, trajet.distanceTrajet,trajet.numVilleD,";
            this.strCommande += " trajet.dureeTrajet, trajet.numVilleF";
            this.strCommande += " FROM trajet Inner Join associationvilletrajet ON associationvilletrajet.numTrajet = trajet.numTrajet";
            this.strCommande += " Inner Join ville ON ville.numVille = associationvilletrajet.numVille";
            this.strCommande += " Inner Join associationtrajetitineraire ON associationtrajetitineraire.numTrajet = trajet.numTrajet";
            this.strCommande += " WHERE associationtrajetitineraire.idItineraire =  '" + idItineraire + "'";

            this.serviceConnectBase.openConnection();
            reader = this.serviceConnectBase.select(this.strCommande);
            if (reader != null)
            {
                if (reader.HasRows)
                {
                    Trajets = new List <crlTrajet>();
                    while (reader.Read())
                    {
                        tempTrajet                    = new crlTrajet();
                        tempTrajet.NumTrajet          = reader["numTrajet"].ToString();
                        tempTrajet.NumTarifBaseBillet = reader["numTarifBaseBillet"].ToString();
                        tempTrajet.DistanceTrajet     = int.Parse(reader["distanceTrajet"].ToString());
                        tempTrajet.DureeTrajet        = reader["dureeTrajet"].ToString();
                        tempTrajet.NumVilleD          = reader["numVilleD"].ToString();
                        tempTrajet.NumVilleF          = reader["numVilleF"].ToString();

                        Trajets.Add(tempTrajet);
                    }
                }

                reader.Dispose();
            }
            this.serviceConnectBase.closeConnection();
            if (Trajets != null)
            {
                for (int i = 0; i < Trajets.Count; i++)
                {
                    Trajets[i] = serviceTrajet.selectTrajet(Trajets[i].NumTrajet);
                }
            }
            #endregion

            return(Trajets);
        }
Exemple #6
0
        string IntfDalTrajet.insertTrajetAll(crlTrajet Trajet, string sigleAgence)
        {
            #region declaration
            IntfDalTrajet              serviceTrajet              = new ImplDalTrajet();
            IntfDalTarifBaseBillet     serviceTarifBaseBillet     = new ImplDalTarifBaseBillet();
            IntfDalTarifBaseCommission serviceTarifBaseCommission = new ImplDalTarifBaseCommission();

            string numTrajet = "";
            #endregion

            #region implementation
            if (Trajet != null)
            {
                if (Trajet.tarifBaseBillet != null)
                {
                    Trajet.tarifBaseBillet.NumTarifBaseBillet = serviceTarifBaseBillet.insertTarifBaseBillet(Trajet.tarifBaseBillet, sigleAgence);
                    if (Trajet.tarifBaseBillet.NumTarifBaseBillet != "")
                    {
                        Trajet.NumTarifBaseBillet = Trajet.tarifBaseBillet.NumTarifBaseBillet;

                        Trajet.NumTrajet = serviceTrajet.insertTrajet(Trajet, sigleAgence);

                        if (Trajet.NumTrajet != "")
                        {
                            numTrajet = Trajet.NumTrajet;

                            if (Trajet.tarifBaseCommissions != null)
                            {
                                for (int i = 0; i < Trajet.tarifBaseCommissions.Count; i++)
                                {
                                    Trajet.tarifBaseCommissions[i].NumTarifBaseCommission = serviceTarifBaseCommission.insertTarifBaseCommission(Trajet.tarifBaseCommissions[i], sigleAgence);

                                    if (Trajet.tarifBaseCommissions[i].NumTarifBaseCommission != "")
                                    {
                                        serviceTarifBaseCommission.insertAssociationTrajetTarifCommission(Trajet.NumTrajet, Trajet.tarifBaseCommissions[i].NumTarifBaseCommission);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            return(numTrajet);
        }
Exemple #7
0
        public crlCommissionDevis()
        {
            this.IdCommissionDevis = "";
            this.Destination       = "";
            this.FraisEnvoi        = 0;
            this.PieceJustificatif = "";
            this.Poids             = 0;
            this.Nombre            = 0;
            this.NumDesignation    = "";
            this.NumTrajet         = "";
            this.TypeCommission    = "";
            this.NumProforma       = "";
            this.NumExpediteur     = "";
            this.NumRecepteur      = "";

            this.trajet                = null;
            this.typeCommssionObjet    = null;
            this.designationCommission = null;
            this.expediteur            = null;
            this.recepteur             = null;
        }
Exemple #8
0
        string IntfDalTrajet.insertTrajet(crlTrajet Trajet, string sigleAgence)
        {
            #region declaration
            IntfDalTrajet serviceTrajet   = new ImplDalTrajet();
            int           nombreInsertion = 0;
            string        numTrajet       = "";
            #endregion

            #region implementation
            if (Trajet != null)
            {
                Trajet.NumTrajet = serviceTrajet.getNumTrajet(sigleAgence);

                this.strCommande  = "INSERT INTO `trajet` (`numTrajet`,`numTarifBaseBillet`,`distanceTrajet`,`dureeTrajet`,`numVilleD`,`numVilleF`)";
                this.strCommande += " VALUES ('" + Trajet.NumTrajet + "','" + Trajet.NumTarifBaseBillet + "','" + Trajet.DistanceTrajet + "',";
                this.strCommande += " '" + Trajet.DureeTrajet + "', '" + Trajet.NumVilleD + "','" + Trajet.NumVilleF + "')";

                this.serviceConnectBase.openConnection();
                nombreInsertion = this.serviceConnectBase.requete(this.strCommande);
                if (nombreInsertion == 1)
                {
                    numTrajet = Trajet.NumTrajet;
                }
                this.serviceConnectBase.closeConnection();

                if (Trajet.villeD != null)
                {
                    serviceTrajet.insertAssociationVilleTrajet(Trajet, Trajet.villeD);
                }
                if (Trajet.villeF != null)
                {
                    serviceTrajet.insertAssociationVilleTrajet(Trajet, Trajet.villeF);
                }
            }
            #endregion

            return(numTrajet);
        }
Exemple #9
0
        bool IntfDalTrajet.insertAssociationVilleTrajet(crlTrajet Trajet, crlVille Ville)
        {
            #region declaration
            bool isInsert        = false;
            int  nombreInsertion = 0;
            #endregion

            #region implementation
            if (Trajet != null && Ville != null)
            {
                this.strCommande  = "INSERT INTO `associationvilletrajet` (`numTrajet`,`numVille`)";
                this.strCommande += " VALUES ('" + Trajet.NumTrajet + "','" + Ville.NumVille + "')";
                this.serviceConnectBase.openConnection();
                nombreInsertion = this.serviceConnectBase.requete(this.strCommande);
                if (nombreInsertion == 1)
                {
                    isInsert = true;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(isInsert);
        }
        DataTable IntfDalVoyageAbonnementDevis.getDataTableVoyageAbonnementDevis(string strRqst)
        {
            #region declaration
            DataTable      dataTable      = new DataTable();
            IntfDalGeneral serviceGeneral = new ImplDalGeneral();
            IntfDalTrajet  serviceTrajet  = new ImplDalTrajet();
            crlTrajet      trajet         = null;
            double         montantTotal   = 0;
            double         prixUnitaire   = 0;
            int            nbVoyage       = 0;
            #endregion

            #region implementation

            #region initialisation du dataTable
            dataTable = new DataTable();
            dataTable.Columns.Add("numVoyageAbonnementDevis", typeof(string));
            dataTable.Columns.Add("zone", typeof(string));
            dataTable.Columns.Add("nbVoyageAbonnement", typeof(string));
            dataTable.Columns.Add("prixTotal", typeof(string));
            dataTable.Columns.Add("trajet", 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["numVoyageAbonnementDevis"] = reader["numVoyageAbonnementDevis"].ToString();
                        dr["zone"] = reader["zone"].ToString();


                        try
                        {
                            nbVoyage = int.Parse(this.reader["nbVoyageAbonnement"].ToString());
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            prixUnitaire = double.Parse(this.reader["prixUnitaire"].ToString());
                        }
                        catch (Exception)
                        {
                        }

                        dr["nbVoyageAbonnement"] = this.reader["nbVoyageAbonnement"].ToString();

                        montantTotal    = prixUnitaire * nbVoyage;
                        dr["prixTotal"] = serviceGeneral.separateurDesMilles(montantTotal.ToString("0")) + "Ar";

                        trajet = serviceTrajet.selectTrajet(this.reader["numTrajet"].ToString());
                        if (trajet != null)
                        {
                            dr["trajet"] = trajet.villeD.NomVille + "-" + trajet.villeF.NomVille;
                        }
                        else
                        {
                            dr["trajet"] = "";
                        }

                        nbVoyage     = 0;
                        montantTotal = 0;
                        prixUnitaire = 0;
                        trajet       = null;
                        dataTable.Rows.Add(dr);
                    }
                }
                this.reader.Dispose();
            }
            this.serviceConnectBase.closeConnection();

            #endregion

            return(dataTable);
        }
        DataTable IntfDalDureeAbonnementDevis.getDataTableDureeAbonnementDevis(string strRqst)
        {
            #region declaration
            DataTable dataTable = new DataTable();

            IntfDalGeneral serviceGeneral = new ImplDalGeneral();
            IntfDalTrajet  serviceTrajet  = new ImplDalTrajet();
            crlTrajet      trajet         = null;
            #endregion

            #region implementation

            #region initialisation du dataTable
            dataTable = new DataTable();
            dataTable.Columns.Add("numDureeAbonnementDevis", typeof(string));
            dataTable.Columns.Add("zone", typeof(string));
            dataTable.Columns.Add("valideDu", typeof(DateTime));
            dataTable.Columns.Add("valideAu", typeof(DateTime));
            dataTable.Columns.Add("prixTotal", typeof(string));
            dataTable.Columns.Add("nombre", typeof(string));
            dataTable.Columns.Add("trajet", 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["numDureeAbonnementDevis"] = reader["numDureeAbonnementDevis"].ToString();
                        dr["zone"] = reader["zone"].ToString();
                        try
                        {
                            dr["valideDu"] = Convert.ToDateTime(reader["valideDu"].ToString());
                        }
                        catch (Exception)
                        {
                        }

                        try
                        {
                            dr["valideAu"] = Convert.ToDateTime(this.reader["valideAu"].ToString());
                        }
                        catch (Exception)
                        {
                        }

                        dr["prixTotal"] = serviceGeneral.separateurDesMilles(this.reader["prixTotal"].ToString()) + "Ar";
                        dr["nombre"]    = this.reader["nombreDureeAbonnement"].ToString();

                        trajet = serviceTrajet.selectTrajet(this.reader["numTrajet"].ToString());
                        if (trajet != null)
                        {
                            dr["trajet"] = trajet.villeD.NomVille + "-" + trajet.villeF.NomVille;
                        }
                        else
                        {
                            dr["trajet"] = "";
                        }
                        trajet = null;
                        dataTable.Rows.Add(dr);
                    }
                }
                this.reader.Dispose();
            }
            this.serviceConnectBase.closeConnection();

            #endregion

            return(dataTable);
        }
Exemple #12
0
        crlTrajet IntfDalTrajet.selectTrajet(string numTrajet)
        {
            #region declaration
            crlTrajet                  Trajet                     = null;
            IntfDalVille               serviceVille               = new ImplDalVille();
            IntfDalTarifBaseBillet     serviceTarifBaseBillet     = new ImplDalTarifBaseBillet();
            IntfDalTarifBaseCommission serviceTarifBaseCommission = new ImplDalTarifBaseCommission();
            int i = 0;
            #endregion

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

                this.serviceConnectBase.openConnection();
                reader = this.serviceConnectBase.select(this.strCommande);
                if (reader != null)
                {
                    if (reader.HasRows)
                    {
                        Trajet = new crlTrajet();
                        i      = 1;
                        while (reader.Read())
                        {
                            Trajet.NumTrajet          = reader["numTrajet"].ToString();
                            Trajet.NumTarifBaseBillet = reader["numTarifBaseBillet"].ToString();
                            try
                            {
                                Trajet.DistanceTrajet = int.Parse(reader["distanceTrajet"].ToString());
                            }
                            catch (Exception)
                            {}

                            Trajet.DureeTrajet = reader["dureeTrajet"].ToString();
                            Trajet.NumVilleD   = reader["numVilleD"].ToString();
                            Trajet.NumVilleF   = reader["numVilleF"].ToString();
                        }
                    }
                    reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (Trajet != null)
                {
                    if (Trajet.NumVilleD != "")
                    {
                        Trajet.villeD = serviceVille.selectVille(Trajet.NumVilleD);
                    }
                    if (Trajet.NumVilleF != "")
                    {
                        Trajet.villeF = serviceVille.selectVille(Trajet.NumVilleF);
                    }
                    if (Trajet.NumTarifBaseBillet != "")
                    {
                        Trajet.tarifBaseBillet = serviceTarifBaseBillet.selectTarifBaseBillet(Trajet.NumTarifBaseBillet);
                    }

                    Trajet.tarifBaseCommissions = serviceTarifBaseCommission.selectTarifBaseCommissions(Trajet.NumTrajet);
                }
            }
            #endregion

            return(Trajet);
        }