Ejemplo n.º 1
0
        private void ChargerAction()
        {
            LigneTable action      = ((LigneTable)((ComboBoxItem)cmbAction.SelectedItem).Value);
            int        indexAction = action.GetValeurChamp <int>("actaId");

            dtpDate.Value = action.GetValeurChamp <DateTime>("actaDate");
            nudBenevolesNonInscrits.Value = action.GetValeurChamp <int>("actaNbBenevolesNonInscrits");

            Table benevolesInclus = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("benevoleactionactivite", String.Format(REQUETE_BENEVOLES_INCLUS, indexAction));
            List <ComboBoxItem> listeBenevolesInclus = new List <ComboBoxItem>();

            foreach (LigneTable l in benevolesInclus.Lignes)
            {
                string infosBenevole = String.Format(FORMAT_BENEVOLES_INCLUS, l.GetValeurChamp <string>("perNom"), l.GetValeurChamp <string>("perPrenom"), l.GetValeurChamp <int>("benaHeures"));
                listeBenevolesInclus.Add(new ComboBoxItem(infosBenevole, l.GetChamp("perId")));
            }

            MettreAJourListe(lbBenevolesInclus, listeBenevolesInclus);

            Table beneficiairesInclus = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("beneficiaireactionactivite", String.Format(REQUETE_BENEFICIAIRES_INCLUS, indexAction));
            List <ComboBoxItem> listeBeneficiairesInclus = new List <ComboBoxItem>();

            foreach (LigneTable l in beneficiairesInclus.Lignes)
            {
                string infosBeneficiaire = String.Format(FORMAT_BENEFICIAIRES_INCLUS, l.GetValeurChamp <string>("perNom"), l.GetValeurChamp <string>("perPrenom"));
                listeBeneficiairesInclus.Add(new ComboBoxItem(infosBeneficiaire, l.GetChamp("perId")));
            }

            MettreAJourListe(lbBeneficiairesInclus, listeBeneficiairesInclus);
        }
