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
        }
Beispiel #2
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
        }