Example #1
0
        /// <summary>
        /// Accept or discard current value of cell editor control
        /// </summary>
        /// <param name="AcceptChanges">Use the _editingControl's Text as new SubItem text or discard changes?</param>
        public void EndEditing(bool AcceptChanges)
        {
            if (_editingControl == null)
            {
                return;
            }

            SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs(
                _editItem,                             // The item being edited
                _editSubItem,                          // The subitem index being edited
                AcceptChanges ?
                _editingControl.Text :                 // Use editControl text if changes are accepted
                _editItem.SubItems[_editSubItem].Text, // or the original subitem's text, if changes are discarded
                !AcceptChanges                         // Cancel?
                );

            OnSubItemEndEditing(e);

            _editItem.SubItems[_editSubItem].Text = e.DisplayText;
            _editingControl.Leave    -= new EventHandler(_editControl_Leave);
            _editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);

            _editingControl.Visible = false;

            _editingControl = null;
            _editItem       = null;
            _editSubItem    = -1;
        }
Example #2
0
 protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e)
 {
     if (SubItemEndEditing != null)
     {
         SubItemEndEditing(this, e);
     }
 }
Example #3
0
        private void lvContracts_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
        {
            if (idxAmount == e.SubItem)
            {
                OCurrency temp;
                try
                {
                    temp = decimal.Parse(e.DisplayText);
                }
                catch
                {
                    temp = (OCurrency)e.Item.SubItems[e.SubItem].Tag;
                }
                temp = temp < ((ISavingsContract)e.Item.Tag).Product.DepositMin ? ((ISavingsContract)e.Item.Tag).Product.DepositMin : temp;
                temp = temp > ((ISavingsContract)e.Item.Tag).Product.DepositMax ? ((ISavingsContract)e.Item.Tag).Product.DepositMax : temp;

                e.DisplayText = temp.GetFormatedValue(((ISavingsContract)e.Item.Tag).Product.Currency.UseCents);
                e.Item.SubItems[e.SubItem].Tag = temp;
            }
            UpdateTotal();
        }
        private void lvMembers_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
        {
            switch (e.SubItem)
            {
                case IdxAmount: // Amount

                    OCurrency temp;
                    try
                    {
                        temp = decimal.Parse(e.DisplayText);
                    }
                    catch
                    {
                        temp = (OCurrency)e.Item.SubItems[e.SubItem].Tag;
                    }

                    if (_product.CycleId != null)
                    {
                        LoanProduct product = ((VillageMember) e.Item.Tag).Product;
                        temp = temp < product.AmountMin ? product.AmountMin : temp;
                        temp = temp > product.AmountMax ? product.AmountMax : temp;
                    }
                    else
                    {
                        temp = temp < _product.AmountMin ? _product.AmountMin : temp;
                        temp = temp > _product.AmountMax ? _product.AmountMax : temp;
                    }
                    e.DisplayText = temp.GetFormatedValue(_product.Currency.UseCents);
                    e.Item.SubItems[e.SubItem].Tag = temp;
                    e.Item.SubItems[e.SubItem].Text = e.DisplayText;
                    _accumulatedAmount = _fLServices.CheckIfAmountIsEnough(e.Item.SubItems[IdxFundingLine].Tag as FundingLine, temp.Value);
                    e.Item.SubItems[IdxRemainingFlMoney].Text = _accumulatedAmount.ToString();

                    if (_accumulatedAmount <= 0)
                    {
                        lvMembers.Items[e.Item.Index].BackColor = Color.Red;
                    }
                    else
                    {
                        lvMembers.Items[e.Item.Index].BackColor = Color.Transparent;
                    }
                    UpdateTotal();
                    break;

                case IdxInterest: // Interest
                    decimal i;
                    try
                    {
                        i = decimal.Parse(e.DisplayText);
                        i = i / 100;
                    }
                    catch
                    {
                        i = (decimal)e.Item.SubItems[e.SubItem].Tag;
                    }
                    if (_product.CycleId == null)
                    {
                        i = i < _product.InterestRateMin.Value ? _product.InterestRateMin.Value : i;
                        i = i > _product.InterestRateMax.Value ? _product.InterestRateMax.Value : i;
                    }
                    else
                    {
                        i = i < ((VillageMember) e.Item.Tag).Product.InterestRateMin.Value
                                ? ((VillageMember) e.Item.Tag).Product.InterestRateMin.Value
                                : i;
                        i = i > ((VillageMember)e.Item.Tag).Product.InterestRateMax.Value
                                ? ((VillageMember)e.Item.Tag).Product.InterestRateMax.Value
                                : i;

                    }

                    e.DisplayText = Math.Round(i * 100, decimalPlaces).ToString();
                    e.Item.SubItems[e.SubItem].Tag = i;
                    break;

                case IdxGracePeriod: // Grace period
                    e.Item.SubItems[e.SubItem].Tag = int.Parse(e.DisplayText);
                    break;

                case IdxInstallments: // Number of installments
                    int? temp1;
                    try
                    {
                        temp1 = int.Parse(e.DisplayText);
                    }
                    catch
                    {
                        temp1 = (int)e.Item.SubItems[e.SubItem].Tag;
                    }

                    if (_product.CycleId != null)
                    {
                        LoanProduct product = ((VillageMember)e.Item.Tag).Product;
                        temp1 = temp1 < product.NbOfInstallmentsMin ? product.NbOfInstallmentsMin : temp1;
                        temp1 = temp1 > product.NbOfInstallmentsMax ? product.NbOfInstallmentsMax : temp1;
                    }
                    else
                    {
                        temp1 = temp1 < _product.NbOfInstallmentsMin ? _product.NbOfInstallmentsMin : temp1;
                        temp1 = temp1 > _product.NbOfInstallmentsMax ? _product.NbOfInstallmentsMax : temp1;
                    }
                    e.DisplayText = temp1.ToString();
                    e.Item.SubItems[e.SubItem].Tag = temp1;
                    break;

                case IdxLoanOfficer: // Loan officer
                    e.Item.SubItems[e.SubItem].Tag = cbLoanOfficer.SelectedItem;
                    break;

                case IdxFundingLine: //Funding line
                    FundingLine fl = (FundingLine)cbFundingLine.SelectedItem;
                    if (fl != (e.Item.SubItems[e.SubItem].Tag as FundingLine))
                    {
                        e.Item.SubItems[e.SubItem].Tag = cbFundingLine.SelectedItem;

                        _accumulatedAmount = _fLServices.CheckIfAmountIsEnough(fl, decimal.Parse(e.Item.SubItems[2].Text));
                        e.Item.SubItems[IdxRemainingFlMoney].Text = _accumulatedAmount.ToString();

                        if (_accumulatedAmount <= 0)
                        {
                            lvMembers.Items[e.Item.Index].BackColor = Color.Red;
                        }
                        else
                        {
                            lvMembers.Items[e.Item.Index].BackColor = Color.Transparent;
                        }
                    }
                    break;

                case IdxCreationDate:
                    e.Item.SubItems[e.SubItem].Tag = _CreditCommitteeDate;
                    break;

                case IdxCompulsorySavings: // Compulsory savings
                    if (_product.UseCompulsorySavings)
                        e.Item.SubItems[e.SubItem].Tag = cbCompulsorySavings.SelectedItem;
                    break;

                case IdxCompulsoryPercentage: // Compulsory percentage
                    if (_product.UseCompulsorySavings)
                        e.Item.SubItems[e.SubItem].Tag = int.Parse(e.DisplayText);
                    break;
                /*
                case IdxPaymentMethod:
                        e.Item.SubItems[e.SubItem].Tag = cbPaymentMethods.SelectedItem;
                    break;
                    */
                default:
                    break;
            }
        }
