Ejemplo n.º 1
0
        bool IntfDalAgence.updateAgence(crlAgence agence)
        {
            #region declaration
            bool isUpdate = false;
            int  nbUpdate = 0;
            #endregion

            #region implemenation
            if (agence != null)
            {
                this.strCommande  = "UPDATE `agence` SET `typeAgence`='" + agence.TypeAgence + "',`numVille`='" + agence.NumVille + "',";
                this.strCommande += "`sigleAgence`='" + agence.SigleAgence + "',`nomAgence`='" + agence.NomAgence + "',";
                this.strCommande += "`localisationAgence`='" + agence.LocalisationAgence + "' WHERE `numAgence`='" + agence.NumAgence + "'";

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

            return(isUpdate);
        }
Ejemplo n.º 2
0
        private void afficheAgence(string numAgence)
        {
            #region declaration
            crlAgence agence     = null;
            string    strConfirm = "";
            #endregion

            #region implementation
            if (numAgence != "")
            {
                agence = serviceAgence.selectAgence(numAgence);

                if (agence != null)
                {
                    ddlTypeAgence.SelectedValue = agence.TypeAgence;
                    ddlVille.SelectedValue      = agence.NumVille;
                    TextNomAgence.Text          = agence.NomAgence;
                    TextLocalisation.Text       = agence.LocalisationAgence;
                    TextSigle.Text = agence.SigleAgence;

                    hfNumAgence.Value = agence.NumAgence;

                    btnModifier.Enabled = true;
                    btnVlider.Enabled   = false;

                    strConfirm = "Voulez vous vraiment modifier l'agence " + agence.NomAgence + "?";
                    ConfirmButtonExtender_btnModifier.ConfirmText = strConfirm;

                    this.divIndicationText("", "Red");
                }
            }
            #endregion
        }
Ejemplo n.º 3
0
        string IntfDalAgence.insertAgence(crlAgence agence)
        {
            #region declaration
            string        numAgence     = "";
            IntfDalAgence serviceAgence = new ImplDalAgence();
            int           nbInsert      = 0;
            #endregion

            #region implementation
            if (agence != null)
            {
                agence.NumAgence = serviceAgence.getNumAgence(agence.SigleAgence);

                this.strCommande  = "INSERT INTO `agence` (`numAgence`,`typeAgence`,`numVille`,`sigleAgence`,";
                this.strCommande += "`nomAgence`,`localisationAgence`) VALUES ('" + agence.NumAgence + "',";
                this.strCommande += "'" + agence.TypeAgence + "','" + agence.NumVille + "','" + agence.SigleAgence + "',";
                this.strCommande += "'" + agence.NomAgence + "','" + agence.LocalisationAgence + "')";

                this.serviceConnectBase.openConnection();
                nbInsert = this.serviceConnectBase.requete(this.strCommande);
                if (nbInsert == 1)
                {
                    numAgence = agence.NumAgence;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numAgence);
        }
Ejemplo n.º 4
0
        private void afficheAgence(string numAgence)
        {
            #region declaration
            crlAgence agence = null;
            #endregion

            #region implementation
            agence = serviceAgence.selectAgence(numAgence);

            if (agence != null)
            {
                LabelAgence.Text = "Agence " + agence.NomAgence;
                if (agence.sessionAgence != null)
                {
                    imageStatut.ImageUrl = "~/CssStyle/images/vert.png";
                    this.afficheMontantTotal(agent.agence.sessionAgence.NumSessionAgence);
                }
                else
                {
                    imageStatut.ImageUrl = "~/CssStyle/images/rouge.png";
                    this.afficheMontantTotal("");
                }
            }
            #endregion
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        private void afficheAgence(string numAgence)
        {
            #region declaration
            crlAgence agence = null;
            #endregion

            #region implementation
            if (numAgence != "")
            {
                agence = serviceAgence.selectAgence(numAgence);

                if (agence != null)
                {
                    LabelLocalisation.Text = agence.LocalisationAgence;
                    LabelNomGare.Text      = agence.NomAgence;
                    LabelSigle.Text        = agence.SigleAgence;
                    LabelType.Text         = agence.TypeAgence;
                    if (agence.ville != null)
                    {
                        LabelVille.Text = agence.ville.NomVille;
                    }
                    hfNumAgence.Value = agence.NumAgence;

                    if (agence.sessionAgence != null)
                    {
                        LabelSessionStatu.Text = "Session ouverte";
                        imageStatut.ImageUrl   = "~/CssStyle/images/vert.png";

                        btnOuvrirSession.Enabled = false;
                        btnFermerSession.Enabled = true;

                        this.afficheMontantTotal(agence.sessionAgence.NumSessionAgence);
                    }
                    else
                    {
                        LabelSessionStatu.Text = "Session fermée";
                        imageStatut.ImageUrl   = "~/CssStyle/images/rouge.png";

                        btnOuvrirSession.Enabled = true;
                        btnFermerSession.Enabled = false;

                        Panel_BilletMontantTotal.Visible           = false;
                        Panel_CommissionMontantTotal.Visible       = false;
                        Panel_DureeAbonnementMontantTotal.Visible  = false;
                        Panel_MontantTotalSessionCaisse.Visible    = false;
                        Panel_RecuEncaisserMontantTotal.Visible    = false;
                        Panel_VoyageAbonnementMontantTotal.Visible = false;
                        Panel_RecuADTotal.Visible = false;
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 7
0
 private void insertToObjAgence(crlAgence agence)
 {
     #region implementation
     if (agence != null)
     {
         agence.LocalisationAgence = TextLocalisation.Text;
         agence.NomAgence          = TextNomAgence.Text;
         agence.NumVille           = ddlVille.SelectedValue;
         agence.SigleAgence        = TextSigle.Text;
         agence.TypeAgence         = ddlTypeAgence.SelectedValue;
     }
     #endregion
 }
Ejemplo n.º 8
0
        protected void btnModifier_Click(object sender, EventArgs e)
        {
            #region declaration
            crlAgence agence        = null;
            int       isAgence      = 0;
            string    strIndication = "";
            #endregion

            #region implementation
            if (hfNumAgence.Value != "")
            {
                agence = serviceAgence.selectAgence(hfNumAgence.Value);

                if (agence != null)
                {
                    this.insertToObjAgence(agence);
                    isAgence = serviceAgence.isAgence(agence);

                    if (isAgence == 0)
                    {
                        if (serviceAgence.updateAgence(agence))
                        {
                            this.initialiseFormulaireAgence();
                            this.initialiseGridAgence();

                            strIndication = "Agence " + agence.NomAgence + " bien modifier!";
                            divIndicationText(strIndication, "Black");
                        }
                        else
                        {
                            strIndication = "Une erreur ce produit durant l'enregistrement!";
                            divIndicationText(strIndication, "Red");
                        }
                    }
                    else if (isAgence == 1)
                    {
                        strIndication = "Sigle existant dans la base!";
                        divIndicationText(strIndication, "Red");
                    }
                    else if (isAgence == 2)
                    {
                        strIndication = "Nom agence déjà dans la base!";
                        divIndicationText(strIndication, "Red");
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 9
0
        int IntfDalAgence.isAgence(crlAgence agence)
        {
            #region declaration
            int isAgence = 0;
            #endregion

            #region implementation
            if (agence != null)
            {
                this.strCommande  = "SELECT agence.numAgence, agence.typeAgence, agence.numVille,";
                this.strCommande += " agence.sigleAgence, agence.nomAgence, agence.localisationAgence";
                this.strCommande += " FROM agence WHERE (agence.sigleAgence = '" + agence.SigleAgence + "' OR";
                this.strCommande += " agence.nomAgence = '" + agence.NomAgence + "') AND";
                this.strCommande += " agence.numAgence <> '" + agence.NumAgence + "'";

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        while (this.reader.Read())
                        {
                            if (this.reader["sigleAgence"].ToString().Trim().ToUpper().Equals(agence.SigleAgence.Trim().ToUpper()))
                            {
                                isAgence = 1;
                            }
                            if (this.reader["nomAgence"].ToString().Trim().ToLower().Equals(agence.NomAgence.Trim().ToLower()))
                            {
                                isAgence = 2;
                            }
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            /*****************/
            /* 1 si sigle egale   */
            /* 2 nom agence     */
            /* ***************/

            return(isAgence);
        }
Ejemplo n.º 10
0
        protected void btnFermerSession_Click(object sender, EventArgs e)
        {
            #region declaration
            crlAgence agence = null;
            #endregion

            #region implementation
            if (hfNumAgence.Value != "")
            {
                agence = serviceAgence.selectAgence(hfNumAgence.Value);
                if (agence != null)
                {
                    if (agence.sessionAgence != null)
                    {
                        agence.sessionAgence.DateHeureFermeture      = DateTime.Now;
                        agence.sessionAgence.MatriculeAgentFermeture = agent.matriculeAgent;

                        if (serviceSessionAgence.updateSessionAgence(agence.sessionAgence))
                        {
                            this.afficheAgence(agence.sessionAgence.NumAgence);
                            this.initialiseGridAgence();
                        }
                        else
                        {
                            //
                        }
                    }
                    else
                    {
                        //
                    }
                }
            }
            else
            {
                //
            }
            #endregion
        }
Ejemplo n.º 11
0
        protected void btnOuvrirSession_Click(object sender, EventArgs e)
        {
            #region declaration
            crlAgence        agence        = null;
            crlSessionAgence sessionAgence = null;
            #endregion

            #region implementation
            if (hfNumAgence.Value != "")
            {
                agence = serviceAgence.selectAgence(hfNumAgence.Value);
                if (agence != null)
                {
                    if (agence.sessionAgence != null)
                    {
                        //
                    }
                    else
                    {
                        sessionAgence = new crlSessionAgence();
                        this.insertToObj(sessionAgence);

                        sessionAgence.NumSessionAgence = serviceSessionAgence.insertSessionAgence(sessionAgence, agent.agence.SigleAgence);

                        if (sessionAgence.NumSessionAgence != "")
                        {
                            this.afficheAgence(sessionAgence.NumAgence);
                            this.initialiseGridAgence();
                        }
                        else
                        {
                            //
                        }
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 12
0
        DataTable IntfDalAgence.getDataTableAgenceListe(string strRqst)
        {
            #region declaration
            DataTable dataTable = new DataTable();
            crlAgence agence    = null;

            IntfDalVille  serviceVille  = new ImplDalVille();
            IntfDalAgence serviceAgence = new ImplDalAgence();
            crlVille      ville         = null;
            #endregion

            #region implemntation

            #region initialisation du dataTable
            dataTable = new DataTable();
            dataTable.Columns.Add("numAgence", typeof(string));
            dataTable.Columns.Add("villeAgence", typeof(string));
            dataTable.Columns.Add("nomAgence", typeof(string));
            dataTable.Columns.Add("localisation", typeof(string));
            dataTable.Columns.Add("typeAgence", typeof(string));
            dataTable.Columns.Add("sigleAgence", typeof(string));
            dataTable.Columns.Add("statut", 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();

                        agence = serviceAgence.selectAgence(this.reader["numAgence"].ToString());

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

                        ville = serviceVille.selectVille(this.reader["numVille"].ToString());
                        if (ville != null)
                        {
                            dr["villeAgence"] = ville.NomVille;
                        }
                        else
                        {
                            dr["villeAgence"] = this.reader["numVille"].ToString();
                        }

                        dr["nomAgence"]    = this.reader["nomAgence"].ToString();
                        dr["sigleAgence"]  = this.reader["sigleAgence"].ToString();
                        dr["localisation"] = this.reader["localisationAgence"].ToString();
                        dr["typeAgence"]   = this.reader["typeAgence"].ToString();

                        if (agence.sessionAgence != null)
                        {
                            dr["statut"] = "vert16.png";
                        }
                        else
                        {
                            dr["statut"] = "rouge16.png";
                        }

                        dataTable.Rows.Add(dr);
                    }
                }
                this.reader.Dispose();
            }

            this.serviceConnectBase.closeConnection();


            #endregion

            return(dataTable);
        }