Example #1
0
        crlAgence IntfDalAgence.selectAgence(string numAgence)
        {
            #region declaration
            crlAgence            agence               = null;
            IntfDalTypeAgence    serviceTypeAgence    = new ImplDalTypeAgence();
            IntfDalVille         serviceVille         = new ImplDalVille();
            IntfDalSessionAgence serviceSessionAgence = new  ImplDalSessionAgence();
            #endregion

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

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            agence = new crlAgence();

                            agence.NumAgence          = this.reader["numAgence"].ToString();
                            agence.NumVille           = this.reader["numVille"].ToString();
                            agence.NomAgence          = this.reader["nomAgence"].ToString();
                            agence.SigleAgence        = this.reader["sigleAgence"].ToString();
                            agence.TypeAgence         = this.reader["typeAgence"].ToString();
                            agence.LocalisationAgence = this.reader["localisationAgence"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (agence != null)
                {
                    if (agence.TypeAgence != "")
                    {
                        agence.typeAgenceObj = serviceTypeAgence.selectTypeAgence(agence.TypeAgence);
                    }

                    if (agence.NumVille != "")
                    {
                        agence.ville = serviceVille.selectVille(agence.NumVille);
                    }

                    if (agence.NumAgence != "")
                    {
                        agence.sessionAgence = serviceSessionAgence.getSessionAgenceEncours(agence.NumAgence);
                    }
                }
            }
            #endregion

            return(agence);
        }
Example #2
0
        string IntfDalSessionAgence.insertSessionAgence(crlSessionAgence sessionAgence, string sigleAgence)
        {
            #region declaration
            string numSessionCaisse        = "";
            int    nbInsert                = 0;
            string matriculeAgentFermeture = "NULL";
            string matriculeAgentOuverture = "NULL";

            IntfDalSessionAgence serviceSessionAgence = new ImplDalSessionAgence();
            #endregion

            #region implementation
            if (sessionAgence != null)
            {
                if (sessionAgence.MatriculeAgentFermeture != "")
                {
                    matriculeAgentFermeture = "'" + sessionAgence.MatriculeAgentFermeture + "'";
                }
                if (sessionAgence.MatriculeAgentOuverture != "")
                {
                    matriculeAgentOuverture = "'" + sessionAgence.MatriculeAgentOuverture + "'";
                }

                sessionAgence.NumSessionAgence = serviceSessionAgence.getNumSessionAgence(sigleAgence);
                this.strCommande  = "INSERT INTO `sessionagence` (`numSessionAgence`,`numAgence`,`matriculeAgentOuverture`,";
                this.strCommande += " `matriculeAgentFermeture`,`dateHeureOuverutre`,`dateHeureFermeture`) VALUES";
                this.strCommande += " ('" + sessionAgence.NumSessionAgence + "','" + sessionAgence.NumAgence + "',";
                this.strCommande += " " + matriculeAgentOuverture + "," + matriculeAgentFermeture + ",";
                this.strCommande += " '" + sessionAgence.DateHeureOuverture.ToString("yyyy-MM-dd HH:mm:ss") + "',";
                this.strCommande += " '" + sessionAgence.DateHeureFermeture.ToString("yyyy-MM-dd HH:mm:ss") + "')";

                this.serviceConnectBase.openConnection();
                nbInsert = this.serviceConnectBase.requete(this.strCommande);
                if (nbInsert == 1)
                {
                    numSessionCaisse = sessionAgence.NumSessionAgence;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numSessionCaisse);
        }