Example #5
0
 private void lvEntryFees_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
 {
     _credit.LoanEntryFeesList.Clear();
     OCurrency loanAmount = nudLoanAmount.Value;
     OCurrency inputFee = decimal.Parse(numEntryFees.Value.ToString());
     foreach (ListViewItem item in lvEntryFees.Items)
     {
         if (item.Tag is LoanEntryFee)
         {
             _credit.LoanEntryFeesList.Add((LoanEntryFee)item.Tag);
             if (e.Item.Index == item.Index)
             {
                 ((LoanEntryFee)item.Tag).FeeValue = inputFee.Value;
                 if (((LoanEntryFee)item.Tag).ProductEntryFee.IsRate)
                 {
                     OCurrency feeAmount = loanAmount * inputFee / 100;
                     item.SubItems[3].Text = feeAmount.GetFormatedValue(_credit.Product.Currency.UseCents);
                 }
                 else
                 {
                     OCurrency feeAmount = inputFee;
                     item.SubItems[3].Text = feeAmount.GetFormatedValue(_credit.Product.Currency.UseCents);
                 }
             }
         }
         else if (item.Tag.Equals("TotalFees"))
         {
             ShowTotalFeesInListView(item);
         }
     }
 }
        private void lvMembers_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
        {
            var subItems = e.Item.SubItems;
            switch (e.SubItem)
            {
                case IdxStatus:
                    var items = cbStatus.Items;
                    if (cbStatus.SelectedItem == items[0])
                        subItems[IdxStatus].Tag = OContractStatus.Pending;
                    if (cbStatus.SelectedItem == items[1])
                        subItems[IdxStatus].Tag = OContractStatus.Postponed;
                    if (cbStatus.SelectedItem == items[2])
                        subItems[IdxStatus].Tag = OContractStatus.Validated;
                    if (cbStatus.SelectedItem == items[3])
                        subItems[IdxStatus].Tag = OContractStatus.Refused;
                    if (cbStatus.SelectedItem == items[4])
                        subItems[IdxStatus].Tag = OContractStatus.Abandoned;
                    break;

                case IdxCreditCommitteeDate:
                    subItems[e.SubItem].Tag = _CreditCommitteeDate;
                    break;

                case IdxValidationCode:
                    subItems[e.SubItem].Text = tbValidationCode.Text;
                    break;

                case IdxComment:
                    subItems[e.SubItem].Text = tbComment.SelectedText;
                    break;

                default:
                    break;
            }
        }
