Пример #1
0
        private void InitializeTabPageSavingDetails(ISavingProduct product)
        {
            try
            {
                Text = _title;
                _savingsBookProduct = (SavingsBookProduct)product;
                DisplaySavingProduct(product);

                tabControlSavingsDetails.TabPages.Clear();
                tabControlSavingsDetails.TabPages.Add(tabPageSavingsAmountsAndFees);
                tabControlSavingsDetails.TabPages.Add(tabPageSavingsEvents);
                tabControlSavingsDetails.TabPages.Add(tabPageLoans); ;
                _saving =
                    new SavingBookContract(ServicesProvider.GetInstance().GetGeneralSettings(),
                        User.CurrentUser,
                        (SavingsBookProduct)product);
                if (((SavingsBookProduct)product).UseTermDeposit) tabControlSavingsDetails.TabPages.Add(tpTermDeposit);

                groupBoxSaving.Text = string.Format("{0}",
                    MultiLanguageStrings.GetString(Ressource.ClientForm, "SavingsBook.Text"));
                groupBoxSaving.ForeColor = Color.FromArgb(0, 88, 56);

                tabControlPerson.TabPages.Remove(tabPageSavingDetails);
                tabControlPerson.TabPages.Add(tabPageSavingDetails);
                tabControlPerson.SelectedTab = tabPageSavingDetails;

                InitializeSavingsGeneralControls();
                InitializeTabPageTermDeposit();
                InitializeSavingsFees();

                btSavingsUpdate.Visible = false;

                groupBoxSaving.Enabled = true;
                pnlSavingsButtons.Enabled = false;

                groupBoxSaving.Name += string.Format(" {0}", product.Name);
                int numbersOfSavings = SavingServices.GetSavingCount(_client);
                _saving.GenerateSavingCode(_client, numbersOfSavings, ServicesProvider.GetInstance().GetGeneralSettings().SavingsCodeTemplate,
                    ServicesProvider.GetInstance().GetGeneralSettings().ImfCode, _client.Branch.Code);
                int nextSavingsId = SavingServices.GetLastSavingsId() + 1;
                tBSavingCode.Text = _saving.Code + '/' + nextSavingsId.ToString();

                InitializeSavingsOfficersComboBox();
                DisplaySavingEvent(_saving);
                DisplaySavingLoans(_saving);

                //InitializeCustomizableFields(OCustomizableFieldEntities.Savings, null, false);
                LoadSavingsExtensions();
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Пример #2
0
        public void Get_Set_Code_ForPerson()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User(),
                                                               new DateTime(2007, 08, 11), null)
                                            {Code = "", Product = new SavingsBookProduct() {Id = 2, Code = "SavingProduct"}};
            saving.FirstDeposit(12m, new DateTime(2007, 08, 11), 0, new User(), Teller.CurrentTeller);

            saving.GenerateSavingCode(new Person { Id = 2, FirstName="Vincent", LastName = "Guigui" }, 3, "BC/YY/PC-PS/CN-ID", "BC");
            Assert.AreEqual("S/BC/2007/SAVIN-4/GUIG-2", saving.Code);

            saving.GenerateSavingCode(new Person { Id = 2, FirstName = "Vincent", LastName = "Guigui" }, 4, "IC/BC/CS/ID", "BC");
            Assert.AreEqual("BC/05/00002", saving.Code);
        }