Пример #1
0
 public LoanSharesForm(Loan pLoan, Group pGroup)
 {
     InitializeComponent();
     _loan = pLoan;
     _group = pGroup;
     _total = _loan.LoanShares.Sum(x => x.Amount.Value);
     
     InitializeControls();
 }
Пример #2
0
        public void TestGetTotalLoanAmount()
        {
            Group group = new Group();
            Person pers1 = new Person {Id = 1};
            Person pers2 = new Person {Id = 2};
            group.AddMember(new Member { Tiers = pers1, LoanShareAmount = 100, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = pers2, LoanShareAmount = 76.78m, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });

            Assert.AreEqual(176.78m,group.GetTotalLoanAmount.Value);
        }
Пример #3
0
        public void Copy_MembersAreCopied()
        {
            Person person = new Person {Id = 1, Active = true, BadClient = true};
            Member member = new Member {Tiers = person, IsLeader = true, CurrentlyIn = true};
            Group group = new Group {Id = 3,BadClient = false, Active = true, Members = new List<Member> {member}};

            Group clonedGroup = (Group)group.Copy();
            Assert.AreEqual(3, clonedGroup.Id);

            clonedGroup.Id = 7;
            Assert.AreEqual(3,group.Id);

            Assert.AreEqual(true, clonedGroup.Members[0].Tiers.BadClient);
            clonedGroup.Members[0].Tiers.BadClient = false;
            Assert.AreEqual(true, group.Members[0].Tiers.BadClient);
        }
Пример #4
0
        public void InitializeGroupForm(Group group, Project project)
        {
            ClientForm personForm = new ClientForm(group, this, _applicationController)
            {
                MdiParent = this,
                Text      =
                    string.Format("{0} [{1}]", MultiLanguageStrings.GetString(Ressource.ClientForm, "Group.Text"),
                                  group.Name)
            };

            if (project != null)
            {
                personForm.DisplayUserControl_ViewProject(project, null);
            }
            personForm.Show();
        }
 public void ResetAllComponents()
 {
     group = new Group();
     textBoxName.Text = string.Empty;
     dateTimePickerDateOfEstablishment.Value = TimeProvider.Today;
     listViewOtherMembres.Items.Clear();
     listViewHistoryMembers.Items.Clear();
     addressUserControlFirst.ResetAllComponents();
     addressUserControlSecondaryAddress.ResetAllComponents();
 }
Пример #6
0
        private void InitializeClient(IClient pClient, int pContractId)
        {
            if (pClient is Person)
            {
                _person = (Person)pClient;
                _client = _person;
                _oClientType = OClientTypes.Person;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(string.Format("{0} {1}", _person.FirstName, _person.LastName));
            }
            if (pClient is Group)
            {
                _group = (Group)pClient;
                _client = _group;
                _oClientType = OClientTypes.Group;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_group.Name);
            }
            if (pClient is Corporate)
            {
                _corporate = (Corporate)pClient;
                _client = _corporate;
                _oClientType = OClientTypes.Corporate;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_corporate.Name);
            }

            _project = pClient.SelectProject(pContractId);
            _credit = _project.SelectCredit(pContractId);
            _credit.LoanEntryFeesList = ServicesProvider.GetInstance().GetContractServices().GetInstalledLoanEntryFees(_credit);
            _product = _credit.Product;

            if (_product.CycleId != null && _credit.Disbursed == false)
            {
                ServicesProvider.GetInstance().GetProductServices().SetCyclesParamsForContract(_product, _credit, _client, false);
            }
            else
            {
                if (_credit.Product.Amount.HasValue == false)
                {
                    _amountValueRange = new DecimalValueRange(_credit.Product.AmountMin.Value, _credit.Product.AmountMax.Value);
                    nudLoanAmount.Minimum = _credit.Product.AmountMin.Value;
                    nudLoanAmount.Maximum = _credit.Product.AmountMax.Value;
                }
                else
                {
                    nudLoanAmount.Minimum = nudLoanAmount.Maximum = _credit.Product.Amount.Value;
                }
                if (_credit.Product.NbOfInstallments.HasValue == false)
                {
                    nudLoanNbOfInstallments.Minimum = _credit.Product.NbOfInstallmentsMin.Value;
                    nudLoanNbOfInstallments.Maximum = _credit.Product.NbOfInstallmentsMax.Value;
                }
                else
                {
                    nudLoanNbOfInstallments.Minimum = nudLoanNbOfInstallments.Maximum = _credit.Product.NbOfInstallments.Value;
                }
            }

            if (ServicesProvider.GetInstance().GetGeneralSettings().UseProjects)
            {
                tabControlPerson.TabPages.Add(tabPageProject);
                DisplaySelectedProject(_project);
            }
            else
            {
                AddProject(_project);
            }

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

            _credit.LoanInitialOfficer = _credit.LoanOfficer;

            InitializeTabPageLoansDetails(_credit);

            tabControlPerson.TabPages.Add(tabPageCreditCommitee);
            if (_credit.Disbursed)
            {
                tabControlPerson.TabPages.Add(tabPageLoanRepayment);
                //tabControlPerson.TabPages.Add(tabPageLAC);
                tabControlPerson.SelectedTab = tabPageLoanRepayment;
                InitializeTabPageLoanRepayment(_credit);
            }
            else if (_credit.ContractStatus == OContractStatus.Validated && !_credit.Disbursed)
            {
                tabControlPerson.SelectedTab = tabPageLoansDetails;
            }
        }
Пример #7
0
 private void GroupUserControl_ButtonCancelClick(object sender, EventArgs e)
 {
     _group = null;
     Close();
 }
Пример #8
0
        public void DisplayClient(IClient pClient, Project project)
        {
            if (pClient is Person)
            {
                _person = (Person)pClient;
                _oClientType = OClientTypes.Person;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(string.Format("{0} {1}", _person.FirstName, _person.LastName));
            }
            if (pClient is Group)
            {
                _group = (Group)pClient;
                _oClientType = OClientTypes.Group;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_group.Name);
            }
            if (pClient is Corporate)
            {
                _corporate = (Corporate)pClient;
                _oClientType = OClientTypes.Corporate;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_corporate.Name);
            }

            tabControlPerson.TabPages.Add(tabPageProject);
            DisplaySelectedProject(_project);
        }
Пример #9
0
        public ClientForm(OClientTypes pClientType, Form pMdiParent, bool pCloseFormAfterSave)
            : this()
        {
            _listGuarantors = new List<Guarantor>();
            _collaterals = new List<ContractCollateral>();
            _loanShares = new List<LoanShare>();
            _closeFormAfterSave = pCloseFormAfterSave;
            _mdiParent = pMdiParent;
            InitializeComponent();
            InitControls();
            _oClientType = pClientType;

            if (pClientType == OClientTypes.Person) _person = new Person();
            else if (pClientType == OClientTypes.Group) _group = new Group();
            else _corporate = new Corporate();
            InitializeUserControl(pClientType, pMdiParent);
            InitializeTitle(null);
        }
Пример #10
0
        public void TestUpdateGroup()
        {
            AddDataForTestingTransaction addDataForTesting = new AddDataForTestingTransaction();
            clientManagement = new ClientManager(DataUtil.TESTDB);
            clientServices = new ClientServices(clientManagement);

            DeleteAllData();

            Person leader = addDataForTesting.AddPerson();
            Person members = addDataForTesting.AddPersonBis();
            Person membersTer = addDataForTesting.AddPersonTer();
            Person membersQuater = addDataForTesting.AddPersonQuater();
            Group group = new Group
                              {
                                  Active = true,
                                  City = "Dushambe",
                                  District = leader.District,
                                  LoanCycle = 2,
                                  Name = "SCG",
                                  Leader =new Member{Tiers = leader,LoanShareAmount = 1000,CurrentlyIn = true,IsLeader = true,JoinedDate = TimeProvider.Today},
                                  Branch = _branch
                              };

            group.AddMember(new Member { Tiers = members, LoanShareAmount = 200, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = membersTer, LoanShareAmount = 400, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = membersQuater, LoanShareAmount = 700, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });

            Assert.AreEqual(String.Empty, clientServices.SaveSolidarityGroup(ref group));

            group.Name = "SCG2";
            Assert.AreEqual(String.Empty, clientServices.SaveSolidarityGroup(ref group));
        }
Пример #11
0
        public void TestIfClientCanBeAddToAGroupWhenClientIsALeader()
        {
            Person person = new Person {Id = 1, Active = false};
            Group group = new Group();

            mockClientManagement.ExpectAndReturn("IsLeader", true, person.Id);
            clientManagement = (ClientManager)mockClientManagement.MockInstance;
            clientServices = new ClientServices(clientManagement);

            clientServices.ClientCanBeAddToAGroup(person, group);
        }
Пример #12
0
        public void TestSearchGroupsInDatabaseWithCityParameterSet()
        {
            Group group1 = new Group{Active = true,City = "Dushambe",District = _district,Name = "SCG1",LoanCycle = 1};
            _cltManagement.AddNewGroup(group1,null);

            Group group2 = new Group{Active = true,City = "Dushambe",District = _district,Name = "SCG2",LoanCycle = 2};
            _cltManagement.AddNewGroup(group2,null);

            List<ClientSearchResult> result = _cltManagement.SearchGroups(1, "Dushambe");
            Assert.AreEqual(2, result.Count);
        }
Пример #13
0
        public void TestGetNumberOfRecordsFoundForSearchGroupsWhenRecordsExist()
        {
            _cltManagement.AddNewGroup(_group);

            Group group1 = new Group {Active = true, City = "Dushambe", District = _district, Name = "SCG1",Branch = _branch};
            _cltManagement.AddNewGroup(group1);

            Group group2 = new Group {Active = true, City = "Dushambe", District = _district, Name = "SCG2",Branch = _branch};
            _cltManagement.AddNewGroup(group2);
            List<ClientSearchResult> result = _cltManagement.SearchGroups(1, "SCG");
            Assert.AreEqual(3, result.Count);
        }
Пример #14
0
        public void SetUp()
        {
            _DeleteDatas();
            _cltManagement = new ClientManager(DataUtil.TESTDB);
            _agriculture = _addDataForTesting.AddDomainOfApplicationAgriculture();
            _district = _addDataForTesting.AddDistrictIntoDatabase();
            _addDataForTesting.AddBranchIntoDatabase();

            _branch = new Branch {Id = 1, Name = "Default"};
            _person = new Person();
            _person.Active = true;
            _person.BadClient = false;
            _person.LoanCycle = 1;
            _person.City = "Dushambe";
            _person.District = _district;

            _person.FirstName = "Nicolas";
            _person.LastName = "BARON";
            _person.Sex = 'M';
            _person.IdentificationData = "123ARK3VC";
            _person.HouseHoldHead = true;
            _person.StudyLevel = "1";
            _person.SSNumber = "3333";
            _person.CAFNumber = "2424";
            _person.HousingSituation = "test";
            _person.UnemploymentMonths = 1;
            _person.Nationality = "France";
            _person.BirthPlace = "Nancy";
            _person.Email = "*****@*****.**";
            _person.SecondaryEmail = "*****@*****.**";
            _person.HomeType = "Maison";
            _person.ZipCode = "12345";
            _person.SecondaryZipCode = "123458";
            _person.SecondaryHomeType = "Maison";
            _person.Handicapped = true;
            _person.Status = OClientStatus.Inactive;
            _person.FollowUpComment = "Comment follow Up";
            _person.FirstContact = new DateTime(2009, 12, 25);
            _person.FirstAppointment = new DateTime(2010, 04, 01);
            _person.Sponsor1 = "coucou";
            _person.Sponsor1Comment = "coucou2";
            _person.Branch = _branch;

            _group = new Group();
            _group.Active = true;
            _group.BadClient = false;
            _group.City = "Dushambe";
            _group.LoanCycle = 2;
            _group.District = _district;
            _group.Name = "SCG";
            _group.ZipCode = "12345";
            _group.SecondaryZipCode = "123458";
            _group.Email = "*****@*****.**";
            _group.SecondaryEmail = "*****@*****.**";
            _group.HomeType = "Maison";
            _group.SecondaryHomeType = "Maison";
            _group.Status = OClientStatus.Active;
            _group.FollowUpComment = "Follow Up Comment Group";
            _group.Sponsor2 = "coucou";
            _group.Sponsor2Comment = "coucou2";
            _group.Branch = _branch;
        }
Пример #15
0
 public ShowPictureForm(Group group, GroupUserControl groupUserControl, int photoSubId)
 {
     InitializeComponent();
     CaptionText = MultiLanguageStrings.GetString(Ressource.ClientForm, "Group.Text") + ": " + group.Name;
     this.groupUserControl = groupUserControl;
     this.group = group;
     this.photoSubId = photoSubId;
     addPhotoButton.Text = MultiLanguageStrings.GetString(Ressource.ShowPictureForm, "captionAdd.Text");
     changePhotoButton.Text = MultiLanguageStrings.GetString(Ressource.ShowPictureForm, "captionChange.Text");
     ShowPicture();
     InitializeButtons();
 }
Пример #16
0
        public void TestIfClientCanBeAddToAGroupWhenClientIsActive()
        {
            Person person = new Person {Id = 1, Active = true};
            Group group = new Group();

            clientManagement = new ClientManager(DataUtil.TESTDB);
            clientServices = new ClientServices(clientManagement);

            clientServices.ClientCanBeAddToAGroup(person, group);
        }
Пример #17
0
        public void TestSearchGroupsInDatabaseWithDistrictParameterSet()
        {
            Group group1 = new Group {Active = true, City = "Dushambe", District = _district, Name = "SCG1",Branch = _branch};
            _cltManagement.AddNewGroup(group1);

            Group group2 = new Group {Active = true, City = "Dushambe", District = _district, Name = "SCG2",Branch = _branch};
            _cltManagement.AddNewGroup(group2);

            List<ClientSearchResult> result = _cltManagement.SearchGroups(1, "Distr");
            Assert.AreEqual(2, result.Count);
        }
Пример #18
0
        public void TestIfClientIsAPerson()
        {
            Person person = new Person();
            Assert.IsTrue(clientServices.ClientIsAPerson(person));

            Group group = new Group();
            clientServices.ClientIsAPerson(group);
        }
Пример #19
0
        public void TestSelectGroup()
        {
            Person leader = new Person
            {
                FirstName = "Nicolas",
                LastName = "MANGIN",
                Sex = 'M',
                IdentificationData = "12345",
                LoanCycle = 1,
                BadClient = false,
                Address = "NotSet",
                City = "NotSet",
                DateOfBirth = TimeProvider.Today,
                District = _district,
                Activity = _agriculture,
                Branch = _branch
            };
            leader.Id = _cltManagement.AddPerson(leader);

            Person member1 = new Person
            {
                FirstName = "Mariam",
                LastName = "MANGIN",
                Sex = 'M',
                IdentificationData = "123456",
                LoanCycle = 1,
                BadClient = false,
                Address = "NotSet",
                City = "NotSet",
                DateOfBirth = TimeProvider.Today,
                District = _district,
                Activity = _agriculture,
                Branch = _branch
            };
            member1.Id = _cltManagement.AddPerson(member1);

            Person member2 = new Person
            {
                FirstName = "Vincent",
                LastName = "MANGIN",
                Sex = 'M',
                IdentificationData = "1234567",
                LoanCycle = 1,
                BadClient = false,
                Address = "NotSet",
                City = "NotSet",
                DateOfBirth = TimeProvider.Today,
                District = _district,
                Activity = _agriculture,
                Branch = _branch
            };
            member2.Id = _cltManagement.AddPerson(member2);

            Person member3 = new Person
            {
                FirstName = "Rudy",
                LastName = "MANGIN",
                Sex = 'M',
                IdentificationData = "12345678",
                LoanCycle = 1,
                BadClient = false,
                Address = "NotSet",
                City = "NotSet",
                DateOfBirth = TimeProvider.Today,
                District = _district,
                Activity = _agriculture,
                Branch = _branch
            };
            member3.Id = _cltManagement.AddPerson(member3);

            Group grp = new Group
            {
                Leader = new Member { Tiers = leader, LoanShareAmount = 0, CurrentlyIn = true, IsLeader = true, JoinedDate = TimeProvider.Today },
                EstablishmentDate = TimeProvider.Today,
                Name = "GroupTest",
                Branch = _branch
            };

            grp.AddMember(new Member { Tiers = member1, LoanShareAmount = 100, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            grp.AddMember(new Member { Tiers = member2, LoanShareAmount = 100, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            grp.AddMember(new Member { Tiers = member3, LoanShareAmount = 100, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            grp.District = _district;
            grp.Address = "NotSet";
            grp.City = "NotSet";
            grp.Id = _cltManagement.AddNewGroup(grp);

            Group newGroup = _cltManagement.SelectGroupById(grp.Id);

            Assert.AreEqual("Nicolas MANGIN", newGroup.Leader.Tiers.Name);
        }
Пример #20
0
        private static Group AddGroup(bool active, string city, District district, string name, Member leader, int NbOfMembers)
        {
            Group group = new Group {Active = active, City = city, District = district, Name = name, Leader = leader};

            for (int i = 0; i < NbOfMembers; i++)
            {
                group.AddMember(new Member { Tiers = new Person(), LoanShareAmount = 1000 + i, CurrentlyIn = true, IsLeader = true, JoinedDate = TimeProvider.Today });
            }
            return group;
        }
Пример #21
0
        public void TestSelectGroupIdsByPersonId()
        {
            _person.Id = _cltManagement.AddPerson(_person);

            Group group1 = new Group {Active = true, City = "Dushambe", District = _district, Name = "SCG1", Branch = _branch};

            group1.AddMember(new Member { Tiers = _person, LoanShareAmount = 1000, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            _cltManagement.AddNewGroup(group1);

            Group group2 = new Group {Active = true, City = "Dushambe", District = _district, Name = "SCG2", Branch = _branch};
            group2.AddMember(new Member { Tiers = _person, LoanShareAmount = 2000, CurrentlyIn = true, IsLeader = true, JoinedDate = TimeProvider.Today });
            _cltManagement.AddNewGroup(group2);

            Assert.AreEqual(2,_cltManagement.SelectGroupIdsByPersonId(_person.Id).Count);
        }
Пример #22
0
        public ClientForm(Group pGroup, Form pMdiParent)
            : this()
        {
            _mdiParent = pMdiParent;
            _group = pGroup;
            _client = pGroup;
            InitLoanOfficers(_client);
            _listGuarantors = new List<Guarantor>();
            _collaterals = new List<ContractCollateral>();
            _loanShares = new List<LoanShare>();

            InitializeComponent();
            InitControls();
            _oClientType = OClientTypes.Group;
            InitializeUserControl(OClientTypes.Group, pMdiParent);
            InitializeTitle(_group.Name);
        }
Пример #23
0
        public void RepayLoanBeforeDisburse()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, false);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, 0);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INTERESTS_ALSO_CREDITED_IN_FL, 1);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, 0);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.BAD_LOAN_DAYS, "180");
            ProvisionTable _provisionningTable = ProvisionTable.GetInstance(new User() { Id = 1 });
            _provisionningTable.ProvisioningRates = new List<ProvisioningRate>();
            _provisionningTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.02, ProvisioningInterest = 0.02, ProvisioningPenalty = 0.02 });
            _provisionningTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 0.1, ProvisioningInterest = 0.1, ProvisioningPenalty = 0.1 });
            _provisionningTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 0.25, ProvisioningInterest = 0.25, ProvisioningPenalty = 0.25 });
            _provisionningTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 0.5, ProvisioningInterest= 0.5, ProvisioningPenalty= 0.5 });
            _provisionningTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 0.75, ProvisioningInterest = 0.75, ProvisioningPenalty = 0.75 });
            _provisionningTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty= 1 });
            _provisionningTable.Add(new ProvisioningRate { Number = 7, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 1, ProvisioningInterest= 1, ProvisioningPenalty= 1 });

            Teller.CurrentTeller = null;

             AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction();
            int _creditId = dataHelper.AddGenericCreditContractIntoDatabase();

            IClient _client = new Group { Id = 5 };
            LoanManager _loanManager = new LoanManager(new User() { Id = 1 });
            Loan _loan = _loanManager.SelectLoan(_creditId, true, true, true);

            _loan.CreditCommiteeDate = _loan.StartDate;

            FundingLine f = _loan.FundingLine;
            f.Currency.Id = _loan.Product.Currency.Id;
            FundingLineServices fundingLineServices = new FundingLineServices(new User() { Id = 1 });

            var ev = new FundingLineEvent
            {
                Code = "KAO",
                Type = OFundingLineEventTypes.Entry,
                CreationDate = new DateTime(2008, 1, 10),
                EndDate = DateTime.Now.AddDays(1),
                Amount = 1000,
                FundingLine = f,
                Movement = OBookingDirections.Credit,
                IsDeleted = false
            };
            fundingLineServices.AddFundingLineEvent(ev, null);
            f.AddEvent(ev);
            LoanServices loanServices = new LoanServices(new User() { Id = 1 });

            PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false);

            _loan = loanServices.Disburse(_loan, new DateTime(2005, 10, 10), true, false, method);

            Assert.AreEqual(_loan.Disbursed, true);
            PaymentMethod paymentMethod = new PaymentMethod(1, "Cash", "", false);
            loanServices.Repay(_loan, _client, 1, new DateTime(2005, 1, 5), 100, true, 0, 0, false, 5, false, false, paymentMethod, null, false);
        }
Пример #24
0
 private void GroupUserControl_ButtonBadClientClick(object sender, EventArgs e)
 {
     _group = _groupUserControl.Group;
     InitializeTitle(_group.Name);
 }
Пример #25
0
        public void RepayWrittenOffLoan()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, false);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, 0);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INTERESTS_ALSO_CREDITED_IN_FL, 1);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, 0);
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.BAD_LOAN_DAYS, "180");

            ProvisionTable _provisionningTable = ProvisionTable.GetInstance(new User() {Id = 1});
            _provisionningTable.ProvisioningRates = new List<ProvisioningRate>();
            _provisionningTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.02, ProvisioningInterest = 0.02, ProvisioningPenalty = 0.02 });
            _provisionningTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 0.1, ProvisioningInterest = 0.01, ProvisioningPenalty = 0.01 });
            _provisionningTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 0.25, ProvisioningInterest = 0.025, ProvisioningPenalty = 0.025 });
            _provisionningTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 0.5, ProvisioningInterest = 0.5, ProvisioningPenalty = 0.5 });
            _provisionningTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 0.75, ProvisioningInterest = 0.75, ProvisioningPenalty = 0.75 });
            _provisionningTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty = 1 });
            _provisionningTable.Add(new ProvisioningRate { Number = 7, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty = 1 });

            Teller.CurrentTeller = null;

            //DynamicMock mockClientManager = new DynamicMock(typeof(ClientManager));
            //DynamicMock mockLoanManager = new DynamicMock(typeof(LoanManager));

            //Loan loan = new Loan
            //{
            //    Amount = 11,
            //    Code = "Test",
            //    InterestRate = 1,
            //    NbOfInstallments = 2,
            //    InstallmentType = new InstallmentType(),
            //    AnticipatedTotalRepaymentPenalties = 2,
            //    NonRepaymentPenalties = new NonRepaymentPenalties(1, 1, 1, 1),
            //    GracePeriod = 2,
            //    Events = new EventStock(),
            //    StartDate = new DateTime(2009, 1, 1),
            //    FundingLine = new FundingLine { Currency = new Currency { Id = 1, Code = "Code", Name = "Name" } },
            //    LoanOfficer = new User(),
            //    Product = new LoanProduct { Currency = new Currency { Id = 1, Code = "Code", Name = "Name" } },
            //    InstallmentList = new List<Installment> { _installment1, _installment2 }
            //};

            //Person person = new Person { Active = false, LoanCycle = 1 };
            //IClient group = new Group { Active = false, LoanCycle = 1, Members = new List<Member> { new Member { Tiers = person } } };

            //mockClientManager.Expect("UpdateClientStatus", group, null);
            //mockClientManager.Expect("UpdateClientLoanCycle", group, null);

            //mockClientManager.Expect("UpdateClientStatus", person, null);
            //mockClientManager.Expect("UpdateClientLoanCycle", person, null);

            //LoanServices loanServices = new LoanServices(null, (ClientManager)mockClientManager.MockInstance, (LoanManager)mockLoanManager.MockInstance);
            //loanServices.SaveLoan(ref loan, 1, ref group);

            //loanServices.Disburse(loan, new DateTime(2008, 1, 1), true, true);
            //loanServices.Repay(loan, group, 1, DateTime.Now, 1, true, 0, 0, false, 0, true);

            //Loan disbursedLoan = loan;
            //disbursedLoan.Disbursed = true;
            //LoanDisbursmentEvent loanDisbursmentEvent = new LoanDisbursmentEvent
            //                                                {
            //                                                    Date = new DateTime(2008, 1, 1),
            //                                                    Amount = disbursedLoan.Amount,
            //                                                    Commission = disbursedLoan.CalculateEntryFeesAmount(),
            //                                                    ClientType = disbursedLoan.ClientType
            //                                                };
            //disbursedLoan.Events.Add(loanDisbursmentEvent);
            //loanServices.Repay(disbursedLoan, group, 1, DateTime.Now, 1, true, 0,0, false, 1, true);
            AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction();
            int _creditId = dataHelper.AddGenericCreditContractIntoDatabase();

            IClient _client = new Group {Id = 5};
            LoanManager _loanManager = new LoanManager(new User() {Id = 1});
            Loan _loan = _loanManager.SelectLoan(_creditId, true, true, true);

            _loan.CreditCommiteeDate = _loan.StartDate;

            AccountManager accountManager = new AccountManager(new User() {Id = 1});
            //accountManager.AddForCurrency(_loan.Product.Currency.Id);

            FundingLine f = _loan.FundingLine;
            f.Currency.Id = _loan.Product.Currency.Id;
            FundingLineServices fundingLineServices = new FundingLineServices(new User() {Id = 1});

            var ev = new FundingLineEvent
            {
                Code = "KAO",
                Type = OFundingLineEventTypes.Entry,
                CreationDate = new DateTime(2008,1,1),
                EndDate = DateTime.Now.AddDays(1),
                Amount = 1000,
                FundingLine = f,
                Movement = OBookingDirections.Credit,
                IsDeleted = false
            };
            fundingLineServices.AddFundingLineEvent(ev, null);
            f.AddEvent(ev);
            _loan.LoanEntryFeesList=new List<LoanEntryFee>();

            EntryFee productEntryFee = new EntryFee();
            productEntryFee.Value = 1;
            productEntryFee.IsRate = false;
            productEntryFee.Id = 21;
            LoanEntryFee loanEntryFee = new LoanEntryFee();
            loanEntryFee.FeeValue = 1;
            loanEntryFee.ProductEntryFee = productEntryFee;
            loanEntryFee.ProductEntryFeeId = 21;

            LoanServices loanServices = new LoanServices(new User() { Id = 1 });

            PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false);
            loanServices.Disburse(_loan, new DateTime(2008, 1, 1), true, false, method);

            ////_loan.WrittenOff = true;
            ////_loan = loanServices.Repay(_loan, _client, 1, DateTime.Now, 10, true, 0, 0,false, 1, true);
            //Assert.AreEqual(_loan.Disbursed, true);
            //_loan.WrittenOff = true;
            //OCurrency prevAmount = _loan.ChartOfAccounts.GetAccountByNumber(OAccounts.RECOVERY_OF_CHARGED_OFF_ASSETS, _loan.Product.Currency.Id).Balance;
            //_loan = loanServices.Repay(_loan, _client, 1, DateTime.Now, 100, true, 0, 0, false, 5, false, OPaymentMethods.Cash, null, false);

            //Assert.AreEqual(_loan.Events.GetNumberOfEvents, 1);
            //_loan.Events.SortEventsByDate();
            //Assert.AreEqual(_loan.Events.GetEvent(0).Code, "ROWO");

            //_loan = loanServices.Repay(_loan, _client, 2, DateTime.Now, 100, true, 0, 0, false, 5, false, OPaymentMethods.Cash, null, false);

            //Assert.AreEqual(_loan.Events.GetNumberOfEvents, 2);

            //_loan.Events.SortEventsByDate();
            //Assert.AreEqual(_loan.Events.GetEvent(0).Code, "ROWO");
        }
Пример #26
0
 private void GroupUserControl_ButtonSaveClick(object sender, EventArgs e)
 {
     if (_groupUserControl.GroupSaved)
     {
         _group = _groupUserControl.Group;
         _client = _group;
         ((LotrasmicMainWindowForm)_mdiParent).SetInfoMessage(string.Format("Group {0} saved", _group.Name));
         InitializeTitle(_group.Name);
         if (!tabControlPerson.TabPages.Contains(tabPageContracts))
         {
             tabControlPerson.TabPages.Add(tabPageContracts);
             panelLoansContracts.Controls.Add(pnlLoans);
         }
     }
     else
         _group = null;
 }
Пример #27
0
        public void SaveLoan_AddLoan_Group()
        {
            DynamicMock mockClientManager = new DynamicMock(typeof(ClientManager));
            DynamicMock mockLoanManager = new DynamicMock(typeof(LoanManager));

            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false);
            Loan loan = new Loan
            {
                Amount = 11,
                Code = "Test",
                InterestRate = 1,
                NbOfInstallments = 2,
                InstallmentType = new InstallmentType(),
                AnticipatedTotalRepaymentPenalties = 2,
                NonRepaymentPenalties = new NonRepaymentPenalties(1, 1, 1, 1),
                LoanEntryFeesList = new List<LoanEntryFee>(),
                GracePeriod = 2,
                Events = new EventStock(),
                StartDate = new DateTime(2009, 1, 1),
                FundingLine = new FundingLine { Currency = new Currency { Code = "Code", Name = "Name" } },
                LoanOfficer = new User(),
                Product = new LoanProduct { Currency = new Currency { Code = "Code", Name = "Name" } },
                InstallmentList = new List<Installment> { _installment1, _installment2 }
            };

            Person person = new Person { Active = false, LoanCycle = 1 };
            IClient group = new Group
                                {
                                    Active = false,
                                    LoanCycle = 1,
                                    Members = new List<Member> {new Member {Tiers = person}},
                                    Branch = new Branch(){Code = "test"}
                                };

            mockLoanManager.ExpectAndReturn("Add", 1, loan, 1, null);
            //mockLoanManager.ExpectAndReturn("GetConnection", new SqlConnection());
            mockClientManager.Expect("UpdateClientStatus", group, null);
            mockClientManager.Expect("UpdateClientStatus", person, null);

            LoanServices loanServices =  new LoanServices(null, (ClientManager)mockClientManager.MockInstance, (LoanManager)mockLoanManager.MockInstance);
            loanServices.SaveLoan(ref loan, 1, ref group);

            Assert.AreEqual(1, loan.Id);
            Assert.AreEqual(new DateTime(2009, 2, 1), loan.CloseDate);
            Assert.AreEqual(OContractStatus.Pending, loan.ContractStatus);
            Assert.AreEqual(1, ((Group)group).Members[0].Tiers.LoanCycle);
            Assert.AreEqual(1, group.LoanCycle);
        }
Пример #28
0
 public GroupUserControl(Group group, Form pMdiParent, IExtensionActivator extensionActivator)
     : base(extensionActivator)
 {
     _mdiParent = pMdiParent;
     InitializeComponent();
     this.group = group;
     loanAmount = group.TotalContractAmount;
     Initialization();
     InitializeGroup();
     DisplayProjects(group.Projects);
     PicturesServices ps = ServicesProvider.GetInstance().GetPicturesServices();
     if (ps.IsEnabled())
     {
         pictureBox1.Image = ps.GetPicture("GROUP", group.Id, true, 0);
         pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
         pictureBox2.Image = ps.GetPicture("GROUP", group.Id, true, 1);
         pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
     }
     else
     {
         pictureBox1.Visible = false;
         pictureBox2.Visible = false;
         linkLabelChangePhoto.Visible = false;
         linkLabelChangePhoto2.Visible = false;
     }
     InitializeCustomizableFields(group.Id);
 }
Пример #29
0
        public void SaveLoan_AddLoan_Group_RaisedException_RollBackObjects()
        {
            DynamicMock mockClientManager = new DynamicMock(typeof(ClientManager));
            DynamicMock mockLoanManager = new DynamicMock(typeof(LoanManager));

            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false);
            Loan loan = new Loan
            {
                Amount = 11,
                Code = "Test",
                InterestRate = 1,
                NbOfInstallments = 2,
                InstallmentType = new InstallmentType(),
                AnticipatedTotalRepaymentPenalties = 2,
                NonRepaymentPenalties = new NonRepaymentPenalties(1, 1, 1, 1),
                GracePeriod = 2,
                Events = new EventStock(),
                StartDate = new DateTime(2009, 1, 1),
                FundingLine = new FundingLine { Currency = new Currency { Code = "Code", Name = "Name" } },
                LoanOfficer = new User(),
                Product = new LoanProduct { Currency = new Currency { Code = "Code", Name = "Name" } },
                InstallmentList = new List<Installment> { _installment1, _installment2 }
            };

            IClient group = new Group { Active = false, LoanCycle = 1, Members = null };

            mockLoanManager.ExpectAndReturn("Add", 1, loan, 1, null);
            mockClientManager.Expect("UpdateClientStatus", group, null);
            mockClientManager.Expect("UpdateClientLoanCycle", group, null);

            LoanServices loanServices = new LoanServices(null, (ClientManager)mockClientManager.MockInstance, (LoanManager)mockLoanManager.MockInstance);
            try
            {
                loanServices.SaveLoan(ref loan, 1, ref group); //Exception because Members list is null
                Assert.Fail();
            }
            catch (Exception)
            {
                Assert.AreEqual(0, loan.Id);
                Assert.AreEqual(DateTime.MinValue, loan.CloseDate);
                Assert.AreEqual(DateTime.MinValue, loan.CreationDate);
                Assert.AreEqual(1, group.LoanCycle);
            }
        }
Пример #30
0
 public void InitializeGroupForm(Group group, Project project)
 {
     ClientForm personForm = new ClientForm(group, this)
     {
         MdiParent = this,
         Text =
             string.Format("{0} [{1}]", MultiLanguageStrings.GetString(Ressource.ClientForm, "Group.Text"),
                           group.Name)
     };
     if (project != null)
         personForm.DisplayUserControl_ViewProject(project, null);
     personForm.Show();
 }
Пример #31
0
        public void TestIfClientCanBeAddToAGroupWhenClientAlreadyInThisGroup()
        {
            Person person = new Person {Id = 1};
            Group group = new Group();
            group.AddMember(new Member { Tiers = person, LoanShareAmount = 1000, CurrentlyIn = true, IsLeader = true, JoinedDate = TimeProvider.Today });

            clientServices.ClientCanBeAddToAGroup(person, group);
        }