Example #7
0
        private void lvEntryFees_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
        {
            buttonSave.Enabled = true;
            var subItems = e.Item.SubItems;
            switch (e.SubItem)
            {
                case IdxNameOfFee:
                    subItems[e.SubItem].Text = tbEntryFeesValues.Text;
                    break;

                case IdxMin:
                    subItems[e.SubItem].Text = tbEntryFeesValues.Text;
                    break;

                case IdxMax:
                    subItems[e.SubItem].Text = tbEntryFeesValues.Text;
                    break;

                case IdxValue:
                    subItems[e.SubItem].Text = tbEntryFeesValues.Text;
                    break;

                case IdxIsRate:
                    subItems[e.SubItem].Text = cbRate.Text;
                    break;
            }

            _idForNewEntryFee++;

            e.Item.SubItems[IdxIdForNewItem].Text = _idForNewEntryFee.ToString();
            e.Item.SubItems[IdxIsAdded].Text = @"true";
            e.Item.SubItems[IdxCycleId].Text = cbEnableEntryFeesCycle.Checked ? cmbEntryFeesCycles.SelectedItem.ToString() : "";

            if (Convert.ToInt32(e.Item.SubItems[IdxIndex].Text) == lvEntryFees.Items.Count - 1 && e.SubItem != IdxIsRate && !string.IsNullOrEmpty(subItems[e.SubItem].Text))
            {
                if (string.IsNullOrEmpty(e.Item.SubItems[IdxIsRate].Text))
                    e.Item.SubItems[IdxIsRate].Text = @"True";
                InitializeAdditionalEmptyRowInListView();
            }
        }
Example #8
0
        private void lvMembers_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
        {
            if (e.SubItem == idxInitialAmount) // Initial Amount
            {
                OCurrency temp;
                try
                {
                    temp = decimal.Parse(e.DisplayText);
                }
                catch
                {
                    temp = (OCurrency) e.Item.SubItems[e.SubItem].Tag;
                }
                temp = temp < _product.InitialAmountMin ? _product.InitialAmountMin : temp;
                temp = temp > _product.InitialAmountMax ? _product.InitialAmountMax : temp;
                e.DisplayText = temp.GetFormatedValue(_product.Currency.UseCents);
                e.Item.SubItems[e.SubItem].Tag = temp;
            }
            else if (e.SubItem == idxInterestRate) // Interest Rate
                e.Item.SubItems[e.SubItem].Tag = double.Parse(e.DisplayText);
            else if (e.SubItem == idxEntryFees) // Entry Fees
                e.Item.SubItems[e.SubItem].Tag = new OCurrency(decimal.Parse(e.DisplayText));
            else if (e.SubItem == idxWithdrawFees && _product is SavingsBookProduct) // Withdraw Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxTransferFees && _product is SavingsBookProduct) // Transfer Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (idxIbtFees == e.SubItem && _product is SavingsBookProduct)
            {
                e.Item.SubItems[e.SubItem].Tag = Convert.ToDecimal(e.DisplayText);
            }
            else if (e.SubItem == idxDepositFees && _product is SavingsBookProduct) // Deposit Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxChequeDepositFees && _product is SavingsBookProduct) // Cheque Deposit Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxCloseFees && _product is SavingsBookProduct) // Close Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxManagementFees && _product is SavingsBookProduct) // Management Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxOverdraftFees && _product is SavingsBookProduct) // Overdraft Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxAgioFees && _product is SavingsBookProduct) // Agio Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);
            else if (e.SubItem == idxReopenFees && _product is SavingsBookProduct) // Reopen Fees
                e.Item.SubItems[e.SubItem].Tag = decimal.Parse(e.DisplayText);

            if (e.SubItem == idxInitialAmount) UpdateTotal();
        }
 private void lvMembers_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
 {
     if (e.SubItem == IdxPaymentMethod)
         e.Item.SubItems[e.SubItem].Tag = cbPaymentMethods.SelectedItem;
 }
Example #10
0
 protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e)
 {
     if (SubItemEndEditing != null)
         SubItemEndEditing(this, e);
 }
Example #11
0
        /// <summary>
        /// Accept or discard current value of cell editor control
        /// </summary>
        /// <param name="AcceptChanges">Use the _editingControl's Text as new SubItem text or discard changes?</param>
        public void EndEditing(bool AcceptChanges)
        {
            if (_editingControl == null)
                return;

            SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs(
                _editItem,		// The item being edited
                _editSubItem,	// The subitem index being edited
                AcceptChanges ?
                    _editingControl.Text :	// Use editControl text if changes are accepted
                    _editItem.SubItems[_editSubItem].Text,	// or the original subitem's text, if changes are discarded
                !AcceptChanges	// Cancel?
            );

            OnSubItemEndEditing(e);

            _editItem.SubItems[_editSubItem].Text = e.DisplayText;
            _editingControl.Leave -= new EventHandler(_editControl_Leave);
            _editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);

            _editingControl.Visible = false;

            _editingControl = null;
            _editItem = null;
            _editSubItem = -1;
        }