Ejemplo n.º 2
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptionvisitesamitie);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionLifeline = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionLifeline.EstVide)
                {
                    LigneTable infosInscription = inscriptionLifeline.Lignes[0];

                    txtMobiliteReduite.Text  = infosInscription.GetValeurChamp <string>("ivaMobiliteReduite");
                    txtCapaciteAuditive.Text = infosInscription.GetValeurChamp <string>("ivaCapaciteAuditive");
                    txtCapaciteVisuelle.Text = infosInscription.GetValeurChamp <string>("ivaCapaciteVisuelle");
                    txtMemoire.Text          = infosInscription.GetValeurChamp <string>("ivaMemoire");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 3
0
        private void btnChoisirBeneficiaire_Click(object sender, EventArgs e)
        {
            if (IdService < 0)
            {
                Journal.AfficherMessage("La table des services est inexistante ou corrompue. L'action a été annulée.", TypeMessage.ERREUR, true);
                return;
            }

            if (IdStatut < 0)
            {
                Journal.AfficherMessage("La table des statuts est inexistante ou corrompue. L'action a été annulée.", TypeMessage.ERREUR, true);
                return;
            }

            Table             beneficiaires     = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Beneficiaire", String.Format(RequeteBeneficiaire, IdStatut, IdService));
            frmSelectionTable choixBeneficiaire = new frmSelectionTable("Choisir un bénéficiaire...", beneficiaires, new List <string> {
                "perNom", "perPrenom", "perDateNaissance"
            }, "perId");

            if (choixBeneficiaire.AfficherDialogue(this))
            {
                BeneficiaireCourant = choixBeneficiaire.LigneChoisie;

                lblNomValeur.Text    = BeneficiaireCourant.GetValeurChamp <string>("perNom");
                lblPrenomValeur.Text = BeneficiaireCourant.GetValeurChamp <string>("perPrenom");

                RafraichirEvaluations();
            }
        }
Ejemplo n.º 4
0
 private void RemplirDonneesCouple(LigneTable personneCouple)
 {
     PersonneCouple       = personneCouple;
     IndexPersonneCouple  = personneCouple.GetValeurChamp <int>("perId");
     lblNomCouple.Text    = personneCouple.GetValeurChamp <string>("perNom");
     lblPrenomCouple.Text = personneCouple.GetValeurChamp <string>("perPrenom");
 }
Ejemplo n.º 5
0
        private void ChargerReunion()
        {
            LigneTable reunion      = ((LigneTable)((ComboBoxItem)cmbReunion.SelectedItem).Value);
            int        indexReunion = reunion.GetValeurChamp <int>("reuId");

            dtpDate.Value       = reunion.GetValeurChamp <DateTime>("reuDate");
            txtDescription.Text = reunion.GetValeurChamp <string>("reuDescription");

            Table benevolesInclus = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("benevolereunion", String.Format(REQUETE_BENEVOLES_INCLUS, indexReunion));
            List <ComboBoxItem> listeBenevolesInclus = new List <ComboBoxItem>();

            foreach (LigneTable l in benevolesInclus.Lignes)
            {
                string infosBenevole = String.Format(FORMAT_PERSONNES_INCLUS, l.GetValeurChamp <string>("perNom"), l.GetValeurChamp <string>("perPrenom"), l.GetValeurChamp <int>("benrHeures"));
                listeBenevolesInclus.Add(new ComboBoxItem(infosBenevole, l.GetChamp("perId")));
            }

            MettreAJourListe(lbBenevolesInclus, listeBenevolesInclus);

            Table employesInclus = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("employereunion", String.Format(REQUETE_EMPLOYES_INCLUS, indexReunion));
            List <ComboBoxItem> listeEmployesInclus = new List <ComboBoxItem>();

            foreach (LigneTable l in employesInclus.Lignes)
            {
                string infosBeneficiaire = String.Format(FORMAT_PERSONNES_INCLUS, l.GetValeurChamp <string>("perNom"), l.GetValeurChamp <string>("perPrenom"), l.GetValeurChamp <int>("erHeures"));
                listeEmployesInclus.Add(new ComboBoxItem(infosBeneficiaire, l.GetChamp("perId")));
            }

            MettreAJourListe(lbEmployesInclus, listeEmployesInclus);
        }
Ejemplo n.º 6
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptiontransportaccompagement);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionLifeline = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionLifeline.EstVide)
                {
                    LigneTable infosInscription = inscriptionLifeline.Lignes[0];

                    txtNoDossierCLE.Text     = infosInscription.GetValeurChamp <string>("itaNoDossierCLE").ToString();
                    txtNoDossierCSST.Text    = infosInscription.GetValeurChamp <string>("itaNoDossierCSST").ToString();
                    txtNomAgent.Text         = infosInscription.GetValeurChamp <string>("itaNomAgentCSST");
                    txtPrenomAgent.Text      = infosInscription.GetValeurChamp <string>("itaPrenomAgentCSST");
                    mtxtTelephoneAgent.Text  = infosInscription.GetValeurChamp <string>("itaTelephoneAgentCSST");
                    txtMobiliteReduite.Text  = infosInscription.GetValeurChamp <string>("itaMobiliteReduite");
                    txtCapaciteAuditive.Text = infosInscription.GetValeurChamp <string>("itaCapaciteAuditive");
                    txtCapaciteVisuelle.Text = infosInscription.GetValeurChamp <string>("itaCapaciteVisuelle");
                    txtMemoire.Text          = infosInscription.GetValeurChamp <string>("itaMemoire");
                    cbVuDDN.Checked          = infosInscription.GetValeurChamp <bool>("itaVuDDN");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 7
0
        public override bool Enregistrer()
        {
            if (!base.Enregistrer())
            {
                return(false);
            }

            PersonneCourante.AjouterChamp("perDateDerniereMaj", DateTime.Now);

            Champ indexPersonne = PersonneCourante.GetChamp("perId");

            LigneTable personne = new LigneTable("Personne");

            personne.AjouterChamp("perDateDerniereMaj", PersonneCourante.GetValeurChamp <DateTime>("perDateDerniereMaj"));
            personne.AjouterChamp("perDateOuverture", PersonneCourante.GetValeurChamp <DateTime>("perDateOuverture"));
            personne.AjouterChamp("perDateFermeture", PersonneCourante.GetValeurChamp <DateTime>("perDateFermeture"));
            personne.AjouterChamp("perDateInactivite", PersonneCourante.GetValeurChamp <DateTime>("perDateInactivite"));
            personne.AjouterChamp("staId", PersonneCourante.GetValeurChamp <int>("staId"));

            RequeteModification reqModif = new RequeteModification(NomTable.personne, new ConditionRequete(Operateur.EGAL, indexPersonne), personne);

            if (Global.BaseDonneesCABS.EnvoyerRequeteModification(reqModif) <= 0)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
 private void AjouterPersonnesARejoindre(LigneTable persARej)
 {
     dgvPersonnesARejoindre.Rows.Add(persARej.GetValeurChamp <int>("arjId"),
                                     persARej.GetValeurChamp <string>("arjPrenom"),
                                     persARej.GetValeurChamp <string>("arjNom"),
                                     persARej.GetValeurChamp <string>("arjLien"),
                                     persARej.GetValeurChamp <string>("arjTelephone"));
 }
Ejemplo n.º 9
0
        private void RafraichirService()
        {
            ConditionRequete condReqSel = new ConditionRequete(Operateur.EGAL, "perId", BeneficiaireCourant.GetChamp("perId").ValeurSQL);

            condReqSel.LierCondition(new ConditionRequete(Operateur.EGAL, "serId", (cmbService.SelectedItem as ComboBoxItem).Value.ToString()), true);

            RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptionservice);

            reqSel.Condition = condReqSel;

            Table  inscription   = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);
            string nomFormulaire = Global.GetNomFormulaireInscription(cmbService.Text);

            panFormulaireInscription.Controls.Clear();

            Type typeFormulaire = Type.GetType(nomFormulaire);

            try
            {
                FormulaireCourant = (Formulaire)Activator.CreateInstance(typeFormulaire);
            }
            catch (Exception)
            {
                FormulaireCourant = null;
                return;
            }

            if (!inscription.EstVide)
            {
                ChangerAccesControle(ModeFormulaire.CONSULTATION);

                LigneTable infosInscription = inscription.Lignes[0];

                dtpDateDemande.Value = infosInscription.GetValeurChamp <DateTime>("insDateDemande");
                cbSuspendu.Checked   = infosInscription.GetValeurChamp <bool>("insSuspendu");
                txtCommentaires.Text = infosInscription.GetValeurChamp <string>("insCommentaires");
            }
            else
            {
                ChangerAccesControle(ModeFormulaire.AJOUT);
                Vider();
                FormulaireCourant.Vider();
            }

            FormulaireCourant.Name       = nomFormulaire;
            FormulaireCourant.Dock       = DockStyle.Fill;
            FormulaireCourant.TopLevel   = false;
            FormulaireCourant.AutoScroll = true;
            FormulaireCourant.EnvoyerMessages(BeneficiaireCourant.GetValeurChamp <int>("perId"));

            panFormulaireInscription.Controls.Add(FormulaireCourant);
            FormulaireCourant.Show();
        }
Ejemplo n.º 10
0
        private void ChargerBeneficiaire(LigneTable ligneTable)
        {
            if (ligneTable == null)
            {
                return;
            }

            BeneficiaireCourant  = ligneTable;
            lblPrenomValeur.Text = ligneTable.GetValeurChamp <string>("perPrenom");
            lblNomValeur.Text    = ligneTable.GetValeurChamp <string>("perNom");
            RafraichirService();
        }
Ejemplo n.º 11
0
        private void RafraichirInfosLivraison()
        {
            int     indexLivraison = GetIndexLivraisonExistante(mcCalendrier.SelectionStart);
            int     nbRepas        = 0;
            decimal prixRepas      = 0;

            if (indexLivraison >= 0)
            {
                LigneTable livraison = Livraisons.Lignes[indexLivraison];
                nbRepas   = livraison.GetValeurChamp <int>("lprNombreRepas");
                prixRepas = livraison.GetValeurChamp <decimal>("lprPrixRepas");
            }

            lblDateValeur.Text      = mcCalendrier.SelectionStart.ToShortDateString();
            lblNbRepasValeur.Text   = nbRepas.ToString();
            lblPrixRepasValeur.Text = prixRepas.ToString("C");
        }
Ejemplo n.º 12
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptionclubmarche);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionClubMarche = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionClubMarche.EstVide)
                {
                    LigneTable infosInscription = inscriptionClubMarche.Lignes[0];

                    rbProblemeCardiaqueOui.Checked = infosInscription.GetValeurChamp <bool>("icmProblemeCardiaque");
                    rbDouleurPoitrineOui.Checked   = infosInscription.GetValeurChamp <bool>("icmDouleurPoitrine");
                    rbProblemesOsseuxOui.Checked   = infosInscription.GetValeurChamp <bool>("icmProblemesOsseux");

                    rbRestrictionPhysiqueOui.Checked     = infosInscription.GetValeurChamp <bool>("icmRestrictionPhysique");
                    txtRestrictionPhysiqueSpecifier.Text = infosInscription.GetValeurChamp <string>("icmDetailsRestrictionPhysique");

                    rbProblemeSanteOui.Checked     = infosInscription.GetValeurChamp <bool>("icmProblemeSante");
                    txtProblemeSanteSpecifier.Text = infosInscription.GetValeurChamp <string>("icmDetailsProblemeSante");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 13
0
        private LigneTable GetAdresseModifiee(LigneTable personneCourante, LigneTable personneModifiee)
        {
            LigneTable nouvelleAdresse = new LigneTable("Personne");
            int        tempInt;
            string     tempString;

            if ((tempInt = personneCourante.GetValeurChamp <int>("perNoCivique")) != personneModifiee.GetValeurChamp <int>("perNoCivique"))
            {
                nouvelleAdresse.AjouterChamp("perNoCivique", tempInt);
            }

            if ((tempString = personneCourante.GetValeurChamp <string>("perNoAppart")) != personneModifiee.GetValeurChamp <string>("perNoAppart"))
            {
                nouvelleAdresse.AjouterChamp("perNoAppart", tempString);
            }

            if ((tempString = personneCourante.GetValeurChamp <string>("perRue")) != personneModifiee.GetValeurChamp <string>("perRue"))
            {
                nouvelleAdresse.AjouterChamp("perRue", tempString);
            }

            if ((tempString = personneCourante.GetValeurChamp <string>("perVille")) != personneModifiee.GetValeurChamp <string>("perVille"))
            {
                nouvelleAdresse.AjouterChamp("perVille", tempString);
            }

            if ((tempString = personneCourante.GetValeurChamp <string>("perCodePostal")) != personneModifiee.GetValeurChamp <string>("perCodePostal"))
            {
                nouvelleAdresse.AjouterChamp("perCodePostal", tempString);
            }

            if ((tempInt = personneCourante.GetValeurChamp <int>("perCasePostale")) != personneModifiee.GetValeurChamp <int>("perCasePostale"))
            {
                nouvelleAdresse.AjouterChamp("perCasePostale", tempInt);
            }

            if (nouvelleAdresse.NombreChamps > 0)
            {
                return(nouvelleAdresse);
            }

            return(null);
        }
Ejemplo n.º 14
0
        private void ChargerPersonnesARejoindre()
        {
            lblPrenomValeur.Text = PersonneCourante.GetValeurChamp <string>("perPrenom");
            lblNomValeur.Text    = PersonneCourante.GetValeurChamp <string>("perNom");

            dgvPersonnesARejoindre.Rows.Clear();
            PersonnesARejoindreASupprimer.Clear();

            btnEnregistrer.Enabled = btnAnnuler.Enabled = false;

            RequeteSelection reqSel = new RequeteSelection(NomTable.arejoindre);

            reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", PersonneCourante.GetChamp("perId").ValeurSQL);

            Table personnesARejoindre = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

            foreach (LigneTable persARej in personnesARejoindre.Lignes)
            {
                AjouterPersonnesARejoindre(persARej);
            }
        }
Ejemplo n.º 15
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptionpopoteroulante);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionPopote = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionPopote.EstVide)
                {
                    LigneTable infosInscription = inscriptionPopote.Lignes[0];

                    nudSolde.Value               = infosInscription.GetValeurChamp <decimal>("iprSolde");
                    cbDiabetique.Checked         = infosInscription.GetValeurChamp <bool>("iprDiabetique");
                    cbConjointDiabetique.Checked = infosInscription.GetValeurChamp <bool>("iprConjointDiabetique");
                    txtAllergies.Text            = infosInscription.GetValeurChamp <string>("iprListeAllergies");
                    txtAllergiesConjoint.Text    = infosInscription.GetValeurChamp <string>("iprListeAllergiesConjoint");
                    txtIndicationsLivraison.Text = infosInscription.GetValeurChamp <string>("iprIndicationsLivraison");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 16
0
        private void btnMonter_Click(object sender, EventArgs e)
        {
            TreeNode noeudSelectionne = tvRoutesBeneficiaires.SelectedNode;
            TreeNode noeudParent      = noeudSelectionne != null ? noeudSelectionne.Parent : null;
            TreeNode noeudPrecedent   = noeudParent != null ? noeudParent.Nodes[noeudSelectionne.Index - 1] : null;

            LigneTable beneficiaire1 = noeudSelectionne != null && noeudSelectionne.Tag is LigneTable ? (LigneTable)noeudSelectionne.Tag : null;
            LigneTable beneficiaire2 = noeudPrecedent != null && noeudPrecedent.Tag is LigneTable ? (LigneTable)noeudPrecedent.Tag : null;

            if (noeudSelectionne == null || noeudParent == null || noeudPrecedent == null || beneficiaire1 == null || beneficiaire2 == null)
            {
                Journal.AfficherMessage("Une erreur est survenue lors du changement d'ordre des bénéficiaires. L'action a été annulée.", TypeMessage.ERREUR, true);
                return;
            }

            Global.BaseDonneesCABS.CommencerTransaction();

            ConditionRequete    cond1     = new ConditionRequete(Operateur.EGAL, beneficiaire1.GetChamp("perId"));
            ConditionRequete    cond2     = new ConditionRequete(Operateur.EGAL, beneficiaire2.GetChamp("perId"));
            RequeteModification reqModif1 = new RequeteModification(NomTable.beneficiaireroutepopoteroulante, cond1, beneficiaire2.GetChamp("brprOrdre"));
            RequeteModification reqModif2 = new RequeteModification(NomTable.beneficiaireroutepopoteroulante, cond2, beneficiaire1.GetChamp("brprOrdre"));

            if (Global.BaseDonneesCABS.EnvoyerRequeteModification(reqModif1) < 0)
            {
                Journal.AfficherMessage("Une erreur est survenue lors du changement d'ordre des bénéficiaires. L'action a été annulée.", TypeMessage.ERREUR, true);

                Global.BaseDonneesCABS.AnnulerTransaction();
                return;
            }

            if (Global.BaseDonneesCABS.EnvoyerRequeteModification(reqModif2) < 0)
            {
                Journal.AfficherMessage("Une erreur est survenue lors du changement d'ordre des bénéficiaires. L'action a été annulée.", TypeMessage.ERREUR, true);

                Global.BaseDonneesCABS.AnnulerTransaction();
                return;
            }

            Global.BaseDonneesCABS.ConfirmerTransaction();

            int temp = beneficiaire1.GetValeurChamp <int>("brprOrdre");

            beneficiaire1.GetChamp("brprOrdre").Valeur = beneficiaire2.GetValeurChamp <int>("brprOrdre");
            beneficiaire2.GetChamp("brprOrdre").Valeur = temp;

            noeudParent.Nodes.Remove(noeudSelectionne);
            noeudParent.Nodes.Insert(noeudPrecedent.Index, noeudSelectionne);

            tvRoutesBeneficiaires.SelectedNode = noeudSelectionne;
        }
Ejemplo n.º 17
0
        private string GetNomAdresseBeneficiaire(LigneTable beneficiaire)
        {
            string nom        = beneficiaire.GetValeurChamp <string>("perNom");
            string prenom     = beneficiaire.GetValeurChamp <string>("perPrenom");
            int    noCivique  = beneficiaire.GetValeurChamp <int>("perNoCivique");
            string rue        = beneficiaire.GetValeurChamp <string>("perRue");
            string ville      = beneficiaire.GetValeurChamp <string>("perVille");
            string codePostal = beneficiaire.GetValeurChamp <string>("perCodePostal");

            return(String.Format(FormatNomAdresseBeneficiaire, nom, prenom, noCivique, rue, ville, codePostal));
        }
Ejemplo n.º 18
0
        private void btnInclure_Click(object sender, EventArgs e)
        {
            ComboBoxItem beneficiaire      = (lbBeneficiaires.SelectedItem as ComboBoxItem);
            LigneTable   ligneBeneficiaire = beneficiaire.Value is LigneTable ? (LigneTable)beneficiaire.Value : new LigneTable("beneficiaire");
            TreeNode     noeudRoute        = tvRoutesBeneficiaires.SelectedNode;

            LigneTable beneficiaireRoute = new LigneTable("beneficiaireroutepopoteroulante");

            beneficiaireRoute.AjouterChamp("perId", ligneBeneficiaire.GetValeurChamp <int>("perId"));
            beneficiaireRoute.AjouterChamp("rprId", noeudRoute.Tag);

            Table ordreMax = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("beneficiaireroutepopoteroulante", String.Format(FormatOrdreMaximum, noeudRoute.Tag));

            if (ordreMax.EstVide)
            {
                beneficiaireRoute.AjouterChamp("brprOrdre", 1);
            }
            else
            {
                beneficiaireRoute.AjouterChamp("brprOrdre", ordreMax.Lignes[0].GetValeurChamp <int>("brprOrdre") + 1);
            }


            RequeteAjout reqAjout = new RequeteAjout(NomTable.beneficiaireroutepopoteroulante, beneficiaireRoute);

            if (Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout) < 0)
            {
                Journal.AfficherMessage("Une erreur est survenue lors de l'inclusion du bénéficiaire à la route. L'action a été annulée.", TypeMessage.ERREUR, true);
                return;
            }

            ligneBeneficiaire.AjouterChamp(beneficiaireRoute.GetChamp("rprId"));
            ligneBeneficiaire.AjouterChamp(beneficiaireRoute.GetChamp("brprOrdre"));

            TreeNode nouveauNoeudBeneficiaire = new TreeNode(beneficiaire.Text);

            nouveauNoeudBeneficiaire.Tag = ligneBeneficiaire;
            noeudRoute.Nodes.Add(nouveauNoeudBeneficiaire);
            noeudRoute.Expand();

            lbBeneficiaires.Items.Remove(beneficiaire);
        }
