private DonorBM create_donor() { //Crea un donador OrganizationBLL organizationBll = new OrganizationBLL(); ResultBM result = organizationBll.GetOrganization(1); PersonBM personBm = create_person(); DonorBM donorBm = new DonorBM(true, personBm, result.GetValue <OrganizationBM>()); DonorBLL donorBll = new DonorBLL(); ResultBM saveResult = donorBll.SaveDonor(donorBm); Assert.IsTrue(saveResult.IsValid(), "El donador debería haberse creado."); return(saveResult.GetValue <DonorBM>()); }
private void cmdAccept_Click(object sender, EventArgs e) { DialogResult pressed = MessageBox.Show(SessionHelper.GetTranslation("SAVE_CHANGES_QUESTION"), "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (pressed == DialogResult.No) { return; } try { DonorBLL donorBll = new DonorBLL(); ResultBM donorResult; //Se encargan de completar la entidad con los valores necesarios FillPersonData(this.Entity); FillAddressData(this.Entity); FillCompanyData(this.Entity); if (isUpdate) { donorResult = donorBll.UpdateDonor(this.Entity); } else { donorResult = donorBll.SaveDonor(this.Entity); } if (donorResult.IsValid()) { Close(); } else { MessageBox.Show(donorResult.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }