Пример #1
0
        private void KRBtnOperationPointe_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dgvOperations.SelectedRows)
            {
                Operation otemp = Operation.Charge((int)row.Cells["Id"].Value);
                if (otemp.DatePointage is null)
                {
                    otemp.DatePointage = DateTime.Now;
                    Operation.Maj(otemp);
                    row.Cells["DatePointage"].Value = DateTime.Now;

                    //Contrôle si Operation Liee est un transfert
                    if (otemp.TypeLien == KEY.TYPELIENOPERATIONTRANSFERT)
                    {
                        Operation OpeLiee = Operation.Charge(otemp.IdOperationLiee);
                        if (MessageBox.Show("Souhaitez-vous également pointer l'opération liée réglée par " + OpeLiee.ModePaiement.Libelle + " le " + OpeLiee.Date.ToShortDateString() + " du compte " + OpeLiee.Compte.Libelle + " ?", "Confirmation", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            OpeLiee.DatePointage = DateTime.Now;
                            Operation.Maj(OpeLiee);
                        }
                    }
                }
            }
            if (dgvOperations.SelectedRows.Count != 0)
            {
                ChargesIndicateurs(GetCompteCourant());
                ActiveSauvegarde();
            }
        }
Пример #2
0
        private void SupprimerOperation()
        {
            if (dgvOperations.SelectedRows.Count > 0)
            {
                string text = dgvOperations.SelectedRows.Count == 1 ? KEY.ALERTESUPPRESSIONOPERATION : KEY.ALERTESUPPRESSIONOPERATIONS;
                if (MessageBox.Show(text, "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in dgvOperations.SelectedRows)
                    {
                        Operation OpeASup = Operation.Charge((int)row.Cells["Id"].Value);

                        //Contrôle si Operation Liee est un transfert
                        if (OpeASup.TypeLien == KEY.TYPELIENOPERATIONTRANSFERT)
                        {
                            Operation OpeLiee = Operation.Charge(OpeASup.IdOperationLiee);
                            if (MessageBox.Show("Souhaitez-vous également supprimer l'opération liée réglée par " + OpeLiee.ModePaiement.Libelle + " le " + OpeLiee.Date.ToShortDateString() + " du compte " + OpeLiee.Compte.Libelle + " ?", "Confirmation", MessageBoxButtons.OKCancel) == DialogResult.OK)
                            {
                                Operation.Delete(OpeLiee);
                            }
                        }
                        Operation.Delete(OpeASup);
                        dgvOperations.Rows.RemoveAt(row.Index);
                    }
                    ChargesIndicateurs(GetCompteCourant());
                    ActiveSauvegarde();
                }
            }
        }
Пример #3
0
        private void BtnOperationValide_Click(object sender, EventArgs e)
        {
            Operation o = CreateOperation(GetCompteCourant());

            ChargesIndicateurs(GetCompteCourant());
            ChargeOperations(GetCompteCourant());
            SelectRowOperation(o.Id);
            ActiveSauvegarde();
            ActiveControl = txtOperationDate;
        }
Пример #4
0
        private void BtnOperationValide_MouseDown(object sender, MouseEventArgs e)
        {
            Operation o = e.Button == MouseButtons.Right ? ModifieOperation(GetCompteCourant()) : CreateOperation(GetCompteCourant());

            ChargesIndicateurs(GetCompteCourant());
            ChargeOperations(GetCompteCourant());
            SelectRowOperation(o.Id);
            ActiveSauvegarde();
            ActiveControl = txtOperationDate;
        }
Пример #5
0
        private void DgvOperations_SelectionChanged(object sender, EventArgs e)
        {
            if (dgvOperations.SelectedRows.Count != 0)
            {
                Operation o = Operation.Charge(int.Parse(dgvOperations.SelectedRows[0].Cells[0].Value.ToString(), System.Globalization.CultureInfo.CurrentCulture));

                txtOperationDate.Value = o.Date;
                txtOperationCategorie.SelectedValue = o.Categorie.Id;
                txtOperationLibelle.Text            = o.Libelle;
                txtOperationTiers.Text = o.Tiers;
                txtOperationModePaiement.SelectedValue = o.ModePaiement.Id;
                txtOperationMontant.Value    = new decimal(o.Montant);
                txtOperationPointage.Checked = o.DatePointage == null ? false : true;
            }
        }
Пример #6
0
 private void OuvreFormOperation(Operation o, string mode)
 {
     if (TestPasDeCompte())
     {
         OperationForm om = new OperationForm(o, GetCompteCourant(), mode);
         om.ShowDialog();
         if (om.Cont)
         {
             ChargeOperations(GetCompteCourant());
             ChargesIndicateurs(GetCompteCourant());
             ActiveSauvegarde();
         }
         RemplisCb();
     }
 }
Пример #7
0
        private Operation CreateOperation(Compte c)
        {
            Operation o = new Operation
            {
                Compte       = c,
                Date         = txtOperationDate.Value,
                Categorie    = Categorie.Charge((int)txtOperationCategorie.SelectedValue),
                Libelle      = txtOperationLibelle.Text,
                Tiers        = txtOperationTiers.Text,
                ModePaiement = ModePaiement.Charge((int)txtOperationModePaiement.SelectedValue),
                Montant      = double.Parse(txtOperationMontant.Value.ToString(System.Globalization.CultureInfo.CurrentCulture), System.Globalization.CultureInfo.CurrentCulture),
                DatePointage = txtOperationPointage.Checked ? (DateTime?)DateTime.Now : null
            };

            return(Operation.Sauve(o));
        }
Пример #8
0
 private void LanceFiltreOperation()
 {
     if (txtFiltreModePaiement.SelectedValue != null)
     {
         DataSet ds = Operation
                      .ChargeGrilleOperationFiltre(GetCompteCourant(),
                                                   kFiltreDate.Checked, cbFiltreDate.SelectedItem.ToString(), txtFiltreDate.Value,
                                                   kFiltreModePaiement.Checked, ModePaiement.Charge((int)txtFiltreModePaiement.SelectedValue),
                                                   kFiltreTiers.Checked, txtFiltreTiers.Text,
                                                   kFiltreCategorie.Checked, Categorie.Charge((int)txtFiltreCategorie.SelectedValue),
                                                   kFiltreMontant.Checked, cbFiltreMontant.SelectedItem.ToString(), double.Parse(txtFiltreMontant.Value.ToString(System.Globalization.CultureInfo.CurrentCulture), System.Globalization.CultureInfo.CurrentCulture),
                                                   txtFiltrePointe.Checked);
         dgvOperations.DataSource = ds;
         dgvOperations.DataMember = "Operations";
         dgvOperations.Sort(dgvOperations.Columns["ordre"], System.ComponentModel.ListSortDirection.Descending);
     }
 }
Пример #9
0
        private void TxtFiltreMontant_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar.Equals('.') || e.KeyChar.Equals(','))
            {
                e.KeyChar = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator.ToCharArray()[0];
            }

            if (e.KeyChar == Convert.ToChar(Keys.Return, System.Globalization.CultureInfo.CurrentCulture) && ((KryptonNumericUpDown)sender).Name == "txtOperationMontant")
            {
                Compte    c = GetCompteCourant();
                Operation o = CreateOperation(c);
                ChargesIndicateurs(c);
                ChargeOperations(c);
                SelectRowOperation(o.Id);
                kRQATBSave.Enabled = true;
                ActiveControl      = txtOperationDate;
            }
        }
Пример #10
0
        private void ChargeGraph(Compte c)
        {
            int             i    = 0;
            DateTime        dMin = txtEvolSoldeMin.Value;
            List <double>   ld   = new List <double>();
            List <DateTime> ldt  = new List <DateTime>();

            graph.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
            graph.Series[0].Points.Clear();
            do
            {
                ldt.Add(dMin);
                ld.Add(Operation.SoldeCompteAt(dMin, c) + c.SoldeInitial);
                dMin = dMin.AddDays(1.0);
            }while (dMin <= txtEvolSoldMax.Value);

            foreach (DateTime xdt in ldt)
            {
                graph.Series[0].Points.AddXY(xdt.ToOADate(), ld[i]);
                i++;
            }
        }
Пример #11
0
        private Operation ModifieOperation(Compte c)
        {
            Operation o = Operation.Charge(int.Parse(dgvOperations.SelectedRows[0].Cells[0].Value.ToString(), System.Globalization.CultureInfo.CurrentCulture));

            o.Compte       = c;
            o.Date         = txtOperationDate.Value;
            o.Categorie    = Categorie.Charge((int)txtOperationCategorie.SelectedValue);
            o.Libelle      = txtOperationLibelle.Text;
            o.Tiers        = txtOperationTiers.Text;
            o.ModePaiement = ModePaiement.Charge((int)txtOperationModePaiement.SelectedValue);
            o.Montant      = double.Parse(txtOperationMontant.Value.ToString(System.Globalization.CultureInfo.CurrentCulture), System.Globalization.CultureInfo.CurrentCulture);
            if (txtOperationPointage.Checked)
            {
                if (o.DatePointage is null)
                {
                    o.DatePointage = DateTime.Now;
                }
            }
            else
            {
                o.DatePointage = null;
            }
            return(Operation.Maj(o));
        }
Пример #12
0
 private void ChargeOperations(Compte c)
 {
     kFiltreDate.Checked                 = false;
     kFiltreModePaiement.Checked         = false;
     kFiltreTiers.Checked                = false;
     kFiltreCategorie.Checked            = false;
     kFiltreMontant.Checked              = false;
     txtFiltrePointe.Checked             = false;
     dgvOperations.DataSource            = Operation.ChargeGrilleOperation(c);
     dgvOperations.DataMember            = "Operations";
     dgvOperations.Columns["Id"].Visible = false;
     dgvOperations.Columns["ModePaiementType"].Visible = false;
     dgvOperations.Columns["Montant Débit"].DefaultCellStyle.Format     = "c";
     dgvOperations.Columns["Montant Débit"].DefaultCellStyle.ForeColor  = Color.Red;
     dgvOperations.Columns["Montant Débit"].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleRight;
     dgvOperations.Columns["Montant Crédit"].DefaultCellStyle.Format    = "c";
     dgvOperations.Columns["Montant Crédit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
     dgvOperations.Columns["DatePointage"].DefaultCellStyle.Format      = "d";
     dgvOperations.Columns["DatePointage"].DefaultCellStyle.Alignment   = DataGridViewContentAlignment.MiddleCenter;
     dgvOperations.Columns["Date"].DefaultCellStyle.Alignment           = DataGridViewContentAlignment.MiddleCenter;
     dgvOperations.Columns["Solde"].DefaultCellStyle.Alignment          = DataGridViewContentAlignment.MiddleRight;
     dgvOperations.Sort(dgvOperations.Columns["ordre"], System.ComponentModel.ListSortDirection.Descending);
     dgvOperations.Columns["ordre"].Visible = false;
 }
Пример #13
0
 private void ModifierToolStripMenuItem2_Click(object sender, EventArgs e)
 {
     OuvreFormOperation(Operation.Charge(int.Parse(dgvOperations.SelectedRows[0].Cells[0].Value.ToString(), System.Globalization.CultureInfo.CurrentCulture)), KEY.MODEUPDATE);
 }