Esempio n. 1
0
        string IntfDalTarifBaseBillet.insertTarifBaseBillet(crlTarifBaseBillet tarifBaseBillet, string sigleAgence)
        {
            #region declaration
            IntfDalTarifBaseBillet serviceTarifBaseBillet = new ImplDalTarifBaseBillet();
            int    nombreInsertion    = 0;
            string numTarifBaseBillet = "";
            #endregion

            #region implementation
            if (tarifBaseBillet != null)
            {
                tarifBaseBillet.NumTarifBaseBillet = serviceTarifBaseBillet.getNumerosTarifBaseBillet(sigleAgence);

                this.strCommande  = "INSERT INTO `tarifbasebillet` (`numTarifBaseBillet`,`montantTarifBaseBillet`)";
                this.strCommande += " VALUES ('" + tarifBaseBillet.NumTarifBaseBillet + "','" + tarifBaseBillet.MontantTarifBaseBillet + "')";

                this.serviceConnectBase.openConnection();
                nombreInsertion = this.serviceConnectBase.requete(this.strCommande);
                if (nombreInsertion == 1)
                {
                    numTarifBaseBillet = tarifBaseBillet.NumTarifBaseBillet;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numTarifBaseBillet);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }