private void setPnlStatistiqueParEleveResultat()
        {
            List <Adherent> adherents = GestionAdherent.GetAdherent();
            List <Flux>     fluxs     = GestionFlux.GetLesFlux();

            int y = FrmUtilitaire.Coord;

            foreach (Adherent adherent in adherents)
            {
                int nbFlux = 0;

                List <Label> labels = new List <Label>();
                labels.Add(FrmUtilitaire.setLabel(adherent.Nom.Trim(), y: y));
                labels.Add(FrmUtilitaire.setLabel(adherent.Prenom.Trim(), y: y));

                foreach (Flux flux in fluxs)
                {
                    if (flux.TypeFlux.Libelle.Trim() == Inscription && flux.Adherent.Id == adherent.Id)
                    {
                        nbFlux += 1;
                    }
                }

                labels.Add(FrmUtilitaire.setLabel(nbFlux.ToString(), y: y));

                y += 20;

                FrmUtilitaire.init().putLabelInPnl(labels, this.findControl(PnlStatistiqueParEleve));
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ValidateAdherent();
            ValidateBudget();
            ValidateDate();
            ValidateFlux();
            ValidateMontant();
            ValidatePrelev();
            ValidateTypeflux();

            bool montant = textBox2.Text.All(char.IsDigit);

            if (String.IsNullOrEmpty(dateTimePicker1.Text) == true || String.IsNullOrEmpty(textBox1.Text) == true || String.IsNullOrEmpty(textBox2.Text) == true ||
                String.IsNullOrEmpty(comboBox1.Text) == true || String.IsNullOrEmpty(comboBox2.Text) == true ||
                String.IsNullOrEmpty(comboBox3.Text) == true || String.IsNullOrEmpty(etatPrelev.Text) == true || !montant)
            {
                MessageBox.Show("Veuillez remplir tous les champs");
            }
            else
            {
                string   dateInput           = dateTimePicker1.Text;
                string   libelle             = textBox1.Text;
                float    montantFlux         = float.Parse(textBox2.Text);
                var      parsedDateNaissance = DateTime.Parse(dateInput);
                int      idAdherent          = (int)comboBox1.SelectedValue;
                int      idTypeflux          = (int)comboBox2.SelectedValue;
                int      idBudget            = (int)comboBox3.SelectedValue;
                string   etatPrelevement     = etatPrelev.Text;
                DateTime thisDay             = DateTime.Today;
                Flux     unFlux = new Flux(libelle, parsedDateNaissance, montantFlux, idAdherent, idTypeflux, idBudget, etatPrelevement);
                GestionFlux.AjoutFlux(unFlux);
                this.Close();
            }
        }
Пример #3
0
        public void btnDelete_Click(object sender, EventArgs e)
        {
            Button       senderButton = sender as Button;
            DialogResult dialogResult;

            if (senderButton.Tag is Flux)
            {
                dialogResult = MessageBox.Show("Voulez-vous vraiment supprimer le flux ?", "Validation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    GestionFlux.SupprimerFlux(Convert.ToInt32(((Flux)senderButton.Tag).Id));

                    this.Hide();             // fermeture du formulaire actuel
                    FrmDetailsBudget frmDetailsBudget = new FrmDetailsBudget();
                    frmDetailsBudget.Show(); // ouverture du formulaire
                }
            }
            else
            {
                dialogResult = MessageBox.Show("Voulez-vous vraiment supprimer le budget ? Cela entrainera la suppréssion des flux liés", "Validation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    GestionFlux.SupprimerFluxBudget(Convert.ToInt32(((Budget)senderButton.Tag).Id));
                    GestionBudget.SupprimerBudget(Convert.ToInt32(((Budget)senderButton.Tag).Id));

                    this.Hide();             // fermeture du formulaire actuel
                    FrmDetailsBudget frmDetailsBudget = new FrmDetailsBudget();
                    frmDetailsBudget.Show(); // ouverture du formulaire
                }
            }
        }
        private void btnSupprimerDebits_Click(object sender, EventArgs e)
        {
            List <Flux> liste = new List <Flux>();

            liste = GestionFlux.GetFlux(2);

            var result1 = MessageBox.Show("Voulez-vous vraiment supprimer ce débit ?", "Message d'information", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result1 == DialogResult.Yes)
            {
                dtgDebits.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                int rowIndex    = dtgDebits.CurrentCell.RowIndex;
                int columnIndex = dtgDebits.CurrentCell.ColumnIndex;

                // Il choisit la colonne infectée par le choix
                libelleColumnId = Int32.Parse(dtgDebits.Rows[rowIndex].Cells[columnIndex].Value.ToString());

                // Supprime le crédit avec l'id concerné
                GestionFlux.DeleteFlux(libelleColumnId);

                var result2 = MessageBox.Show("Votre débit a bien été supprimé" + "\nVoulez vous supprimé un autre débit ?", "Message d'information", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result2 == DialogResult.No)
                {
                    Form.ActiveForm.Close();
                }
            }
        }
Пример #5
0
 private void deleteFlux_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult res = MessageBox.Show("Voulez vous vraiment supprimer ce flux ?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (res == DialogResult.OK)
         {
             if (dataGridView1.SelectedRows.Count > 0)
             {
                 int             selectedDrowIndex = dataGridView1.SelectedCells[0].RowIndex;
                 DataGridViewRow selectedRow       = dataGridView1.Rows[selectedDrowIndex];
                 string          a = Convert.ToString(selectedRow.Cells[0].Value);
                 int             value;
                 int.TryParse(a, out value);
                 GestionFlux.SupprimerFlux(value);
                 MessageBox.Show("Suppression réussie.");
             }
         }
         else
         {
             MessageBox.Show("Suppression avortée.");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Il n'y a pas de flux.");
     }
 }
        public FrmGestionBudget()
        {
            InitializeComponent();
            GestionBudget.SetchaineConnexion(ConfigurationManager.
                                             ConnectionStrings["AssocBudget"]);
            GestionFlux.SetchaineConnexion(ConfigurationManager.
                                           ConnectionStrings["AssocFlux"]);

            List <BudgetBO> budgetInitialAS = new List <BudgetBO>();

            budgetInitialAS = GestionBudget.GetBudget("AS");
            List <BudgetBO> budgetInitialEPS = new List <BudgetBO>();

            budgetInitialEPS = GestionBudget.GetBudget("EPS");
            List <Flux> listeCredit = new List <Flux>();

            listeCredit = GestionFlux.GetFlux(1);
            List <Flux> listeDebit = new List <Flux>();

            listeDebit = GestionFlux.GetFlux(2);


            // Rattachement de la List à la source de données du datagridview

            dtgBudgetAS.ColumnHeadersVisible  = false;
            dtgBudgetEPS.ColumnHeadersVisible = false;

            dtgBudgetAS.DataSource  = budgetInitialAS;
            dtgBudgetEPS.DataSource = budgetInitialEPS;
            dtgDebits.DataSource    = listeDebit;
            dtgCredits.DataSource   = listeCredit;
        }
        private void btnActualiserDebits_Click(object sender, EventArgs e)
        {
            List <Flux> liste = new List <Flux>();

            liste = GestionFlux.GetFlux(2);
            dtgDebits.DataSource = liste;
        }
        private void btnActualiserCredits_Click(object sender, EventArgs e)
        {
            List <Flux> listeCredit = new List <Flux>();

            listeCredit           = GestionFlux.GetFlux(1);
            dtgCredits.DataSource = listeCredit;
        }
Пример #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            ValidateAdherent();
            ValidateBudget();
            ValidateFlux();
            ValidateMontant();
            ValidatePrelev();
            ValidateTypeflux();

            //Vérification si le formulaire est plein
            if (String.IsNullOrEmpty(libelleTextBox.Text) == true ||
                String.IsNullOrEmpty(montantTextBox.Text) == true || String.IsNullOrEmpty(comboBox1.Text) == true || String.IsNullOrEmpty(comboBox2.Text) == true || String.IsNullOrEmpty(comboBox3.Text) == true || String.IsNullOrEmpty(comboBox4.Text))
            {
                MessageBox.Show("Veuillez remplir tous les champs");
            }
            else
            {
                string   libelle    = libelleTextBox.Text;
                string   etatPrelev = comboBox4.Text;
                int      montant    = int.Parse(montantTextBox.Text);
                int      budget     = (int)comboBox1.SelectedValue;
                int      adherent   = (int)comboBox2.SelectedValue;
                int      type       = (int)comboBox3.SelectedValue;
                DateTime thisDay    = DateTime.Today;
                /*id_flux, libelle_flux, date_flux, montant_flux, id_adherent, id_typeFlux, id_budget, etat_prelevement*/
                Flux unFlux = new Flux(id_flux, libelle, thisDay, montant, adherent, type, budget, etatPrelev);
                GestionFlux.ModificationFlux(unFlux);
                MessageBox.Show("Le flux a bien été modifié");
                AffichageFlux flux;
                flux = new AffichageFlux();
                flux.Show();
                this.Close();
            }
        }
        private void dtgDebits_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            dtgDebits.AutoGenerateColumns = false;

            DataGridViewTextBoxColumn libelleColumn = new DataGridViewTextBoxColumn();

            libelleColumn.DataPropertyName = "libelle_flux";
            libelleColumn.HeaderText       = "Libelle";

            DataGridViewTextBoxColumn montantColumn = new DataGridViewTextBoxColumn();

            montantColumn.DataPropertyName = "montant_flux";
            montantColumn.HeaderText       = "Montant";

            DataGridViewTextBoxColumn dateColumn = new DataGridViewTextBoxColumn();

            dateColumn.DataPropertyName = "date_flux";
            dateColumn.HeaderText       = "Date";

            DataGridViewTextBoxColumn AdherentColumn = new DataGridViewTextBoxColumn();

            AdherentColumn.DataPropertyName = "id_adherent";
            AdherentColumn.HeaderText       = "Adherent";

            DataGridViewTextBoxColumn TypeFluxColumn = new DataGridViewTextBoxColumn();

            TypeFluxColumn.DataPropertyName = "id_type_flux";
            TypeFluxColumn.HeaderText       = "Type de Flux";

            DataGridViewTextBoxColumn EventColumn = new DataGridViewTextBoxColumn();

            EventColumn.DataPropertyName = "id_budget";
            EventColumn.HeaderText       = "Budget Impacté";

            dtgDebits.Columns.Add(libelleColumn);
            dtgDebits.Columns.Add(montantColumn);
            dtgDebits.Columns.Add(dateColumn);
            dtgDebits.Columns.Add(AdherentColumn);
            dtgDebits.Columns.Add(TypeFluxColumn);
            dtgDebits.Columns.Add(EventColumn);

            dtgDebits.ColumnHeadersVisible = true;
            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

            columnHeaderStyle.BackColor = Color.Beige;
            columnHeaderStyle.Font      = new Font("Verdana", 12, FontStyle.Bold);

            dtgDebits.ColumnHeadersDefaultCellStyle = columnHeaderStyle;
            dtgDebits.AutoSizeColumnsMode           = DataGridViewAutoSizeColumnsMode.Fill;

            // Création d'un objet Liste à afficher dans le datagridview
            List <Flux> liste = new List <Flux>();

            liste = GestionFlux.GetFlux(2);

            // Rattachement de la List à la source de données du datagridview

            dtgDebits.DataSource = liste;
        }
Пример #11
0
        private void btnEnregistrer_Click(object sender, EventArgs e)
        {
            int montantFlux = 0;
            int idAdherent  = ' ';
            int idBudget    = ' ';

            if (txtLibelle.Text == " ")
            {
                MessageBox.Show("Erreur votre champ est vide." +
                                " Veuillez saisir un nom", "Erreur"
                                , MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (txtMontant.Text == " ")
            {
                MessageBox.Show("Erreur votre champ est vide. " +
                                "Veuillez saisir un montant", "Erreur"
                                , MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                montantFlux = (int)Int32.Parse(txtMontant.Text);
            }

            if (lstAdherent.SelectedIndex == ' ')
            {
                MessageBox.Show("Erreur votre champ est vide. " +
                                "Veuillez selectionner un adherent", "Erreur"
                                , MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                idAdherent = lstAdherent.SelectedIndex;
            }

            if (lstBudget.SelectedIndex == ' ')
            {
                MessageBox.Show("Erreur votre champ est vide. " +
                                "Veuillez selectionner un budget", "Erreur"
                                , MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                idBudget = lstBudget.SelectedIndex;
            }

            Flux unFlux = new Flux(txtLibelle.Text, montantFlux, idAdherent, idTypeFlux, idBudget);

            GestionFlux.AjoutFlux(unFlux);

            Form.ActiveForm.Close();
        }
Пример #12
0
        private void btnModifFlux_Click(object sender, EventArgs e)
        {
            bool errorActive = false;
            int  id          = Flux.FluxSauvegarder.Id;

            // verification des champs du formulaire ajout d'un flux
            if (!GestionFlux.GetRegexString(txtNom.Text, Flux.REGEX_STRING1))
            {
                errorNom.SetError(txtNom, "Nom saisi incorrect, aucun caratères spéciaux et aucun espace, 3 à 20 caractères");
                errorActive = true;
            }
            else
            {
                errorNom.SetError(txtNom, "");
            }

            if (!(numUpMontant.Value >= 1))
            {
                errorMontant.SetError(numUpMontant, "Veuillez saisir un montant valide");
                errorActive = true;
            }
            else
            {
                errorMontant.SetError(numUpMontant, "");
            }

            if (errorActive)
            {
                MessageBox.Show("Error : flux non modifié", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Flux unFlux = new Flux(id, txtNom.Text, dtpDate.Value, numUpMontant.Value, checkPrelevement.Checked,
                                       (Adherent)comboBoxEleve.SelectedItem, Flux.FluxSauvegarder.Budget, (TypeFlux)comboBoxTypeTransac.SelectedItem);


                if (GestionFlux.ModifierFlux(unFlux))
                {
                    MessageBox.Show("Valide : flux modifié", "Valide", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    this.Hide();             // fermeture du formulaire actuel
                    FrmDetailsBudget frmDetailsBudget = new FrmDetailsBudget();
                    frmDetailsBudget.Show(); // ouverture du formulaire
                }
                else
                {
                    MessageBox.Show("Error : error lors de la modification", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #13
0
        public List <Budget> calcBudgetMontant()
        {
            List <Flux>   fluxs   = GestionFlux.GetLesFlux();
            List <Budget> budgets = GestionBudget.GetLesBudget();

            foreach (Budget budget in budgets)
            {
                foreach (Flux flux in fluxs)
                {
                    if (budget.Libelle == flux.Budget.Libelle)
                    {
                        budget.MontantTotal = flux.TypeFlux.Libelle.Trim() == FrmDetailsBudget.Debit
                            ? budget.MontantTotal - flux.Montant
                            : budget.MontantTotal + flux.Montant
                        ;
                    }
                }
            }

            return(budgets);
        }
Пример #14
0
        public void flux(int x, int y)
        {
            List <Flux> fluxs = GestionFlux.GetLesFlux();

            List <string> LesBudgets = new List <string>();

            foreach (Flux flux in fluxs)
            {
                LesBudgets.Add(flux.Budget.Libelle.Trim());
            }

            LesBudgets = (List <string>)LesBudgets.Distinct().ToList();

            Label lblHeadLibelle = new Label();

            lblHeadLibelle.Text      = "Libelle";
            lblHeadLibelle.AutoSize  = true;
            lblHeadLibelle.Location  = new Point(x, y);
            lblHeadLibelle.Dock      = DockStyle.Fill;
            lblHeadLibelle.TextAlign = ContentAlignment.MiddleCenter;

            Label lblHeadAdherent = new Label();

            lblHeadAdherent.Text      = "Adherent";
            lblHeadAdherent.AutoSize  = true;
            lblHeadAdherent.Location  = new Point(x, y);
            lblHeadAdherent.Dock      = DockStyle.Fill;
            lblHeadAdherent.TextAlign = ContentAlignment.MiddleCenter;

            Label lblHeadMontant = new Label();

            lblHeadMontant.Text      = "Montant";
            lblHeadMontant.AutoSize  = true;
            lblHeadMontant.Location  = new Point(x, y);
            lblHeadMontant.Dock      = DockStyle.Fill;
            lblHeadMontant.TextAlign = ContentAlignment.MiddleCenter;

            Label lblHeadPrelevement = new Label();

            lblHeadPrelevement.Text      = "Prelevement";
            lblHeadPrelevement.AutoSize  = true;
            lblHeadPrelevement.Location  = new Point(x, y);
            lblHeadPrelevement.Dock      = DockStyle.Fill;
            lblHeadPrelevement.TextAlign = ContentAlignment.MiddleCenter;

            Label lblHeadTypeFlux = new Label();

            lblHeadTypeFlux.Text      = "Type flux";
            lblHeadTypeFlux.AutoSize  = true;
            lblHeadTypeFlux.Location  = new Point(x, y);
            lblHeadTypeFlux.Dock      = DockStyle.Fill;
            lblHeadTypeFlux.TextAlign = ContentAlignment.MiddleCenter;

            Label lblHeadDate = new Label();

            lblHeadDate.Text      = "Date";
            lblHeadDate.AutoSize  = true;
            lblHeadDate.Location  = new Point(x, y);
            lblHeadDate.Dock      = DockStyle.Fill;
            lblHeadDate.TextAlign = ContentAlignment.MiddleCenter;

            Label btnHeadUpdate = new Label();

            btnHeadUpdate.Text      = "Modifier";
            btnHeadUpdate.AutoSize  = true;
            btnHeadUpdate.Location  = new Point(x, y);
            btnHeadUpdate.Dock      = DockStyle.Fill;
            btnHeadUpdate.TextAlign = ContentAlignment.MiddleCenter;

            Label btnHeadDelete = new Label();

            btnHeadDelete.Text      = "Supprimer";
            btnHeadDelete.AutoSize  = true;
            btnHeadDelete.Location  = new Point(x, y);
            btnHeadDelete.Dock      = DockStyle.Fill;
            btnHeadDelete.TextAlign = ContentAlignment.MiddleCenter;

            this.Controls.Find("pnl2", true)[0].Controls.Add(lblHeadLibelle);
            this.Controls.Find("pnl2", true)[0].Controls.Add(lblHeadAdherent);
            this.Controls.Find("pnl2", true)[0].Controls.Add(lblHeadMontant);
            this.Controls.Find("pnl2", true)[0].Controls.Add(lblHeadTypeFlux);
            this.Controls.Find("pnl2", true)[0].Controls.Add(lblHeadPrelevement);
            this.Controls.Find("pnl2", true)[0].Controls.Add(lblHeadDate);
            this.Controls.Find("pnl2", true)[0].Controls.Add(btnHeadUpdate);
            this.Controls.Find("pnl2", true)[0].Controls.Add(btnHeadDelete);

            foreach (string budget in LesBudgets)
            {
                Label lblBudget = new Label();
                lblBudget.Text      = budget.Trim();
                lblBudget.AutoSize  = true;
                lblBudget.Location  = new Point(x, y);
                lblBudget.Dock      = DockStyle.Fill;
                lblBudget.TextAlign = ContentAlignment.MiddleCenter;
                lblBudget.Margin    = new Padding(5);
                lblBudget.Font      = new Font("Arial", 16, FontStyle.Bold);

                Label lblSpace = new Label();
                lblSpace.Text      = "";
                lblSpace.AutoSize  = true;
                lblSpace.Location  = new Point(x, y);
                lblSpace.Dock      = DockStyle.Fill;
                lblSpace.TextAlign = ContentAlignment.MiddleCenter;

                Label lblSpace2 = new Label();
                lblSpace2.Text      = "";
                lblSpace2.AutoSize  = true;
                lblSpace2.Location  = new Point(x, y);
                lblSpace2.Dock      = DockStyle.Fill;
                lblSpace2.TextAlign = ContentAlignment.MiddleCenter;

                Label lblSpace3 = new Label();
                lblSpace3.Text      = "";
                lblSpace3.AutoSize  = true;
                lblSpace3.Location  = new Point(x, y);
                lblSpace3.Dock      = DockStyle.Fill;
                lblSpace3.TextAlign = ContentAlignment.MiddleCenter;

                Label lblSpace4 = new Label();
                lblSpace4.Text      = "";
                lblSpace4.AutoSize  = true;
                lblSpace4.Location  = new Point(x, y);
                lblSpace4.Dock      = DockStyle.Fill;
                lblSpace4.TextAlign = ContentAlignment.MiddleCenter;

                Label lblSpace5 = new Label();
                lblSpace5.Text      = "";
                lblSpace5.AutoSize  = true;
                lblSpace5.Location  = new Point(x, y);
                lblSpace5.Dock      = DockStyle.Fill;
                lblSpace5.TextAlign = ContentAlignment.MiddleCenter;

                Label lblSpace6 = new Label();
                lblSpace6.Text      = "";
                lblSpace6.AutoSize  = true;
                lblSpace6.Location  = new Point(x, y);
                lblSpace6.Dock      = DockStyle.Fill;
                lblSpace6.TextAlign = ContentAlignment.MiddleCenter;

                Label lblSpace7 = new Label();
                lblSpace7.Text      = "";
                lblSpace7.AutoSize  = true;
                lblSpace7.Location  = new Point(x, y);
                lblSpace7.Dock      = DockStyle.Fill;
                lblSpace7.TextAlign = ContentAlignment.MiddleCenter;

                this.Controls.Find("pnl2", true)[0].Controls.Add(lblBudget);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace2);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace3);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace4);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace5);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace6);
                this.Controls.Find("pnl2", true)[0].Controls.Add(lblSpace7);

                foreach (Flux flux in fluxs)
                {
                    if (budget == flux.Budget.Libelle.Trim())
                    {
                        y += 20;

                        Label lblLibelle = new Label();
                        lblLibelle.Text      = flux.Libelle.Trim();
                        lblLibelle.AutoSize  = true;
                        lblLibelle.Location  = new Point(x, y);
                        lblLibelle.Dock      = DockStyle.Fill;
                        lblLibelle.TextAlign = ContentAlignment.MiddleCenter;

                        Label lblAdherent = new Label();
                        lblAdherent.Text      = flux.Adherent.Nom.Trim();
                        lblAdherent.AutoSize  = true;
                        lblAdherent.Location  = new Point(x, y);
                        lblAdherent.Dock      = DockStyle.Fill;
                        lblAdherent.TextAlign = ContentAlignment.MiddleCenter;

                        Label lblMontant = new Label();
                        lblMontant.Text      = flux.Montant.ToString();
                        lblMontant.AutoSize  = true;
                        lblMontant.Location  = new Point(x, y);
                        lblMontant.Dock      = DockStyle.Fill;
                        lblMontant.TextAlign = ContentAlignment.MiddleCenter;

                        Label lblTypeFlux = new Label();
                        lblTypeFlux.Text      = flux.TypeFlux.Libelle;
                        lblTypeFlux.AutoSize  = true;
                        lblTypeFlux.Location  = new Point(x, y);
                        lblTypeFlux.Dock      = DockStyle.Fill;
                        lblTypeFlux.TextAlign = ContentAlignment.MiddleCenter;

                        string pre = flux.Prelevement == false ? "Non" : "Oui";

                        Label lblPrelevement = new Label();
                        lblPrelevement.Text      = pre;
                        lblPrelevement.AutoSize  = true;
                        lblPrelevement.Location  = new Point(x, y);
                        lblPrelevement.Dock      = DockStyle.Fill;
                        lblPrelevement.TextAlign = ContentAlignment.MiddleCenter;

                        Label lblDate = new Label();
                        lblDate.Text      = flux.Date.ToString();
                        lblDate.AutoSize  = true;
                        lblDate.Location  = new Point(x, y);
                        lblDate.Dock      = DockStyle.Fill;
                        lblDate.TextAlign = ContentAlignment.MiddleCenter;

                        Button btnUpdate = new Button();
                        btnUpdate.Tag       = flux;
                        btnUpdate.Text      = "Modifier";
                        btnUpdate.AutoSize  = true;
                        btnUpdate.Location  = new Point(x, y);
                        btnUpdate.Dock      = DockStyle.Fill;
                        btnUpdate.Click    += new EventHandler(btnUpdate_Click);
                        btnUpdate.TextAlign = ContentAlignment.MiddleCenter;

                        Button btnDelete = new Button();
                        btnDelete.Tag       = flux;
                        btnDelete.Text      = "Supprimer";
                        btnDelete.AutoSize  = true;
                        btnDelete.Location  = new Point(x, y);
                        btnDelete.Dock      = DockStyle.Fill;
                        btnDelete.Click    += new EventHandler(btnDelete_Click);
                        btnDelete.TextAlign = ContentAlignment.MiddleCenter;

                        this.Controls.Find("pnl2", true)[0].Controls.Add(lblLibelle);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(lblAdherent);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(lblMontant);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(lblTypeFlux);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(lblPrelevement);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(lblDate);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(btnUpdate);
                        this.Controls.Find("pnl2", true)[0].Controls.Add(btnDelete);
                    }
                }
            }
        }
Пример #15
0
        public AffichageFlux()
        {
            InitializeComponent();
            // Récupération de chaîne de connexion à la BD à l'ouverture du formulaire
            GestionFlux.SetchaineConnexion(ConfigurationManager.ConnectionStrings["GestionASForm"]);

            // Blocage de la génération automatique des colonnes
            dataGridView1.AutoGenerateColumns = false;

            // Création d'une en-tête de colonne pour la colonne 1
            DataGridViewTextBoxColumn IdColumn = new DataGridViewTextBoxColumn();

            IdColumn.DataPropertyName = "Id_flux";
            IdColumn.HeaderText       = "Identifiant";

            // Création d'une en-tête de colonne pour la colonne 2
            DataGridViewTextBoxColumn LibelleColumn = new DataGridViewTextBoxColumn();

            LibelleColumn.DataPropertyName = "Libelle_flux";
            LibelleColumn.HeaderText       = "Libelle du flux";

            // Création d'une en-tête de colonne pour la colonne 3
            DataGridViewTextBoxColumn DateColumn = new DataGridViewTextBoxColumn();

            DateColumn.DataPropertyName = "Date_flux";
            DateColumn.HeaderText       = "Date";

            // Création d'une en-tête de colonne pour la colonne 4
            DataGridViewTextBoxColumn MontantColumn = new DataGridViewTextBoxColumn();

            MontantColumn.DataPropertyName = "Montant_flux";
            MontantColumn.HeaderText       = "Montant du flux";

            // Création d'une en-tête de colonne pour la colonne 5
            DataGridViewTextBoxColumn IdAdherentColumn = new DataGridViewTextBoxColumn();

            IdAdherentColumn.DataPropertyName = "Adherent";
            IdAdherentColumn.HeaderText       = "Nom adherent";

            // Création d'une en-tête de colonne pour la colonne 6
            DataGridViewTextBoxColumn IdTypeFluxColumn = new DataGridViewTextBoxColumn();

            IdTypeFluxColumn.DataPropertyName = "TypeFlux";
            IdTypeFluxColumn.HeaderText       = "Type de flux";

            // Création d'une en-tête de colonne pour la colonne 7
            DataGridViewTextBoxColumn IdBudgetColumn = new DataGridViewTextBoxColumn();

            IdBudgetColumn.DataPropertyName = "Budget";
            IdBudgetColumn.HeaderText       = "Budget";

            // Création d'une en-tête de colonne pour la colonne 8
            DataGridViewTextBoxColumn EtatPrelevement = new DataGridViewTextBoxColumn();

            EtatPrelevement.DataPropertyName = "Etat_prelevement";
            EtatPrelevement.HeaderText       = "Etat du prélevement";

            // Création d'une en-tête de colonne pour la colonne 9
            DataGridViewTextBoxColumn Id_Adherent = new DataGridViewTextBoxColumn();

            Id_Adherent.DataPropertyName = "Id_adherent";
            Id_Adherent.HeaderText       = "Id de l'adherent";

            // Création d'une en-tête de colonne pour la colonne 10
            DataGridViewTextBoxColumn Id_budget = new DataGridViewTextBoxColumn();

            Id_budget.DataPropertyName = "Id_budget";
            Id_budget.HeaderText       = "Id du budget";

            // Création d'une en-tête de colonne pour la colonne 11
            DataGridViewTextBoxColumn Id_typeFlux = new DataGridViewTextBoxColumn();

            Id_typeFlux.DataPropertyName = "Id_typeflux";
            Id_typeFlux.HeaderText       = "Id du type de flux";

            // Ajout des 2 en-têtes de colonne au datagridview
            dataGridView1.Columns.Add(IdColumn);
            dataGridView1.Columns.Add(LibelleColumn);
            dataGridView1.Columns.Add(DateColumn);
            dataGridView1.Columns.Add(MontantColumn);
            dataGridView1.Columns.Add(IdAdherentColumn);
            dataGridView1.Columns.Add(IdTypeFluxColumn);
            dataGridView1.Columns.Add(IdBudgetColumn);
            dataGridView1.Columns.Add(EtatPrelevement);
            dataGridView1.Columns.Add(Id_Adherent);
            dataGridView1.Columns.Add(Id_budget);
            dataGridView1.Columns.Add(Id_typeFlux);

            // Définition du style apporté au datagridview
            dataGridView1.ColumnHeadersVisible = true;
            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

            columnHeaderStyle.BackColor = Color.Beige;
            columnHeaderStyle.Font      = new Font("Verdana", 10, FontStyle.Bold);

            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

            List <Flux> liste = new List <Flux>();

            liste = GestionASDAL.FluxDAO.GetAfficheFlux();

            // Rattachement de la List à la source de données du datagridview
            dataGridView1.DataSource = liste;
        }
Пример #16
0
 public List <Flux> afficheFlux(Adherent adherent)
 {
     return(GestionFlux.GetLesFluxById(adherent.Id));;
 }