Ejemplo n.º 19
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptiontransportcommunautaire);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionLifeline = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionLifeline.EstVide)
                {
                    LigneTable infosInscription = inscriptionLifeline.Lignes[0];
                    cbVuDDN.Checked = infosInscription.GetValeurChamp <bool>("itcVuDDN");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 20
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptiontelesurveillancelifeline);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionLifeline = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionLifeline.EstVide)
                {
                    LigneTable infosInscription = inscriptionLifeline.Lignes[0];
                    txtNoUnite.Text = infosInscription.GetValeurChamp <string>("itlNoUnite");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 21
0
        private void ChargerDossierPersonne(LigneTable ligneTable)
        {
            PersonneCourante = ligneTable;

            if (PersonneCourante == null)
            {
                Vider();
            }
            else
            {
                lblNomValeur.Text    = ligneTable.GetValeurChamp <string>("perNom");
                lblPrenomValeur.Text = ligneTable.GetValeurChamp <string>("perPrenom");

                int        idStatut    = ligneTable.GetValeurChamp <int>("staId");
                LigneTable ligneStatut = Statuts.Lignes.Find(l => l.GetValeurChamp <int>("staId") == idStatut);
                lblStatutValeur.Text = ligneStatut != null?ligneStatut.GetValeurChamp <string>("staNom") : "";

                lblDateDerniereMajValeur.Text = ligneTable.GetValeurChamp <DateTime>("perDateDerniereMaj").ToShortDateString();
                lblDateOuvertureValeur.Text   = ligneTable.GetValeurChamp <DateTime>("perDateOuverture").ToShortDateString();
                lblDateInactiviteValeur.Text  = ligneTable.GetValeurChamp <DateTime>("perDateInactivite").ToShortDateString();
                lblDateFermetureValeur.Text   = ligneTable.GetValeurChamp <DateTime>("perDateFermeture").ToShortDateString();
            }
        }
        public override bool Enregistrer()
        {
            if (!base.Enregistrer())
            {
                return(false);
            }

            LigneTable inscription = new LigneTable("DisponibiliteService");

            inscription.AjouterChamp("perId", BenevoleCourant.GetValeurChamp <int>("perId"));
            inscription.AjouterChamp("serId", (cmbService.SelectedItem as ComboBoxItem).Value);

            RequeteAjout reqAjout = new RequeteAjout(NomTable.disponibiliteservice, inscription);

            if (Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout) < 0)
            {
                Journal.AfficherMessage("Une erreur est survenue lors de l'enregistrement de la disponibilité. L'action a été annulée", TypeMessage.ERREUR, true);
                Global.BaseDonneesCABS.AnnulerTransaction();
                return(false);
            }

            return(true);
        }
Ejemplo n.º 23
0
        private void RemplirDonneesAdresse(LigneTable personne)
        {
            txtNoCivique.Text   = personne.GetValeurChamp <int>("perNoCivique").ToString();
            txtNoAppart.Text    = personne.GetValeurChamp <string>("perNoAppart");
            txtRue.Text         = personne.GetValeurChamp <string>("perRue");
            txtVille.Text       = personne.GetValeurChamp <string>("perVille");
            mtxtCodePostal.Text = personne.GetValeurChamp <string>("perCodePostal");

            int casePostale = personne.GetValeurChamp <int>("perCasePostale");

            if (casePostale != 0)
            {
                txtCasePostale.Text = casePostale.ToString();
            }
            else
            {
                txtCasePostale.ResetText();
            }
        }
Ejemplo n.º 24
0
        public override bool Enregistrer()
        {
            if (!base.Enregistrer())
            {
                return(false);
            }

            Champ dateAction = new Champ("actionactivite", "actaDate", dtpDate.Value);
            Champ nbBenevolesNonInscritsAction = new Champ("actionactivite", "actaNbBenevolesNonInscrits", nudBenevolesNonInscrits.Value);

            LigneTable ligneAction = new LigneTable("actionactivite");

            ligneAction.AjouterChamp(dateAction);
            ligneAction.AjouterChamp(nbBenevolesNonInscritsAction);

            if (Mode == ModeFormulaire.AJOUT)
            {
                RequeteAjout reqAjout = new RequeteAjout(NomTable.actionactivite, (Champ)((ComboBoxItem)cmbActivite.SelectedItem).Value, dateAction, nbBenevolesNonInscritsAction);
                int          nouvelIndex;

                if ((nouvelIndex = Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout)) < 0)
                {
                    Journal.AfficherMessage("Une erreur est survenue lors de l'ajout de l'action. L'action a été annulée", TypeMessage.ERREUR, true);
                    return(false);
                }

                ligneAction.AjouterChamp(new Champ("actionactivite", "actaId", nouvelIndex));
            }
            else if (Mode == ModeFormulaire.EDITION)
            {
                Champ indexAction            = ((LigneTable)((ComboBoxItem)cmbAction.SelectedItem).Value).GetChamp("actaId");
                RequeteModification reqModif = new RequeteModification(NomTable.actionactivite, new ConditionRequete(Operateur.EGAL, indexAction), dateAction, nbBenevolesNonInscritsAction);

                if (Global.BaseDonneesCABS.EnvoyerRequeteModification(reqModif) < 0)
                {
                    Journal.AfficherMessage("Une erreur est survenue lors de la modification de l'action. L'action a été annulée.", TypeMessage.ERREUR, true);
                    return(false);
                }

                ligneAction.AjouterChamp(indexAction);
                cmbAction.Items.Remove(cmbAction.SelectedItem);
            }

            int indexInsertion = cmbAction.Items.Count;

            for (int i = 0; i < cmbAction.Items.Count; ++i)
            {
                LigneTable action = (LigneTable)((ComboBoxItem)cmbAction.Items[i]).Value;

                if (action.GetValeurChamp <DateTime>("actaDate") <= dtpDate.Value)
                {
                    indexInsertion = i;
                    break;
                }
            }

            cmbAction.Items.Insert(indexInsertion, new ComboBoxItem(dtpDate.Value.ToLongDateString(), ligneAction));
            cmbAction.SelectedIndex = indexInsertion;

            return(true);
        }
Ejemplo n.º 25
0
        private void cmbEvaluationsPrecedentes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbEvaluationsPrecedentes.SelectedIndex < 0)
            {
                return;
            }

            LigneTable evaluation = ((LigneTable)((ComboBoxItem)cmbEvaluationsPrecedentes.SelectedItem).Value);

            nudNbPersonnes.Value = evaluation.GetValeurChamp <int>("edaNbPersonnes");

            nudAideSociale.Value            = evaluation.GetValeurChamp <decimal>("edaAideSociale");
            nudAssuranceAuto.Value          = evaluation.GetValeurChamp <decimal>("edaAssuranceAuto");
            nudAssuranceLogement.Value      = evaluation.GetValeurChamp <decimal>("edaAssuranceLogement");
            nudAssuranceVie.Value           = evaluation.GetValeurChamp <decimal>("edaAssuranceVie");
            nudAutresDepenses1.Value        = evaluation.GetValeurChamp <decimal>("edaAutresDepenses1");
            nudAutresDepenses2.Value        = evaluation.GetValeurChamp <decimal>("edaAutresDepenses2");
            nudAutresDepenses3.Value        = evaluation.GetValeurChamp <decimal>("edaAutresDepenses3");
            nudAutresRevenus1.Value         = evaluation.GetValeurChamp <decimal>("edaAutresRevenus1");
            nudAutresRevenus2.Value         = evaluation.GetValeurChamp <decimal>("edaAutresRevenus2");
            nudAutresRevenus3.Value         = evaluation.GetValeurChamp <decimal>("edaAutresRevenus3");
            nudCableInternetTelephone.Value = evaluation.GetValeurChamp <decimal>("edaCableInternetTelephone");
            nudCellulaire.Value             = evaluation.GetValeurChamp <decimal>("edaCellulaire");
            nudChauffage.Value                  = evaluation.GetValeurChamp <decimal>("edaChauffage");
            nudChomage.Value                    = evaluation.GetValeurChamp <decimal>("edaChomage");
            nudDepensesCourantes.Value          = evaluation.GetValeurChamp <decimal>("edaDepensesCourantes");
            nudEssenceEntretien.Value           = evaluation.GetValeurChamp <decimal>("edaEssenceEntretien");
            nudHydroQuebec.Value                = evaluation.GetValeurChamp <decimal>("edaHydroQuebec");
            nudImmatriculationPermis.Value      = evaluation.GetValeurChamp <decimal>("edaImmatriculationPermis");
            nudImpotSolidarite.Value            = evaluation.GetValeurChamp <decimal>("edaImpotSolidarite");
            nudLoyerHypotheque.Value            = evaluation.GetValeurChamp <decimal>("edaLoyerHypotheque");
            nudPensionAlimentaireDepenses.Value = evaluation.GetValeurChamp <decimal>("edaPensionAlimentaireDepense");
            nudPensionAlimentaireRevenus.Value  = evaluation.GetValeurChamp <decimal>("edaPensionAlimentaireRevenu");
            nudPensionVieillesse.Value          = evaluation.GetValeurChamp <decimal>("edaPensionVieillesse");
            nudPresFamFed.Value                 = evaluation.GetValeurChamp <decimal>("edaPrestationsFamFed");
            nudPresFamProv.Value                = evaluation.GetValeurChamp <decimal>("edaPrestationsFamProv");
            nudRemboursementAuto.Value          = evaluation.GetValeurChamp <decimal>("edaRemboursementAuto");
            nudRRQ.Value               = evaluation.GetValeurChamp <decimal>("edaRRQ");
            nudTalonPaie.Value         = evaluation.GetValeurChamp <decimal>("edaTalonPaie");
            nudTaxesScolairesNum.Value = evaluation.GetValeurChamp <decimal>("edaTaxesScolairesMun");
            nudTPS.Value               = evaluation.GetValeurChamp <decimal>("edaTPS");

            txtAutresDepenses1.Text = evaluation.GetValeurChamp <string>("edaNomAutreDepenses1");
            txtAutresDepenses2.Text = evaluation.GetValeurChamp <string>("edaNomAutresDepenses2");
            txtAutresDepenses3.Text = evaluation.GetValeurChamp <string>("edaNomAutresDepenses3");
            txtAutresRevenus1.Text  = evaluation.GetValeurChamp <string>("edaNomAutresRevenus1");
            txtAutresRevenus2.Text  = evaluation.GetValeurChamp <string>("edaNomAutresRevenus2");
            txtAutresRevenus3.Text  = evaluation.GetValeurChamp <string>("edaNomAutresRevenus3");
            txtCommentaires.Text    = evaluation.GetValeurChamp <string>("edaCommentaires");

            dtpDateNaissance.Value = evaluation.GetValeurChamp <DateTime>("edaDate");
            rbRefuse.Checked       = !(rbAccepte.Checked = evaluation.GetValeurChamp <bool>("edaAccepte"));
        }
Ejemplo n.º 26
0
        private void ChargerDonneesPersonneCourante()
        {
            Champ indexPersonne = PersonneCourante.GetChamp("perId");

            lblDateDerniereMajValeur.Text = PersonneCourante.GetValeurChamp <DateTime>("perDateDerniereMaj").ToShortDateString();

            RequeteSelection reqSelStatut = new RequeteSelection(NomTable.statut, "staNom");

            reqSelStatut.Condition = new ConditionRequete(Operateur.EGAL, PersonneCourante.GetChamp("staId"));

            RequeteSelection reqSelBeneficiaire = new RequeteSelection(NomTable.beneficiaire);

            reqSelBeneficiaire.Condition = new ConditionRequete(Operateur.EGAL, indexPersonne);

            Table statut = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelStatut);

            lblStatutValeur.Text = !statut.EstVide ? statut.Lignes[0].GetValeurChamp <string>("staNom") : "";

            Table beneficiaire = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelBeneficiaire);

            cbBeneficiaire.Checked = !beneficiaire.EstVide;

            RequeteSelection reqSelBenevole = new RequeteSelection(NomTable.benevole);

            reqSelBenevole.Condition = new ConditionRequete(Operateur.EGAL, indexPersonne);

            Table benevole = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelBenevole);

            cbBenevole.Checked = !benevole.EstVide;

            if (cbBenevole.Checked)
            {
                LigneTable infosBenevole = benevole.Lignes[0];

                txtNoCarte.Text       = infosBenevole.GetValeurChamp <int>("benvNoCarte").ToString();
                cbEnProbation.Checked = infosBenevole.GetValeurChamp <bool>("benvEnProbation");

                if (cbEnProbation.Checked)
                {
                    dtpDebutProbation.Value = infosBenevole.GetValeurChamp <DateTime>("benvDebutProbation");
                    dtpFinProbation.Value   = infosBenevole.GetValeurChamp <DateTime>("benvFinProbation");
                }
                else
                {
                    dtpDebutProbation.Value = dtpFinProbation.Value = DateTime.Today;
                }
            }

            RequeteSelection reqSelEmploye = new RequeteSelection(NomTable.employe);

            reqSelEmploye.Condition = new ConditionRequete(Operateur.EGAL, indexPersonne);

            Table employe = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelEmploye);

            cbEmploye.Checked = !employe.EstVide;

            AncienIndexPersonneCouple = 0;
            ViderDonneesCouple();
            Table couple = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Couple", "SELECT p.* FROM Personne p INNER JOIN Couple c ON p.perId = c.perIdDeuxieme WHERE c.perIdPremier = " + indexPersonne.Valeur + ";");

            if (!couple.EstVide)
            {
                AncienIndexPersonneCouple = couple.Lignes[0].GetValeurChamp <int>("perId");
                RemplirDonneesCouple(couple.Lignes[0]);
            }
            else
            {
                couple = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Couple", "SELECT p.* FROM Personne p INNER JOIN Couple c ON p.perId = c.perIdPremier WHERE c.perIdDeuxieme = " + indexPersonne.Valeur + ";");

                if (!couple.EstVide)
                {
                    AncienIndexPersonneCouple = couple.Lignes[0].GetValeurChamp <int>("perId");
                    RemplirDonneesCouple(couple.Lignes[0]);
                }
            }

            txtNom.Text          = PersonneCourante.GetValeurChamp <string>("perNom");
            txtPrenom.Text       = PersonneCourante.GetValeurChamp <string>("perPrenom");
            txtCourriel.Text     = PersonneCourante.GetValeurChamp <string>("perCourriel");
            mtxtTelephone1.Text  = PersonneCourante.GetValeurChamp <string>("perTelephone1");
            mtxtTelephone2.Text  = PersonneCourante.GetValeurChamp <string>("perTelephone2");
            mtxtTelephone3.Text  = PersonneCourante.GetValeurChamp <string>("perTelephone3");
            txtCommentaires.Text = PersonneCourante.GetValeurChamp <string>("perCommentaires");

            if (PersonneCourante.GetValeurChamp <bool>("perSexe"))
            {
                rbSexeF.Checked = true;
            }
            else
            {
                rbSexeM.Checked = true;
            }

            if (PersonneCourante.GetValeurChamp <bool>("perFumeur"))
            {
                rbFumeurOui.Checked = true;
            }
            else
            {
                rbFumeurNon.Checked = true;
            }

            foreach (ComboBoxItem etat in cmbEtatCivil.Items)
            {
                if (((int)etat.Value) == PersonneCourante.GetValeurChamp <int>("etaId"))
                {
                    cmbEtatCivil.SelectedItem = etat;
                    break;
                }
            }

            if (cbEchoBenevole.Checked = PersonneCourante.GetValeurChamp <bool>("perInfoCAB"))
            {
                cbParCourriel.Checked = PersonneCourante.GetValeurChamp <bool>("perInfoCABCourriel");
            }

            dtpDateNaissance.Value = PersonneCourante.GetValeurChamp <DateTime>("perDateNaissance");

            foreach (int indexLangue in chklbLangues.CheckedIndices)
            {
                chklbLangues.SetItemChecked(indexLangue, false);
            }

            RequeteSelection reqSel = new RequeteSelection(NomTable.languepersonne);

            reqSel.Condition = new ConditionRequete(Operateur.EGAL, PersonneCourante.GetChamp("perId"));

            Table langues = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

            foreach (LigneTable langue in langues.Lignes)
            {
                for (int i = 0; i < chklbLangues.Items.Count; ++i)
                {
                    if (((int)(chklbLangues.Items[i] as ComboBoxItem).Value) == langue.GetValeurChamp <int>("lanId"))
                    {
                        chklbLangues.SetItemChecked(i, true);
                    }
                }
            }

            lbServicesInscrits.Items.Clear();
            Services = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Service", String.Format(FORMAT_REQ_SERVICES, indexPersonne.ValeurSQL));
            Services.Lignes.ForEach(l => lbServicesInscrits.Items.Add(l.GetValeurChamp <string>("serNom")));

            RemplirDonneesAdresse(PersonneCourante);
        }
