private void btnAjouter_Click(object sender, EventArgs e) { Champ nom = new Champ(NomTable.routepopoteroulante.ToString(), "rprNom", txtNouvelleRoute.Text); RequeteSelection reqSel = new RequeteSelection(NomTable.routepopoteroulante); reqSel.Condition = new ConditionRequete(Operateur.COMME, nom); if (!Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel).EstVide&& !OutilsForms.PoserQuestion("Confirmation d'ajout", "Une route portant le même nom existe déjà. Voulez-vous quand même ajouter celle-ci?")) { return; } RequeteAjout reqAjout = new RequeteAjout(NomTable.routepopoteroulante, nom); int nouvelIndex; if ((nouvelIndex = Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout)) < 0) { Journal.AfficherMessage("Une erreur est survenue lors de l'ajout d'une route. L'action a été annulée.", TypeMessage.ERREUR, true); return; } TreeNode nouveauNoeudRoute = new TreeNode(txtNouvelleRoute.Text); nouveauNoeudRoute.Tag = nouvelIndex; tvRoutesBeneficiaires.Nodes.Add(nouveauNoeudRoute); txtNouvelleRoute.Text = ""; }
private void cmbSousChamp_SelectedIndexChanged(object sender, EventArgs e) { if (cmbSousChamp.SelectedIndex == DernierIndexSousChamp) { return; } DernierIndexSousChamp = cmbSousChamp.SelectedIndex; cmbActivite.SelectedIndex = -1; cmbActivite.Items.Clear(); if (cmbSousChamp.SelectedIndex == -1) { return; } RequeteSelection reqSel = new RequeteSelection(NomTable.activite); reqSel.Condition = new ConditionRequete(Operateur.EGAL, ((Champ)((ComboBoxItem)cmbSousChamp.SelectedItem).Value)); Table activites = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); activites.Lignes.ForEach(l => cmbActivite.Items.Add(new ComboBoxItem(l.GetValeurChamp <string>("actNom"), l.GetChamp("actId")))); if (cmbActivite.Items.Count > 0) { cmbActivite.SelectedIndex = 0; } ChangerAccesControle(Mode); }
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(); } } }
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(); } } }
private void btnChoisirBeneficiaire_Click(object sender, EventArgs e) { RequeteSelection reqSel = new RequeteSelection(NomTable.statut, "staId"); reqSel.Condition = new ConditionRequete(Operateur.COMME, "staNom", "'Actif'"); Table statutActif = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); if (statutActif.EstVide || statutActif.NombreLignes > 1) { Journal.AfficherMessage("La table des statuts est inexistante ou corrompue. L'action a été annulée.", TypeMessage.ERREUR, true); return; } int indexStatutActif = statutActif.Lignes[0].GetValeurChamp <int>("staId"); Table beneficiaires = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Personne", "SELECT p.* FROM Personne p INNER JOIN Beneficiaire b ON p.perId = b.perId WHERE p.staId=" + indexStatutActif + " ORDER BY perNom, perPrenom, perDateNaissance;"); frmSelectionTable choixBeneficiaire = new frmSelectionTable("Choisir un bénéficiaire...", beneficiaires, new List <string> { "perNom", "perPrenom", "perDateNaissance" }, "perId"); if (choixBeneficiaire.AfficherDialogue(this)) { ChargerBeneficiaire(choixBeneficiaire.LigneChoisie); } }
private void cmbActivite_SelectedIndexChanged(object sender, EventArgs e) { if (cmbActivite.SelectedIndex == DernierIndexActivite) { return; } DernierIndexActivite = cmbActivite.SelectedIndex; cmbAction.SelectedIndex = -1; cmbAction.Items.Clear(); if (cmbActivite.SelectedIndex == -1) { return; } RequeteSelection reqSel = new RequeteSelection(NomTable.actionactivite); reqSel.Condition = new ConditionRequete(Operateur.EGAL, ((Champ)((ComboBoxItem)cmbActivite.SelectedItem).Value)); reqSel.AjouterTri("actaDate", false); Table actions = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); actions.Lignes.ForEach(l => cmbAction.Items.Add(new ComboBoxItem(l.GetValeurChamp <DateTime>("actaDate").ToLongDateString(), l))); if (cmbAction.Items.Count > 0) { cmbAction.SelectedIndex = 0; } ChangerAccesControle(Mode); }
private void gtBeneficiaires_RowDoubleClick(object sender, Outils.RowDoubleClickEventArgs e) { Champ indexBeneficiaire = e.LigneCliquee.GetChamp("perId"); LigneTable action = ((LigneTable)((ComboBoxItem)cmbAction.SelectedItem).Value); string infosBeneficiaire = String.Format(FORMAT_BENEFICIAIRES_INCLUS, e.LigneCliquee.GetValeurChamp <string>("perNom"), e.LigneCliquee.GetValeurChamp <string>("perPrenom")); RequeteSelection reqSel = new RequeteSelection(NomTable.beneficiaireactionactivite); reqSel.Condition = new ConditionRequete(Operateur.EGAL, indexBeneficiaire); reqSel.Condition.LierCondition(new ConditionRequete(Operateur.EGAL, action.GetChamp("actaId")), true); if (!Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel).EstVide) { Journal.AfficherMessage("Ce bénéficiaire fait déjà partie de cette action.", TypeMessage.INFORMATION, false); return; } RequeteAjout reqAjout = new RequeteAjout(NomTable.beneficiaireactionactivite, indexBeneficiaire, action.GetChamp("actaId")); if (Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout) < 0) { Journal.AfficherMessage("Une erreur est survenue lors de l'ajout du bénéficiaire à l'action. L'action a été annulée.", TypeMessage.ERREUR, true); return; } AjouterItem(lbBeneficiairesInclus, new ComboBoxItem(infosBeneficiaire, indexBeneficiaire)); }
private void gtEmployes_RowDoubleClick(object sender, RowDoubleClickEventArgs e) { Champ indexEmploye = e.LigneCliquee.GetChamp("perId"); Champ nombreHeures = new Champ("employereunion", "erHeures", (int)nudNombreHeuresEmploye.Value); LigneTable reunion = ((LigneTable)((ComboBoxItem)cmbReunion.SelectedItem).Value); string infosEmploye = String.Format(FORMAT_PERSONNES_INCLUS, e.LigneCliquee.GetValeurChamp <string>("perNom"), e.LigneCliquee.GetValeurChamp <string>("perPrenom"), nombreHeures.Valeur); RequeteSelection reqSel = new RequeteSelection(NomTable.employereunion); reqSel.Condition = new ConditionRequete(Operateur.EGAL, indexEmploye); reqSel.Condition.LierCondition(new ConditionRequete(Operateur.EGAL, reunion.GetChamp("reuId")), true); if (!Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel).EstVide) { Journal.AfficherMessage("Cet employé fait déjà partie de cette réunion. Retirez-le préalablement pour modifier son nombre d'heures.", TypeMessage.INFORMATION, false); return; } RequeteAjout reqAjout = new RequeteAjout(NomTable.employereunion, indexEmploye, reunion.GetChamp("reuId"), nombreHeures); if (Global.BaseDonneesCABS.EnvoyerRequeteAjout(reqAjout) < 0) { Journal.AfficherMessage("Une erreur est survenue lors de l'ajout de l'employé à la réunion. L'action a été annulée.", TypeMessage.ERREUR, true); return; } AjouterItem(lbEmployesInclus, new ComboBoxItem(infosEmploye, indexEmploye)); }
private void frmPersonne_Load(object sender, EventArgs e) { RequeteSelection reqSelEtatsCivil = new RequeteSelection(NomTable.etatcivil); Table etatsCivil = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelEtatsCivil); foreach (LigneTable etat in etatsCivil.Lignes) { cmbEtatCivil.Items.Add(new ComboBoxItem(etat.GetValeurChamp <string>("etaNom"), etat.GetValeurChamp <int>("etaId"))); } RequeteSelection reqSelLangues = new RequeteSelection(NomTable.langue); Table langues = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelLangues); foreach (LigneTable langue in langues.Lignes) { chklbLangues.Items.Add(new ComboBoxItem(langue.GetValeurChamp <string>("lanNom"), langue.GetValeurChamp <int>("lanId"))); } RequeteSelection reqSelStatutActif = new RequeteSelection(NomTable.statut, "staId"); reqSelStatutActif.Condition = new ConditionRequete(Operateur.COMME, "staNom", "'Actif'"); Table tableStatutActif = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSelStatutActif); if (!tableStatutActif.EstVide) { StatutActif = tableStatutActif.Lignes[0].GetChamp("staId"); } }
private void ChargerDonneesBeneficiaireCourant() { RequeteSelection reqSel = new RequeteSelection(NomTable.evaluationdepannagealimentaire); reqSel.Condition = new ConditionRequete(Operateur.EGAL, BeneficiaireCourant.GetChamp("idaId")); reqSel.AjouterTri("edaDate", false); Evaluations = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); cmbEvaluationsPrecedentes.Items.Clear(); foreach (LigneTable eval in Evaluations.Lignes) { DateTime dateEval = eval.GetValeurChamp <DateTime>("edaDate"); cmbEvaluationsPrecedentes.Items.Add(new ComboBoxItem(dateEval.ToLongDateString(), eval)); } if (cmbEvaluationsPrecedentes.Items.Count > 0) { cmbEvaluationsPrecedentes.SelectedIndex = 0; } else { Vider(); } }
private void frmEvaluationsFinancieres_Load(object sender, EventArgs e) { CreerHandlers(); lblTotalRevenusValeur.Text = TotalRevenus.ToString("C"); lblTotalDepensesValeur.Text = TotalDepenses.ToString("C"); MettreAJourMontantPersonneSemaine(); RequeteSelection reqSel = new RequeteSelection(NomTable.service, "serId"); reqSel.Condition = new ConditionRequete(Operateur.COMME, "serNom", "'Dépannage alimentaire La Manne'"); Table service = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); if (!service.EstVide) { IdService = service.Lignes[0].GetValeurChamp <int>("serId"); } reqSel = new RequeteSelection(NomTable.statut, "staId"); reqSel.Condition = new ConditionRequete(Operateur.COMME, "staNom", "'Actif'"); Table statut = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); if (!statut.EstVide) { IdStatut = statut.Lignes[0].GetValeurChamp <int>("staId"); } }
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(); } } }
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(); } } }
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(); }
private void frmGestionLivraisons_Load(object sender, EventArgs e) { cmbFrequence.SelectedIndex = 0; cmbFrequence.MouseWheel += new MouseEventHandler(numericUpDown_MouseWheel); mcCalendrier.BoldedDateCategoryCollection.Add(CategorieAvant); mcCalendrier.BoldedDateCategoryCollection.Add(CategorieApres); cbLundi.EnabledChanged += new EventHandler(CheckBoxDesactive); cbMardi.EnabledChanged += new EventHandler(CheckBoxDesactive); cbMercredi.EnabledChanged += new EventHandler(CheckBoxDesactive); cbJeudi.EnabledChanged += new EventHandler(CheckBoxDesactive); cbVendredi.EnabledChanged += new EventHandler(CheckBoxDesactive); cbSamedi.EnabledChanged += new EventHandler(CheckBoxDesactive); cbDimanche.EnabledChanged += new EventHandler(CheckBoxDesactive); cbFinDeSemaine.EnabledChanged += new EventHandler(CheckBoxDesactive); nudNombreRepas.MouseWheel += new MouseEventHandler(numericUpDown_MouseWheel); nudPrixRepas.MouseWheel += new MouseEventHandler(numericUpDown_MouseWheel); nudNombreRepas.Click += new EventHandler(numericUpDown_Click); nudPrixRepas.Click += new EventHandler(numericUpDown_Click); nudNombreRepas.KeyPress += new KeyPressEventHandler(numericUpDown_KeyPress); nudPrixRepas.KeyPress += new KeyPressEventHandler(numericUpDown_KeyPress); RequeteSelection reqSel = new RequeteSelection(NomTable.service, "serId"); reqSel.Condition = new ConditionRequete(Operateur.COMME, "serNom", "'Popote roulante'"); Table service = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); if (service.NombreLignes == 1) { IdService = service.Lignes[0].GetValeurChamp <int>("serId"); } reqSel = new RequeteSelection(NomTable.statut, "staId"); reqSel.Condition = new ConditionRequete(Operateur.COMME, "staNom", "'Actif'"); Table statut = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); if (statut.NombreLignes == 1) { IdStatut = statut.Lignes[0].GetValeurChamp <int>("staId"); } nudPrixRepas.Value = Global.GetConfiguration <decimal>("PRIX_REPAS_POPOTE"); }
private void btnChoisirPersonne_Click(object sender, EventArgs e) { RequeteSelection reqSel = new RequeteSelection(NomTable.personne); reqSel.AjouterTri("perNom"); reqSel.AjouterTri("perPrenom"); reqSel.AjouterTri("perDateNaissance"); Table personnes = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); frmSelectionTable choixAdresses = new frmSelectionTable("Choisir une personne...", personnes, new List <string> { "perNom", "perPrenom", "perDateNaissance" }, "perId"); if (choixAdresses.AfficherDialogue(this)) { ChargerDossierPersonne(choixAdresses.LigneChoisie); } }
private void ChargerLivraisons() { RequeteSelection reqSel = new RequeteSelection(NomTable.livraisonpopoteroulante); reqSel.Condition = new ConditionRequete(Operateur.EGAL, BeneficiaireCourant.GetChamp("perId")); reqSel.AjouterTri("lprDate"); Livraisons = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); mcCalendrier.BoldedDatesCollection.Clear(); foreach (LigneTable liv in Livraisons.Lignes) { AjouterLivraisonCalendrier(liv.GetValeurChamp <DateTime>("lprDate")); } RafraichirInfosLivraison(); }
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(); } } }
private void btnRechercher_Click(object sender, EventArgs e) { RequeteSelection reqSel = new RequeteSelection(NomTable.personne); reqSel.AjouterTri("perNom"); reqSel.AjouterTri("perPrenom"); reqSel.AjouterTri("perDateNaissance"); Table personnes = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); frmSelectionTable choixPersonne = new frmSelectionTable("Choisir un personne...", personnes, new List <string> { "perNom", "perPrenom", "perDateNaissance" }, "perId"); if (choixPersonne.AfficherDialogue(this)) { PersonneCourante = choixPersonne.LigneChoisie; RafraichirPersonneCourante(); } }
public override void EntrerPage() { base.EntrerPage(); Table beneficiaires = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Beneficiaire", RequeteNonClasses); lbBeneficiaires.Items.Clear(); foreach (LigneTable beneficiaire in beneficiaires.Lignes) { lbBeneficiaires.Items.Add(new ComboBoxItem(GetNomAdresseBeneficiaire(beneficiaire), beneficiaire)); } RequeteSelection reqSel = new RequeteSelection(NomTable.routepopoteroulante); reqSel.AjouterTri("rprNom"); Table routes = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); tvRoutesBeneficiaires.Nodes.Clear(); foreach (LigneTable route in routes.Lignes) { int indexRoute = route.GetValeurChamp <int>("rprId"); TreeNode nouveauNoeudRoute = new TreeNode(route.GetValeurChamp <string>("rprNom")); nouveauNoeudRoute.Tag = indexRoute; Table beneficiairesRoute = Global.BaseDonneesCABS.EnvoyerRequeteSelectionDirect("Beneficiaire", String.Format(FormatRequeteBeneficiairesRoute, indexRoute)); foreach (LigneTable beneficiaire in beneficiairesRoute.Lignes) { TreeNode nouveauNoeudBeneficiaire = new TreeNode(GetNomAdresseBeneficiaire(beneficiaire)); nouveauNoeudBeneficiaire.Tag = beneficiaire; nouveauNoeudRoute.Nodes.Add(nouveauNoeudBeneficiaire); } tvRoutesBeneficiaires.Nodes.Add(nouveauNoeudRoute); } MettreAJourAccesControles(); }
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); } }
private void frmListesPersonnes_Load(object sender, EventArgs e) { RequeteSelection reqServices = new RequeteSelection(NomTable.service); reqServices.AjouterTri("serNom"); Services = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqServices); foreach (LigneTable ligneService in Services.Lignes) { ComboBoxItem service = new ComboBoxItem(ligneService.GetValeurChamp <string>("serNom"), ligneService.GetValeurChamp <int>("serId")); cmbServiceBeneficiaires.Items.Add(service); cmbServiceBenevoles.Items.Add(service); } if (!Services.EstVide) { cmbServiceBeneficiaires.SelectedIndex = 0; cmbServiceBenevoles.SelectedIndex = 0; } }
private void RafraichirService() { ConditionRequete condReqSel = new ConditionRequete(Operateur.EGAL, "perId", BenevoleCourant.GetChamp("perId").ValeurSQL); condReqSel.LierCondition(new ConditionRequete(Operateur.EGAL, "serId", (cmbService.SelectedItem as ComboBoxItem).Value.ToString()), true); RequeteSelection reqSel = new RequeteSelection(NomTable.disponibiliteservice); reqSel.Condition = condReqSel; Table disponibilite = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); if (!disponibilite.EstVide) { ChangerAccesControle(ModeFormulaire.CONSULTATION); } else { ChangerAccesControle(ModeFormulaire.AJOUT); } }
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(); } } }
public override void EntrerPage() { base.EntrerPage(); DateTime maintenant = DateTime.Now; mcDateLivraisons.SelectionRange = new SelectionRange(maintenant, maintenant); mcDateLivraisons.ViewStart = maintenant; RequeteSelection reqSel = new RequeteSelection(NomTable.routepopoteroulante); reqSel.AjouterTri("rprNom"); Table routes = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); clbRoutes.Items.Clear(); foreach (LigneTable route in routes.Lignes) { clbRoutes.Items.Add(new ComboBoxItem(route.GetValeurChamp <string>("rprNom"), route.GetValeurChamp <int>("rprId"))); } }
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(); } } }
private void lbSousChamps_SelectedIndexChanged(object sender, EventArgs e) { if (lbSousChamps.SelectedIndex == DernierIndexSousChamp) { return; } DernierIndexSousChamp = lbSousChamps.SelectedIndex; bool sousChampSelectionne = DernierIndexSousChamp != -1; btnModifierSousChamp.Enabled = sousChampSelectionne && txtNomSousChamp.TextLength > 0; btnSupprimerSousChamp.Enabled = sousChampSelectionne; btnAjouterActivite.Enabled = lbSousChamps.SelectedIndex != -1 && txtNomActivite.TextLength > 0; List <ComboBoxItem> listeActivites = (List <ComboBoxItem>)lbActivites.DataSource; if (listeActivites != null) { listeActivites.Clear(); } else { listeActivites = new List <ComboBoxItem>(); } if (sousChampSelectionne) { RequeteSelection reqSel = new RequeteSelection(NomTable.activite); reqSel.Condition = new ConditionRequete(Operateur.EGAL, ((Champ)((ComboBoxItem)lbSousChamps.SelectedItem).Value)); Table activites = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); activites.Lignes.ForEach(l => listeActivites.Add(new ComboBoxItem(l.GetValeurChamp <string>("actNom"), l.GetChamp("actId")))); } MettreAJourListe(lbActivites, listeActivites); }
public override void EntrerPage() { base.EntrerPage(); RequeteSelection reqSel = new RequeteSelection(NomTable.service); reqSel.AjouterTri("serNom"); Table services = Global.BaseDonneesCABS.EnvoyerRequeteSelection(reqSel); ComboBoxItem itemService; cmbService.Items.Clear(); foreach (LigneTable service in services.Lignes) { itemService = new ComboBoxItem(service.GetValeurChamp <string>("serNom"), service.GetValeurChamp <int>("serId")); cmbService.Items.Add(itemService); } if (cmbService.Items.Count > 0) { cmbService.SelectedIndex = 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); }
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); }