private void ViewPerson(Member pMember, bool leader)
        {
            var personForm = new ClientForm((Person)pMember.Tiers, _mdiParent, ExtensionActivator);
            personForm.ShowDialog();

            if (leader && personForm.DialogResult == DialogResult.OK)
                group.Leader.Tiers = personForm.Person;

            group.IsBadClient();
            InitializeGroup();
            DisplayMembers();
        }
 private void AddMembers()
 {
     if (!group.Active)
     {
         if (GroupHasActiveContracts())
         {
             ClientForm personForm = new ClientForm(OClientTypes.Person, _mdiParent, true, ExtensionActivator);
             if (DialogResult.OK == personForm.ShowDialog())
             {
                 try
                 {
                     if (group.Id != 0)
                         ServicesProvider.GetInstance().GetClientServices().CheckMaxNumberOfMembers(group);
                     Person pers = personForm.Person;
                     if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(pers))
                     {
                         group.AddMember(new Member
                                             {
                                                 Tiers = pers,
                                                 LoanShareAmount = 0,
                                                 CurrentlyIn = true,
                                                 IsLeader = false,
                                                 JoinedDate = TimeProvider.Today
                                             });
                         DisplayMembers();
                         ServicesProvider.GetInstance().GetContractServices().DeleteLoanShareAmountWhereNotDisbursed(group.Id);
                         if (MembersChanged != null) MembersChanged(this, null);
                         if (group.Id != 0)
                             buttonSave_Click(this, null);
                     }
                 }
                 catch (Exception ex)
                 {
                     new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                 }
             }
         }
     }
     else
     {
         MessageBox.Show(MultiLanguageStrings.GetString(Ressource.GroupUserControl, "CannotAddRemoveMember.Text"), "",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
     }
 }
 private void listViewGroup_DoubleClick(object sender, EventArgs e)
 {
     IClient client = (IClient)listViewGroup.SelectedItems[0].Tag;
     client = ServicesProvider.GetInstance().GetClientServices().FindTiers(client.Id, client.Type);
     if (client is Group)
     {
         ClientForm form = new ClientForm((Group)client, _mdiParent, ExtensionActivator);
         form.ShowDialog();
     }
     else if (client is Village)
     {
         NonSolidaryGroupForm form = new NonSolidaryGroupForm((Village)client, ExtensionActivator);
         form.ShowDialog();
     }
 }
Exemplo n.º 4
0
        private void AddAGuarantor()
        {
            var personForm = new ClientForm(OClientTypes.Person, _mdiParent, true, _applicationController);
            personForm.ShowDialog();
            _guarantor.Tiers = personForm.Person;

            try
            {
                textBoxName.Text = ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(_guarantor.Tiers)
                    ? _guarantor.Tiers.Name : String.Empty;
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Exemplo n.º 5
0
 private void BtnAddContactClick(object sender, EventArgs e)
 {
     var personForm = new ClientForm(OClientTypes.Person, _mdifrom, true, _applicationController);
     personForm.ShowDialog();
     Contact contact = new Contact {Tiers = personForm.Person};
     if (contact.Tiers != null)
         Corporate.Contacts.Add(contact);
     DisplayListContactCorporate(Corporate.Contacts);
 }
Exemplo n.º 6
0
 private void ViewMember(object sender, EventArgs e)
 {
     var contact = (Contact)lvContacts.SelectedItems[0].Tag;
     var member = ServicesProvider.GetInstance().GetClientServices().FindPersonById(contact.Tiers.Id);
     if (member != null)
     {
         var clientForm = new ClientForm(member, _mdifrom, _applicationController);
         clientForm.ShowDialog();
     }
 }
Exemplo n.º 7
0
        private void listViewGroup_DoubleClick(object sender, EventArgs e)
        {
            var data = (object[]) listViewGroup.SelectedItems[0].Tag;
            var clientId = (int) data[0];
            var clientType = (OClientTypes) data[1];

            var client = ServicesProvider.GetInstance().GetClientServices().FindTiers(clientId, clientType);
            if (client is Group)
            {
                var form = new ClientForm((Group)client, _mdiParent);
                form.ShowDialog();
            }
            else if (client is Village)
            {
                var form = new NonSolidaryGroupForm((Village)client);
                form.ShowDialog();
            }
        }
Exemplo n.º 8
0
 private void DisplaySelectedSaving()
 {
     if (listViewSavings.SelectedItems.Count > 0)
     {
         IClient member = (IClient)listViewSavings.SelectedItems[0].Group.Tag;
         if (member != null)
         {
             ClientForm personForm = new ClientForm((Person)member, MdiParent);
             personForm.DisplaySaving(((ISavingsContract)listViewSavings.SelectedItems[0].Tag).Id, member);
             personForm.ShowDialog();
             DisplaySavings();
         }
     }
 }
Exemplo n.º 9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ClientForm frm = new ClientForm(OClientTypes.Person, MdiParent, true);
            if (frm.ShowDialog() != DialogResult.OK) return;
            try
            {
                Person person = frm.Person;
                if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(person))
                {
                    var member = new VillageMember { Tiers = person, JoinedDate = TimeProvider.Now, CurrentlyIn = true, IsLeader = false, IsSaved = false};
                    member.ActiveLoans = ServicesProvider.GetInstance().GetContractServices().
                         FindActiveContracts(member.Tiers.Id);

                    _village.AddMember(member);
                    membersSaved = false;
                    DisplayMembers();
                    DisplayLoans();
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Exemplo n.º 10
0
        private Person AddOwner()
        {
            var personForm = new ClientForm(OClientTypes.Person, this.MdiParent, true);
            personForm.ShowDialog();
            //client = personForm.Person;

            try
            {
                //textBoxName.Text = ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(client) ? client.Name : String.Empty;
                if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(personForm.Person)) return personForm.Person;
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            return null;
        }
Exemplo n.º 11
0
        private void listViewLoans_DoubleClick(object sender, EventArgs e)
        {

            var loan = (Loan) listViewLoans.SelectedItems[0].Tag;

            if (loan == null) return;
            var client = ServicesProvider.GetInstance().GetClientServices().FindTiersByContractId(loan.Id);
            if (client.Projects != null)
                foreach (var credit in client.Projects.Where(project => project.Credits != null).SelectMany(project => project.Credits))
                    credit.CompulsorySavings =
                        ServicesProvider.GetInstance().GetSavingServices().GetSavingForLoan(credit.Id, true);
            var frm = new ClientForm(client, loan.Id, MdiParent, "tabPageLoansDetails", _applicationController);
            frm.ShowDialog();

            DisplayLoans();
        }