Ejemplo n.º 27
0
        private void btnImprimer_Click(object sender, EventArgs e)
        {
            Gabarit    fiche = new Gabarit(Global.GetConfiguration <string>("GABARIT_FICHE"));
            LigneTable copie = new LigneTable(PersonneCourante);

            //Sexe
            bool sexe = PersonneCourante.GetValeurChamp <bool>("perSexe");

            copie.AjouterChamp("perMasculin", sexe == false);
            copie.AjouterChamp("perFeminin", sexe == true);

            //Langues
            int   indexPersonne = PersonneCourante.GetValeurChamp <int>("perId");
            Table francais      = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("langue", String.Format(FORMAT_REQ_LANGUE, indexPersonne, "Français"));
            Table anglais       = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("langue", String.Format(FORMAT_REQ_LANGUE, indexPersonne, "Anglais"));

            copie.AjouterChamp("perFrancais", !francais.EstVide);
            copie.AjouterChamp("perAnglais", !anglais.EstVide);

            if (PersonneCouple != null)
            {
                copie.AjouterChamp("perNomConjoint", PersonneCouple.GetValeurChamp <string>("perNom"));
                copie.AjouterChamp("perPrenomConjoint", PersonneCouple.GetValeurChamp <string>("perPrenom"));

                //Sexe conjoint
                sexe = PersonneCouple.GetValeurChamp <bool>("perSexe");
                copie.AjouterChamp("perMasculinConjoint", sexe == false);
                copie.AjouterChamp("perFemininConjoint", sexe == true);

                copie.AjouterChamp("perDateNaissanceConj", PersonneCouple.GetValeurChamp <DateTime>("perDateNaissance"));

                //Langues conjoint
                indexPersonne = PersonneCouple.GetValeurChamp <int>("perId");
                francais      = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("langue", String.Format(FORMAT_REQ_LANGUE, indexPersonne, "Français"));
                anglais       = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("langue", String.Format(FORMAT_REQ_LANGUE, indexPersonne, "Anglais"));
                copie.AjouterChamp("perFrancaisConjoint", !francais.EstVide);
                copie.AjouterChamp("perAnglaisConjoint", !anglais.EstVide);
            }

            //Personnes à rejoindre
            RequeteSelection reqSel = new RequeteSelection(NomTable.arejoindre);

            reqSel.Condition = new ConditionRequete(Operateur.EGAL, PersonneCourante.GetChamp("perId"));

            Table personnesARejoindre = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

            if (!personnesARejoindre.EstVide)
            {
                LigneTable personneARejoindre = personnesARejoindre.Lignes[0];
                string     nom = personneARejoindre.GetValeurChamp <string>("arjPrenom") + " " + personneARejoindre.GetValeurChamp <string>("arjNom");

                copie.AjouterChamp("perNomRej1", nom);
                copie.AjouterChamp("perLienRej1", personneARejoindre.GetValeurChamp <string>("arjLien"));
                copie.AjouterChamp("perTelephoneRej1", personneARejoindre.GetValeurChamp <string>("arjTelephone"));

                if (personnesARejoindre.NombreLignes > 1)
                {
                    personneARejoindre = personnesARejoindre.Lignes[1];
                    nom = personneARejoindre.GetValeurChamp <string>("arjPrenom") + " " + personneARejoindre.GetValeurChamp <string>("arjNom");

                    copie.AjouterChamp("perNomRej2", nom);
                    copie.AjouterChamp("perLienRej2", personneARejoindre.GetValeurChamp <string>("arjLien"));
                    copie.AjouterChamp("perTelephoneRej2", personneARejoindre.GetValeurChamp <string>("arjTelephone"));
                }
            }

            //Services
            string servicesInscrits = "";

            if (Services != null && !Services.EstVide)
            {
                servicesInscrits = Services.Lignes[0].GetValeurChamp <string>("serNom");

                for (int i = 1; i < Services.NombreLignes; ++i)
                {
                    servicesInscrits += "\n" + Services.Lignes[i].GetValeurChamp <string>("serNom");
                }
            }

            copie.AjouterChamp("perServices", servicesInscrits);

            fiche.Generer(copie);
        }
