Exemple #1
0
        private void buttonViewCollateral_Click(object sender, EventArgs e)
        {
            if (listViewCollaterals.SelectedItems.Count != 0)
            {
                try
                {
                    ContractCollateral contractCollateral = (ContractCollateral)listViewCollaterals.SelectedItems[0].Tag;
                    CollateralProduct collateralProduct = ServicesProvider.GetInstance().GetCollateralProductServices().
                        SelectCollateralProductByPropertyId(contractCollateral.PropertyValues[0].Property.Id);
                    CollateralProduct product = ServicesProvider.GetInstance().GetCollateralProductServices().SelectCollateralProduct(collateralProduct.Id);

                    ContractCollateralForm collateralForm = new ContractCollateralForm(product, contractCollateral, true);
                    collateralForm.ShowDialog();
                }
                catch (NullReferenceException)
                {
                    MessageBox.Show(@"Please select proper item from the collateral list!");
                }
            }
        }
Exemple #2
0
        private void menuCollateralProductsItem_Click(object sender, EventArgs e)
        {
            var productId = (int)((ToolStripMenuItem)sender).Tag;
            CollateralProduct product = ServicesProvider.GetInstance().GetCollateralProductServices().SelectCollateralProduct(productId);

            ContractCollateralForm collateralForm = new ContractCollateralForm(product);
            collateralForm.ShowDialog();

            if (collateralForm.ContractCollateral != null && collateralForm.ContractCollateral.PropertyValues != null)
            {
                _collaterals.Add(collateralForm.ContractCollateral);
                _credit.Collaterals = _collaterals;
                DisplayCollateral();
                SaveContract();
            }
        }
        private void buttonModifyCollateral_Click(object sender, EventArgs e)
        {
            if (listViewCollaterals.SelectedItems.Count != 0)
            {
                try
                {
                    ContractCollateral contractCollateral = (ContractCollateral)listViewCollaterals.SelectedItems[0].Tag;
                    CollateralProduct collateralProduct = ServicesProvider.GetInstance().GetCollateralProductServices().
                        SelectCollateralProductByPropertyId(contractCollateral.PropertyValues[0].Property.Id);
                    CollateralProduct product = ServicesProvider.GetInstance().GetCollateralProductServices().SelectCollateralProduct(collateralProduct.Id);

                    ContractCollateralForm collateralForm = new ContractCollateralForm(product, contractCollateral, false, _extensionActivator);
                    collateralForm.ShowDialog();

                    if (collateralForm.ContractCollateral != null)
                    {
                        listViewCollaterals.SelectedItems[0].Tag = collateralForm.ContractCollateral;
                        _credit.Collaterals = _collaterals;
                        DisplayCollateral();
                        SaveContract();
                    }
                }
                catch (NullReferenceException)
                {
                    MessageBox.Show("Please select proper item from the collateral list!");
                }
            }
        }