private void BtnSelectContactClick(object sender, EventArgs e)
        {
            using (SearchClientForm searchClientForm = SearchClientForm.GetInstance(OClientTypes.Person, true))
            {
                searchClientForm.ShowDialog();
                var contact = new Contact();
                try
                {
                    if (searchClientForm.Client != null)
                    {
                        contact.Tiers = searchClientForm.Client;
                    }

                    if (!ServicesProvider.GetInstance().GetClientServices().ClientCanBeAddToCorporate(
                            searchClientForm.Client, Corporate))
                    {
                        return;
                    }

                    if (contact.Tiers != null)
                    {
                        Corporate.Contacts.Add(contact);
                    }

                    DisplayListContactCorporate(Corporate.Contacts);
                }
                catch (Exception ex)
                {
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }
        }
        private Person SelectOwner()
        {
            using (SearchClientForm searchClientForm = SearchClientForm.GetInstance(OClientTypes.Person, true))
            {
                searchClientForm.ShowDialog();

                try
                {
                    if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(searchClientForm.Client) &&
                        !searchClientForm.Client.Active)
                    {
                        return((Person)searchClientForm.Client);
                    }
                    else
                    {
                        return(null);
                    }

                    //else
                    //  textBoxName.Text = String.Empty;
                }
                catch (Exception ex)
                {
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                    return(null);
                }
            }
        }
        private void SearchClientButton_Click(object sender, EventArgs e)
        {
            var form = new SearchClientForm {
                Profile = Profile
            };

            form.ShowDialog();
            if (form.IsFound)
            {
                if (FindRepeatCustomerInDetails(form.CustomerFound))
                {
                    var message =
                        $"El {Profile.SingleProfileName} que intenta asociar al contrato ya se encuentra en la lista de {Profile.ProfileName} asociados al contrato.";
                    MessageBox.Show(message, "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    CustomerAssociated = null;
                    ClearControls();
                }
                else
                {
                    CustomerAssociated = form.CustomerFound;
                    PutCustomerDataIntoControls();
                }
            }

            AceptContractButton.Enabled = CustomerAssociated != null;
        }
示例#4
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchClientForm frm = SearchClientForm.GetInstanceForVillage();

            frm.ShowDialog();
            if (DialogResult.OK != frm.DialogResult)
            {
                return;
            }

            try
            {
                var clientServices = ServicesProvider.GetInstance().GetClientServices();
                var client         = frm.Client;
                if (clientServices.ClientIsAPerson(client))
                {
                    var personId = client.Id;
                    clientServices.CheckPersonGroupCount(personId);
                    var member = new VillageMember {
                        Tiers = client, JoinedDate = TimeProvider.Now, CurrentlyIn = true, IsLeader = false, IsSaved = false
                    };
                    member.ActiveLoans = ServicesProvider.GetInstance().GetContractServices().
                                         FindActiveContracts(personId);

                    List <ISavingsContract> savingsContracts =
                        ServicesProvider.GetInstance().GetSavingServices().GetSavingsByClientId(member.Tiers.Id);

                    foreach (ISavingsContract contract in savingsContracts)
                    {
                        member.Tiers.Savings.Add(contract);
                    }

                    clientServices.AddExistingMember(_village, member);
                    membersSaved = false;
                    DisplayMembers();
                    DisplayLoans();
                    DisplaySavings();
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }