コード例 #1
0
ファイル: ImplDalPlaceFB.cs プロジェクト: Natolotra/App
        bool IntfDalPlaceFB.insertPlaceFB(crlPlaceFB PlaceFB)
        {
            #region declaration
            IntfDalPlaceFB servicePlaceFB = new ImplDalPlaceFB();

            bool isInsert     = false;
            int  nombreInsert = 0;
            #endregion

            #region implementation
            if (PlaceFB != null)
            {
                if (PlaceFB.NumerosFB != "")
                {
                    PlaceFB.NumPlace  = servicePlaceFB.getNumPlaceFB(PlaceFB.NumerosFB);
                    this.strCommande  = "INSERT INTO `PlaceFB` (`numerosFB`,`numPlace`,`isOccuper`)";
                    this.strCommande += " VALUES ('" + PlaceFB.NumerosFB + "','" + PlaceFB.NumPlace + "','" + PlaceFB.IsOccuper + "')";

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

            return(isInsert);
        }
コード例 #2
0
ファイル: ImplDalVoyage.cs プロジェクト: Natolotra/App
        crlVoyage IntfDalVoyage.selectVoyage(string idVoyage)
        {
            #region declaration
            crlVoyage       Voyage          = null;
            IntfDalBagage   serviceBagage   = new ImplDalBagage();
            IntfDalIndividu serviceIndividu = new ImplDalIndividu();
            IntfDalBillet   serviceBillet   = new ImplDalBillet();
            IntfDalPlaceFB  servicePlaceFB  = new ImplDalPlaceFB();
            #endregion

            #region implementation
            if (idVoyage != "")
            {
                this.strCommande = "SELECT * FROM `voyage` WHERE (`idVoyage`='" + idVoyage + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            Voyage             = new crlVoyage();
                            Voyage.IdVoyage    = reader["idVoyage"].ToString();
                            Voyage.NumIndividu = reader["numIndividu"].ToString();
                            Voyage.NumerosFB   = reader["numerosFB"].ToString();
                            try
                            {
                                Voyage.PoidBagage = double.Parse(reader["poidBagage"].ToString());
                            }
                            catch (Exception)
                            {}
                            Voyage.Destination   = reader["destination"].ToString();
                            Voyage.NumBillet     = reader["numBillet"].ToString();
                            Voyage.NumPlace      = reader["numPlace"].ToString();
                            Voyage.PieceIdentite = reader["pieceIdentite"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (Voyage != null)
                {
                    Voyage.billet   = serviceBillet.selectBillet(Voyage.NumBillet);
                    Voyage.individu = serviceIndividu.selectIndividu(Voyage.NumIndividu);
                    Voyage.placeFB  = servicePlaceFB.selectPlaceFB(Voyage.NumerosFB, Voyage.NumPlace);
                    Voyage.bagage   = serviceBagage.selectBagageForVoyage(Voyage.IdVoyage);
                }
            }
            #endregion

            return(Voyage);
        }
コード例 #3
0
ファイル: ImplDalPlaceFB.cs プロジェクト: Natolotra/App
        string IntfDalPlaceFB.insertPlaceForFB(crlFicheBord FicheBord)
        {
            #region declaration
            IntfDalPlaceFB servicePlaceFB = new ImplDalPlaceFB();
            crlPlaceFB     tempPlaceFB    = null;

            int    nombreInsert  = 0;
            int    nombreDePlace = 0;
            string numerosFB     = "";
            #endregion

            #region implementation
            if (FicheBord != null)
            {
                if (FicheBord.autorisationVoyage != null)
                {
                    if (FicheBord.autorisationVoyage.Verification != null)
                    {
                        if (FicheBord.autorisationVoyage.Verification.Licence != null)
                        {
                            nombreDePlace = FicheBord.autorisationVoyage.Verification.Licence.NombrePlacePayante;

                            if (nombreDePlace > 0)
                            {
                                for (int i = 0; i < nombreDePlace; i++)
                                {
                                    tempPlaceFB           = new crlPlaceFB();
                                    tempPlaceFB.NumerosFB = FicheBord.NumerosFB;
                                    if (servicePlaceFB.insertPlaceFB(tempPlaceFB))
                                    {
                                        nombreInsert += 1;
                                    }
                                }
                                if (nombreInsert == nombreDePlace)
                                {
                                    numerosFB = FicheBord.NumerosFB;
                                }
                                else
                                {
                                    servicePlaceFB.deletePlaceFB(FicheBord.NumerosFB);
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            return(numerosFB);
        }
コード例 #4
0
        crlFicheBord IntfDalFicheBord.selectFicheBord(string numerosFB)
        {
            #region declaration
            crlFicheBord           FicheBord    = null;
            IntfDalAgent           serviceAgent = new ImplDalAgent();
            IntfAutorisationVoyage serviceAutorisationVoyage = new ImplAutorisationVoyage();
            IntfDalFicheBord       serviceFicheBord          = new ImplDalFicheBord();
            IntfDalPlaceFB         servicePlaceFB            = new ImplDalPlaceFB();
            #endregion

            #region implementation
            if (numerosFB != "")
            {
                this.strCommande = "SELECT * FROM `fichebord` WHERE (`numerosFB`='" + numerosFB + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            FicheBord                = new crlFicheBord();
                            FicheBord.NumerosFB      = reader["numerosFB"].ToString();
                            FicheBord.MatriculeAgent = reader["matriculeAgent"].ToString();
                            FicheBord.NumerosAV      = reader["numerosAV"].ToString();
                            FicheBord.DateHeurDepart = Convert.ToDateTime(reader["dateHeurDepart"].ToString());
                            FicheBord.DateHeurPrevue = Convert.ToDateTime(reader["dateHeurPrevue"].ToString());
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (FicheBord != null)
                {
                    FicheBord.agent = serviceAgent.selectAgent(FicheBord.MatriculeAgent);
                    FicheBord.autorisationVoyage = serviceAutorisationVoyage.selectAutorisationVoyage(FicheBord.NumerosAV);

                    FicheBord.commission = serviceFicheBord.getCommission(FicheBord.NumerosFB);
                    //FicheBord.escorteVoyage = serviceFicheBord.getEscorteVoyage(FicheBord.NumerosFB);
                    FicheBord.voyage  = serviceFicheBord.getVoyage(FicheBord.NumerosFB);
                    FicheBord.placeFB = servicePlaceFB.selectPlaceFB(FicheBord.NumerosFB);
                }
            }
            #endregion

            return(FicheBord);
        }
コード例 #5
0
        List <crlFicheBord> IntfDalFicheBord.selectFicheBord(DateTime date, string heure, string idItineraire, string numAgence)
        {
            #region declaration
            List <crlFicheBord>    ficheBords                = null;
            crlFicheBord           tempFicheBord             = null;
            IntfDalAgent           serviceAgent              = new ImplDalAgent();
            IntfAutorisationVoyage serviceAutorisationVoyage = new ImplAutorisationVoyage();
            IntfDalFicheBord       serviceFicheBord          = new ImplDalFicheBord();
            IntfDalPlaceFB         servicePlaceFB            = new ImplDalPlaceFB();
            #endregion

            #region implementation
            if (heure != "" && idItineraire != "" && numAgence != "")
            {
                this.strCommande  = "SELECT (fichebord.numerosFB) AS numFB, (fichebord.matriculeAgent) AS matrAgent, (fichebord.numerosAV) AS numAV,";
                this.strCommande += " fichebord.dateHeurDepart, fichebord.dateHeurPrevue FROM fichebord";
                this.strCommande += " Inner Join autorisationvoyage ON autorisationvoyage.numerosAV = fichebord.numerosAV";
                this.strCommande += " Inner Join verification ON verification.idVerification = autorisationvoyage.idVerification";
                this.strCommande += " Left Join autorisationdepart ON autorisationdepart.numerosFB = fichebord.numerosFB";
                this.strCommande += " Inner Join agent ON agent.matriculeAgent = fichebord.matriculeAgent";
                this.strCommande += " WHERE fichebord.dateHeurPrevue LIKE  '" + date.ToString("yyyy-MM-dd") + " " + heure + "%' AND";
                this.strCommande += " autorisationdepart.numerosFB IS NULL  AND";
                this.strCommande += " agent.numAgence = '" + numAgence + "' AND";
                this.strCommande += " verification.idItineraire = '" + idItineraire + "'";

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        ficheBords = new List <crlFicheBord>();
                        while (this.reader.Read())
                        {
                            tempFicheBord                = new crlFicheBord();
                            tempFicheBord.NumerosFB      = reader["numFB"].ToString();
                            tempFicheBord.MatriculeAgent = reader["matrAgent"].ToString();
                            tempFicheBord.NumerosAV      = reader["numAV"].ToString();
                            tempFicheBord.DateHeurDepart = Convert.ToDateTime(reader["dateHeurDepart"].ToString());
                            tempFicheBord.DateHeurPrevue = Convert.ToDateTime(reader["dateHeurPrevue"].ToString());

                            ficheBords.Add(tempFicheBord);
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                if (ficheBords != null)
                {
                    for (int i = 0; i < ficheBords.Count; i++)
                    {
                        ficheBords[i].agent = serviceAgent.selectAgent(ficheBords[i].MatriculeAgent);
                        ficheBords[i].autorisationVoyage = serviceAutorisationVoyage.selectAutorisationVoyage(ficheBords[i].NumerosAV);

                        ficheBords[i].commission = serviceFicheBord.getCommission(ficheBords[i].NumerosFB);
                        //FicheBord.escorteVoyage = serviceFicheBord.getEscorteVoyage(FicheBord.NumerosFB);
                        ficheBords[i].voyage  = serviceFicheBord.getVoyage(ficheBords[i].NumerosFB);
                        ficheBords[i].placeFB = servicePlaceFB.selectPlaceFB(ficheBords[i].NumerosFB);
                    }
                }
            }
            #endregion

            return(ficheBords);
        }
コード例 #6
0
        List <crlVoyage> IntfDalFicheBord.getVoyage(string numerosFB)
        {
            #region declaration
            List <crlVoyage> Voyages    = new List <crlVoyage>();
            crlVoyage        tempVoyage = null;

            IntfDalBagage   serviceBagage   = new ImplDalBagage();
            IntfDalIndividu serviceIndividu = new ImplDalIndividu();
            IntfDalBillet   serviceBillet   = new ImplDalBillet();
            IntfDalPlaceFB  servicePlaceFB  = new ImplDalPlaceFB();
            #endregion

            #region implementation
            if (numerosFB != "")
            {
                this.strCommande = "SELECT * FROM `voyage` WHERE (`numerosFB`='" + numerosFB + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        while (this.reader.Read())
                        {
                            tempVoyage             = new crlVoyage();
                            tempVoyage.IdVoyage    = reader["idVoyage"].ToString();
                            tempVoyage.NumIndividu = reader["numIndividu"].ToString();
                            tempVoyage.NumerosFB   = reader["numerosFB"].ToString();
                            try
                            {
                                tempVoyage.PoidBagage = double.Parse(reader["poidBagage"].ToString());
                            }
                            catch (Exception)
                            {}
                            tempVoyage.Destination   = reader["destination"].ToString();
                            tempVoyage.NumBillet     = reader["numBillet"].ToString();
                            tempVoyage.NumPlace      = reader["numPlace"].ToString();
                            tempVoyage.PieceIdentite = reader["pieceIdentite"].ToString();

                            Voyages.Add(tempVoyage);
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                for (int i = 0; i < Voyages.Count; i++)
                {
                    if (Voyages[i] != null)
                    {
                        Voyages[i].billet   = serviceBillet.selectBillet(Voyages[i].NumBillet);
                        Voyages[i].individu = serviceIndividu.selectIndividu(Voyages[i].NumIndividu);
                        Voyages[i].placeFB  = servicePlaceFB.selectPlaceFB(Voyages[i].NumerosFB, Voyages[i].NumPlace);
                        Voyages[i].bagage   = serviceBagage.selectBagageForVoyage(Voyages[i].IdVoyage);
                    }
                }
            }
            #endregion

            return(Voyages);
        }