コード例 #1
0
ファイル: MainFormRub.cs プロジェクト: ccharlier/orionbanque
        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
ファイル: MainFormRub.cs プロジェクト: ccharlier/orionbanque
        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
ファイル: MainFormRub.cs プロジェクト: ccharlier/orionbanque
        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;
            }
        }
コード例 #4
0
ファイル: MainFormRub.cs プロジェクト: ccharlier/orionbanque
        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));
        }
コード例 #5
0
ファイル: MainFormRub.cs プロジェクト: ccharlier/orionbanque
 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);
 }