Ejemplo n.º 28
0
        public override void EnvoyerMessages(params object[] messages)
        {
            if (messages.Length == 1 && messages[0] is int)
            {
                IndexBeneficiaireCourant = (int)messages[0];

                RequeteSelection reqSel = new RequeteSelection(NomTable.inscriptiondepannagealimentaire);
                reqSel.Condition = new ConditionRequete(Operateur.EGAL, "perId", IndexBeneficiaireCourant.ToString());

                Table inscriptionLifeline = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel);

                if (!inscriptionLifeline.EstVide)
                {
                    LigneTable infosInscription = inscriptionLifeline.Lignes[0];

                    nudNbEnfants.Value = infosInscription.GetValeurChamp <int>("idaNombreEnfants");

                    txtAges.Text            = infosInscription.GetValeurChamp <string>("idaAgesEnfants");
                    txtDetailsFactures.Text = infosInscription.GetValeurChamp <string>("idaDetailsFactures");
                    txtDetailsAutres.Text   = infosInscription.GetValeurChamp <string>("idaDetailsAutres");

                    cbAllocationFamiliale.Checked   = infosInscription.GetValeurChamp <bool>("idaAllocationFamiliale");
                    cbCarteMedicament.Checked       = infosInscription.GetValeurChamp <bool>("idaCarteMedicament");
                    cbCarteAssuranceMaladie.Checked = infosInscription.GetValeurChamp <bool>("idaCarteAssuranceMaladie");
                    cbPermisConduire.Checked        = infosInscription.GetValeurChamp <bool>("idaPermisConduire");
                    cbProprietaire.Checked          = infosInscription.GetValeurChamp <bool>("idaProprietaire");
                    cbLocataire.Checked             = infosInscription.GetValeurChamp <bool>("idaLocataire");
                    cbBail.Checked            = infosInscription.GetValeurChamp <bool>("idaBail");
                    cbFactures.Checked        = infosInscription.GetValeurChamp <bool>("idaFactures");
                    cbPerteEmploi.Checked     = infosInscription.GetValeurChamp <bool>("idaPerteEmploi");
                    cbSeparation.Checked      = infosInscription.GetValeurChamp <bool>("idaSeparation");
                    cbAccidentMaladie.Checked = infosInscription.GetValeurChamp <bool>("idaAccidentAutoMaladie");
                    cbFaibleRevenu.Checked    = infosInscription.GetValeurChamp <bool>("idaFaibleRevenu");
                    cbAccidentTravail.Checked = infosInscription.GetValeurChamp <bool>("idaAccidentTravail");
                    cbDemenagement.Checked    = infosInscription.GetValeurChamp <bool>("idaDemenagement");
                    cbAutres.Checked          = infosInscription.GetValeurChamp <bool>("idaAutres");
                }
                else
                {
                    Vider();
                }
            }
        }
Ejemplo n.º 29
0
        public override bool Enregistrer()
        {
            if (!base.Enregistrer())
            {
                return(false);
            }

            if (!ValiderDonnees())
            {
                return(false);
            }

            List <DateTime> datesAAjouter  = new List <DateTime>();
            List <DateTime> datesAModifier = new List <DateTime>();

            foreach (DateTime date in GetDatesConsiderees())
            {
                if (GetIndexLivraisonExistante(date) < 0)
                {
                    datesAAjouter.Add(date);
                }
                else
                {
                    datesAModifier.Add(date);
                }
            }

            Champ champId        = new Champ("livraisonpopoteroulante", "perId", BeneficiaireCourant.GetValeurChamp <int>("perId"));
            Champ champNbRepas   = new Champ("livraisonpopoteroulante", "lprNombreRepas", (int)nudNombreRepas.Value);
            Champ champPrixRepas = new Champ("livraisonpopoteroulante", "lprPrixRepas", nudPrixRepas.Value);

            LigneTable livraison = new LigneTable("livraisonpopoteroulante");

            livraison.AjouterChamp(champId);
            livraison.AjouterChamp(champNbRepas);
            livraison.AjouterChamp(champPrixRepas);

            bool erreur = false;

            foreach (DateTime date in datesAAjouter)
            {
                LigneTable copieLivraison = new LigneTable(livraison);
                copieLivraison.AjouterChamp(new Champ("livraisonpopoteroulante", "lprDate", date));

                RequeteAjout reqAjout = new RequeteAjout(NomTable.livraisonpopoteroulante, copieLivraison);

                if (Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout) < 0)
                {
                    erreur = true;
                }
                else
                {
                    Livraisons.Lignes.Add(copieLivraison);
                    AjouterLivraisonCalendrier(date);
                }
            }

            ConditionRequete    cond     = new ConditionRequete(Operateur.EGAL, champId);
            RequeteModification reqModif = new RequeteModification(NomTable.livraisonpopoteroulante, cond, champNbRepas, champPrixRepas);

            foreach (DateTime date in datesAModifier)
            {
                ConditionRequete copieCond = new ConditionRequete(cond);
                copieCond.LierCondition(new ConditionRequete(Operateur.EGAL, new Champ("livraisonpopoteroulante", "lprDate", date)), true);

                reqModif.Condition = copieCond;

                if (Global.BaseDonneesCABS.EnvoyerRequeteModification(reqModif) < 0)
                {
                    erreur = true;
                }
                else
                {
                    int indexLivraisonAModifier = GetIndexLivraisonExistante(date);

                    if (indexLivraisonAModifier >= 0)
                    {
                        LigneTable copieLivraison = new LigneTable(livraison);
                        copieLivraison.AjouterChamp(new Champ("livraisonpopoteroulante", "lprDate", date));
                        Livraisons.Lignes[indexLivraisonAModifier] = copieLivraison;
                    }
                }
            }

            if (erreur)
            {
                Journal.AfficherMessage("Une erreur est survenue lors de la modification d'une ou plusieurs livraisons.", TypeMessage.ERREUR, true);
            }

            return(true);
        }