Esempio n. 1
0
        public void Init(IClient client, Loan loan, Guarantee guarantee, SavingBookContract savings, IList<IPrintButtonContextMenuStrip> printMenus)
        {
            _printButton.AttachmentPoint = AttachmentPoint.CreditCommittee;
            Visibility visibility;
            switch (client.Type)
            {
                case OClientTypes.Person:
                    visibility = Visibility.Individual;
                    break;

                case OClientTypes.Group:
                    visibility = Visibility.Group;
                    break;

                case OClientTypes.Corporate:
                    visibility = Visibility.Corporate;
                    break;

                default:
                    visibility = Visibility.All;
                    break;
            }
            _printButton.Visibility = visibility;

            _printButton.ReportInitializer =
                report =>
                {
                    report.SetParamValue("user_id", User.CurrentUser.Id);
                    if (loan != null) report.SetParamValue("contract_id", loan.Id);
                };
            _printButton.LoadReports();

            foreach (var item in printMenus)
            {
                var menuItems = item.GetContextMenuStrip(client, loan, guarantee, savings, AttachmentPoint.CreditCommittee.ToString());
                if (menuItems == null) continue;

                foreach (var menuItem in menuItems)
                {
                    _printButton.Menu.Items.Add(menuItem);
                }
            }
        }
Esempio n. 2
0
        private void ViewContract()
        {
            try
            {
                if (lvContracts.SelectedItems.Count == 0) return;

                if (lvContracts.SelectedItems[0].Tag is Loan)
                {
                    Loan loan = lvContracts.SelectedItems[0].Tag as Loan;

                    if (loan != null)
                    {
                        if (!loan.IsViewableBy(User.CurrentUser))
                        {
                            Fail("cannotView");
                            return;
                        }
                    }
                    if (loan.Product.CycleId != null)
                    {
                        ServicesProvider.GetInstance().GetProductServices().SetCyclesParamsForContract(loan.Product,
                                                                                                       loan, _client,
                                                                                                       false);
                    }

                    tabControlPerson.TabPages.Remove(tabPageLoansDetails);
                    tabControlPerson.TabPages.Remove(tabPageAdvancedSettings);
                    tabControlPerson.TabPages.Remove(tabPageLoanRepayment);
                    tabControlPerson.TabPages.Remove(tabPageLoanGuarantees);
                    tabControlPerson.TabPages.Remove(tabPageCreditCommitee);
                    tabControlPerson.TabPages.Remove(tabPageSavingDetails);

                    if (lvContracts.FocusedItem.Text == @"C")
                    {
                        _guarantee = null;
                        _credit = (Loan)lvContracts.SelectedItems[0].Tag;
                        _loanShares = _credit.LoanShares;

                        InitializeTabPageLoansDetails(_credit);
                        InitializeTabPageAdvancedSettings();

                        tabControlPerson.TabPages.Add(tabPageLoansDetails);
                        tabControlPerson.TabPages.Add(tabPageAdvancedSettings);
                        tabControlPerson.TabPages.Add(tabPageCreditCommitee);
                        tabControlPerson.TabPages.Add(tabPageLoanGuarantees);

                        if (_credit.Disbursed)
                        {
                            InitializeTabPageLoanRepayment(_credit);
                            tabControlPerson.TabPages.Add(tabPageLoanRepayment);
                            tabControlPerson.SelectedTab = tabPageLoanRepayment;
                        }
                        else
                        {
                            tabControlPerson.SelectedTab = tabPageCreditCommitee;
                        }
                        LoadLoanDetailsExtensions();
                        LoadLoanDetailsButtons();
                    }
                    if (lvContracts.FocusedItem.Text == @"G")
                    {
                        _credit = null;
                        _guarantee = (Guarantee)lvContracts.SelectedItems[0].Tag;
                        tabControlPerson.TabPages.Add(tabPageCreditCommitee);
                        tabControlPerson.SelectedTab = tabPageCreditCommitee;
                    }

                    //InitializeCustomizableFields(OCustomizableFieldEntities.Loan, loan.Id,
                    //                             loan.ContractStatus == OContractStatus.Active);
                    if (null == _product) return;
                    SetGuarantorsEnabled(_product.UseGuarantorCollateral);
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Esempio n. 3
0
        private void item_Click(object sender, EventArgs e)
        {
            tabControlPerson.TabPages.Clear();
            tclLoanDetails.TabPages.Clear();
            _guarantee = null;

            tabControlPerson.TabPages.Add(tabPageDetails);
            AddProject(_project);
            tabControlPerson.TabPages.Add(tabPageLoansDetails);
            tabControlPerson.TabPages.Add(tabPageAdvancedSettings);
            tabControlPerson.TabPages.Add(tabPageLoanGuarantees);
            tabControlPerson.SelectedTab = tabPageLoansDetails;

            tclLoanDetails.TabPages.Add(tabPageInstallments);

            int id = (int)((ToolStripMenuItem)sender).Tag;
            _loanShares.Clear();
            _product = ServicesProvider.GetInstance().GetProductServices().FindPackage(id);
            if (_product.CycleId != null)
                ServicesProvider.GetInstance().GetProductServices().SetCyclesParamsForContract(_product, null, _client, true);
            InitializeTabPageLoansDetails(_product);
            _listGuarantors.Clear();
            _collaterals.Clear();
            listViewCollaterals.Items.Clear();

            SetGuarantorsEnabled(_product.UseGuarantorCollateral);
            LoadLoanDetailsExtensions();
            LoadLoanDetailsButtons();
        }