Пример #1
0
        string IntfDalPrelevement.insertPrelevement(crlPrelevement prelevement)
        {
            #region declaration
            int                nombreInsertion    = 0;
            string             numPrelevement     = "";
            IntfDalPrelevement servicePrelevement = new ImplDalPrelevement();
            #endregion

            #region implementation
            if (prelevement != null)
            {
                prelevement.NumPrelevement = servicePrelevement.getNumPrelevement(prelevement.agent.agence.SigleAgence);

                this.strCommande  = "INSERT INTO `prelevement` (`numPrelevement`,`matriculeAgent`";
                this.strCommande += " ,`typePrelevement`,`numAutorisationDepart`,`montantPrelevement`,`datePrelevement`) ";
                this.strCommande += " VALUES ('" + prelevement.NumPrelevement + "','" + prelevement.MatriculeAgent + "'";
                this.strCommande += " ,'" + prelevement.TypePrelevement + "','" + prelevement.NumAutorisationDepart + "'";
                this.strCommande += " ,'" + prelevement.MontantPrelevement + "','" + prelevement.DatePrelevement.ToString("yyyy-MM-dd") + "')";


                this.serviceConnectBase.openConnection();
                nombreInsertion = this.serviceConnectBase.requete(this.strCommande);
                if (nombreInsertion == 1)
                {
                    numPrelevement = prelevement.NumPrelevement;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(numPrelevement);
        }
Пример #2
0
        bool IntfDalPrelevement.updatePrelevement(crlPrelevement prelevement)
        {
            #region declaration
            bool isUpdate = false;
            int  nbUpdate = 0;
            #endregion

            #region implementation
            if (prelevement != null)
            {
                this.strCommande  = "UPDATE `prelevement` SET `matriculeAgent`='" + prelevement.MatriculeAgent + "',";
                this.strCommande += " `montantPrelevement`='" + prelevement.MontantPrelevement + "',";
                this.strCommande += " `numAutorisationDepart`='" + prelevement.NumAutorisationDepart + "',";
                this.strCommande += " `typePrelevement`='" + prelevement.TypePrelevement + "'";
                this.strCommande += " WHERE `numPrelevement`='" + prelevement.NumPrelevement + "'";

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

            return(isUpdate);
        }
Пример #3
0
        crlPrelevement IntfDalPrelevement.selectPrelevement(string numPrelevement)
        {
            #region declaration
            crlPrelevement            Prelevement               = null;
            IntfDalAgent              serviceAgent              = new ImplDalAgent();
            IntfDalTypePrelevement    serviceTypePrelevement    = new ImplDalTypePrelevement();
            IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart();
            #endregion

            #region implementation
            if (numPrelevement != "")
            {
                this.strCommande = "SELECT * FROM `prelevement` WHERE (`numPrelevement`='" + numPrelevement + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            Prelevement = new crlPrelevement();
                            Prelevement.NumPrelevement        = this.reader["numPrelevement"].ToString();
                            Prelevement.DatePrelevement       = Convert.ToDateTime(this.reader["datePrelevement"].ToString());
                            Prelevement.MatriculeAgent        = this.reader["matriculeAgent"].ToString();
                            Prelevement.MontantPrelevement    = double.Parse(this.reader["montantPrelevement"].ToString());
                            Prelevement.NumAutorisationDepart = this.reader["numAutorisationDepart"].ToString();
                            Prelevement.TypePrelevement       = this.reader["typePrelevement"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (Prelevement != null)
                {
                    if (Prelevement.MatriculeAgent != "")
                    {
                        Prelevement.agent = serviceAgent.selectAgent(Prelevement.MatriculeAgent);
                    }
                    if (Prelevement.NumAutorisationDepart != "")
                    {
                        Prelevement.autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(Prelevement.NumAutorisationDepart);
                    }
                    if (Prelevement.TypePrelevement != "")
                    {
                        Prelevement.objTypePrelevement = serviceTypePrelevement.selectTypePrelevement(Prelevement.TypePrelevement);
                    }
                }
            }
            #endregion

            return(Prelevement);
        }
Пример #4
0
        private void prelevementFond(string numAutorisationDepart)
        {
            #region declaration
            crlPrelevement        prelevement        = null;
            crlAutorisationDepart autorisationDepart = null;
            crlRecuAD             recuAD             = null;
            #endregion

            #region implementation
            if (numAutorisationDepart != "")
            {
                autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(numAutorisationDepart);
                if (autorisationDepart != null)
                {
                    if (autorisationDepart.ficheBord.autorisationVoyage.Verification.Licence.vehicule.paramVehicule.Fond > 0)
                    {
                        prelevement                       = new crlPrelevement();
                        prelevement.agent                 = agent;
                        prelevement.MatriculeAgent        = agent.matriculeAgent;
                        prelevement.MontantPrelevement    = autorisationDepart.ficheBord.autorisationVoyage.Verification.Licence.vehicule.paramVehicule.Fond;
                        prelevement.NumAutorisationDepart = autorisationDepart.NumAutorisationDepart;
                        prelevement.TypePrelevement       = "Fond";

                        prelevement.NumPrelevement = servicePrelevement.insertPrelevement(prelevement);

                        if (prelevement.NumPrelevement != "")
                        {
                            recuAD                = new crlRecuAD();
                            recuAD.Libele         = "Fond";
                            recuAD.agent          = agent;
                            recuAD.MatriculeAgent = agent.matriculeAgent;
                            recuAD.Montant        = prelevement.MontantPrelevement.ToString("0");
                            recuAD.NumPrelevement = prelevement.NumPrelevement;
                            recuAD.NumRecuAD      = serviceRecuAD.insertRecuAD(recuAD);

                            autorisationDepart.ResteRegle = autorisationDepart.ResteRegle - prelevement.MontantPrelevement;

                            serviceAutorisationDepart.updateAutorisationDepart(autorisationDepart);
                        }
                        else
                        {
                        }
                    }
                }
            }

            #endregion
        }
Пример #5
0
        private void affichePrelevement(string numPrelevement)
        {
            #region declaration
            crlPrelevement prelevement = null;
            #endregion

            #region implementation
            if (numPrelevement != "")
            {
                prelevement = servicePrelevement.selectPrelevement(numPrelevement);
                if (prelevement != null)
                {
                    TextMontant.Text            = prelevement.MontantPrelevement.ToString("0");
                    ddlTypeRecuAD.SelectedValue = prelevement.TypePrelevement;
                    hfPrelevement.Value         = prelevement.NumPrelevement;
                }
            }
            #endregion
        }
Пример #6
0
        private void affichePrelevement(string numPrelevement)
        {
            #region declaration
            crlPrelevement prelevement = null;
            #endregion

            #region implementation
            if (numPrelevement != "")
            {
                prelevement = servicePrelevement.selectPrelevement(numPrelevement);

                if (prelevement != null)
                {
                    hfPrelevement.Value = prelevement.NumPrelevement;

                    TextMontant.Text = prelevement.MontantPrelevement.ToString("0");
                    TextType.Text    = prelevement.objTypePrelevement.Commentaire;
                }
            }
            #endregion
        }
Пример #7
0
        protected void btnModifier_Click(object sender, EventArgs e)
        {
            #region declaration
            crlPrelevement prelevement = null;
            #endregion

            #region implementation
            if (hfPrelevement.Value != "")
            {
                prelevement = servicePrelevement.selectPrelevement(hfPrelevement.Value);
                if (prelevement != null)
                {
                    prelevement.MontantPrelevement = double.Parse(TextMontant.Text);
                    prelevement.MatriculeAgent     = agent.matriculeAgent;
                    prelevement.TypePrelevement    = ddlTypeRecuAD.SelectedValue;

                    bool isUpdate = servicePrelevement.updatePrelevement(prelevement);

                    if (isUpdate)
                    {
                        this.initialiseGridPrelevement();
                        this.divIndicationText("Prélèvement N°" + prelevement.NumPrelevement + " bien modifier! Montant: " + serviceGeneral.separateurDesMilles(prelevement.MontantPrelevement.ToString("0")) + "Ar", "Black");
                    }
                    else
                    {
                        //
                    }
                }
                else
                {
                    //
                }
            }
            else
            {
                //
            }
            #endregion
        }
Пример #8
0
        protected void btnValideAvance_Click(object sender, EventArgs e)
        {
            #region declaration
            crlPrelevement prelevement = null;
            #endregion

            #region implementation
            if (hfAutorisationDepart.Value != "")
            {
                try
                {
                    if (serviceRecuAD.isValideMontant(double.Parse(TextMontant.Text), hfAutorisationDepart.Value))
                    {
                        prelevement = new crlPrelevement();

                        prelevement.agent          = agent;
                        prelevement.MatriculeAgent = agent.matriculeAgent;
                        try
                        {
                            prelevement.MontantPrelevement = double.Parse(TextMontant.Text);
                        }
                        catch (Exception)
                        {
                        }
                        prelevement.NumAutorisationDepart = hfAutorisationDepart.Value;
                        prelevement.TypePrelevement       = ddlTypeRecuAD.SelectedValue;

                        prelevement.NumPrelevement = servicePrelevement.insertPrelevement(prelevement);

                        if (prelevement.NumPrelevement != "")
                        {
                            this.initialiseFormulaireAvance();
                            this.initialiseGridRecuAD();
                            this.initialiseGridPrelevement();

                            /*hfPrelevement.Value = prelevement.NumPrelevement;
                             * btnModifier.Enabled = true;
                             * btnValideAvance.Enabled = false;*/
                            /*
                             * autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(hfAutorisationDepart.Value);
                             * autorisationDepart.ResteRegle = autorisationDepart.ResteRegle - prelevement.MontantPrelevement;
                             * serviceAutorisationDepart.updateAutorisationDepart(autorisationDepart);
                             *
                             *
                             * this.afficheAutorisationDepart(hfAutorisationDepart.Value);
                             */


                            this.divIndicationText("Prélèvement N°" + prelevement.NumPrelevement + " bien enregistrer! Montant: " + serviceGeneral.separateurDesMilles(prelevement.MontantPrelevement.ToString("0")) + "Ar", "Black");
                        }
                        else
                        {
                            this.divIndicationText(ReAvanceAutorisationDepart.avanceNonEnregistre, "red");
                        }
                    }
                    else
                    {
                        this.divIndicationText(ReAvanceAutorisationDepart.prixNonValide, "red");
                    }
                }
                catch (Exception)
                {
                    this.divIndicationText(ReAvanceAutorisationDepart.erreurSurMontant, "red");
                }
            }
            else
            {
                this.divIndicationText(ReAvanceAutorisationDepart.autorisatrionDepartNonSelectionner, "red");
            }
            #endregion
        }
Пример #9
0
        protected void btnValideAvance_Click(object sender, EventArgs e)
        {
            #region declaration
            crlRecuAD             recu               = null;
            crlPrelevement        prelevement        = null;
            crlAutorisationDepart autorisationDepart = null;
            #endregion

            #region implementation
            if (hfPrelevement.Value != "" && hfAutorisationDepart.Value != "")
            {
                if (agent.sessionCaisse != null)
                {
                    autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(hfAutorisationDepart.Value);
                    prelevement        = servicePrelevement.selectPrelevement(hfPrelevement.Value);
                    if (prelevement != null && autorisationDepart != null)
                    {
                        if (serviceRecuAD.isValideMontant(prelevement.MontantPrelevement, autorisationDepart.NumAutorisationDepart))
                        {
                            recu                = new crlRecuAD();
                            recu.agent          = agent;
                            recu.Date           = DateTime.Now;
                            recu.Libele         = ddlLibelle.Text;
                            recu.MatriculeAgent = agent.matriculeAgent;
                            recu.Montant        = prelevement.MontantPrelevement.ToString("0");
                            recu.NumPrelevement = prelevement.NumPrelevement;

                            recu.NumRecuAD = serviceRecuAD.insertRecuAD(recu);

                            if (recu.NumRecuAD != "")
                            {
                                serviceSessionCaisse.insertAssocSessionCaisseRecuAD(recu.NumRecuAD, agent.sessionCaisse.NumSessionCaisse);

                                this.initialiseGridPrelevement();
                                this.initialiseGridRecuAD();

                                autorisationDepart.ResteRegle = autorisationDepart.ResteRegle - prelevement.MontantPrelevement;
                                serviceAutorisationDepart.updateAutorisationDepart(autorisationDepart);

                                TextMontant.Text         = "";
                                TextType.Text            = "";
                                hfPrelevement.Value      = "";
                                ddlLibelle.SelectedValue = "";
                                this.afficheAutorisationDepart(hfAutorisationDepart.Value);

                                Page.ClientScript.RegisterClientScriptBlock(GetType(), "pdf",
                                                                            string.Format("window.open('{0}','_blank','width={1},height={2},top={3},left={4}');", "../print/print.aspx?param=recuAD&numRecuAD=" + recu.NumRecuAD, 700,
                                                                                          500, 10, 10), true);
                            }
                            else
                            {
                                //
                            }
                        }
                        else
                        {
                            //
                        }
                    }
                }
                else
                {
                    //
                }
            }
            else
            {
                //
            }
            #endregion
        }
Пример #10
0
        protected void btnAutorisationDepart_Click(object sender, EventArgs e)
        {
            #region declaration
            crlAutorisationDepart autorisationDepart = null;
            crlTarifDeveloppement tarifDeveloppement = null;
            crlPrelevement        prelevement        = null;
            crlRecuAD             recuAD             = null;
            #endregion

            #region implementation
            if (hfNumerosFB.Value != "")
            {
                autorisationDepart = new crlAutorisationDepart();
                this.insertObjetAD(autorisationDepart);

                autorisationDepart.NumAutorisationDepart = serviceAutorisationDepart.insertAutorisationDepart(autorisationDepart);


                if (autorisationDepart.NumAutorisationDepart != "")
                {
                    autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(autorisationDepart.NumAutorisationDepart);
                    if (autorisationDepart != null)
                    {
                        tarifDeveloppement = serviceTarifDeveloppement.selectTarifDeveloppementZone(autorisationDepart.ficheBord.autorisationVoyage.Verification.Licence.Zone);


                        if (tarifDeveloppement != null)
                        {
                            prelevement                       = new crlPrelevement();
                            prelevement.agent                 = agent;
                            prelevement.MatriculeAgent        = agent.matriculeAgent;
                            prelevement.MontantPrelevement    = tarifDeveloppement.MontantTarifDeveloppement;
                            prelevement.NumAutorisationDepart = autorisationDepart.NumAutorisationDepart;
                            prelevement.TypePrelevement       = "Développement";

                            prelevement.NumPrelevement = servicePrelevement.insertPrelevement(prelevement);

                            if (prelevement.NumPrelevement != "")
                            {
                                recuAD                = new crlRecuAD();
                                recuAD.Libele         = "Développement";
                                recuAD.agent          = agent;
                                recuAD.MatriculeAgent = agent.matriculeAgent;
                                recuAD.Montant        = prelevement.MontantPrelevement.ToString("0");
                                recuAD.NumPrelevement = prelevement.NumPrelevement;
                                recuAD.NumRecuAD      = serviceRecuAD.insertRecuAD(recuAD);

                                autorisationDepart.ResteRegle = autorisationDepart.ResteRegle - prelevement.MontantPrelevement;

                                serviceAutorisationDepart.updateAutorisationDepart(autorisationDepart);

                                this.prelevementFond(autorisationDepart.NumAutorisationDepart);
                            }
                            else
                            {
                            }
                        }
                        else
                        {
                        }
                    }
                    ficheDebord = serviceFicheBord.selectFicheBord(hfNumerosFB.Value);
                    ficheDebord.DateHeurDepart = DateTime.Now;
                    serviceFicheBord.updateFicheBord(ficheDebord);

                    Response.Redirect("~/ihmActeur/controleur/PlanningCalendarJourAD.aspx");

                    //Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('" + ReAutorisationDepart.ADBienEnregistre + "');", true);
                }
                else
                {
                    this.divIndicationText(ReAutorisationDepart.ADNonEnregistre, "Red");
                }
            }
            else
            {
                Response.Redirect("PlanningCalendarJour.aspx");
            }
            #endregion
        }