Example #1
0
 public void AgregarBeneficiarioBtn_Click()
 {
     try
     {
         SociosLogic socios = new SociosLogic();
         if (socios.BuscarId(this.EditsocioIdTxt.Text, this.AddBenefID.Text))
         {
             if (socios.CienPorciento(this.EditsocioIdTxt.Text, Convert.ToInt32(this.AddBenefPorcentaje.Text)))
             {
                 socios.InsertarBeneficiario(this.EditsocioIdTxt.Text, this.AddBenefID.Text,
                     this.AddBenefNombre.Text, this.AddBenefParentezco.Text, this.AddBenefFechaNacimiento.Text,
                     this.AddBenefLugarNac.Text, this.AddBenefPorcentaje.Text);
                 bool answer = socios.Igual100(EditsocioIdTxt.Text);
                 if (!answer)
                 {
                     this.NuevoBeneficiarioWin.Hide();
                 }
                 this.NuevoBeneficiarioForm.Reset();
                 Beneficiarios_Refresh(null, null);
                 X.Msg.Alert("Beneficiario", "Beneficiario Agregado Correctamente.").Show();
             }
             else
             {
                 X.Msg.Alert("Beneficiario", "ERROR: El porcentaje excede del 100% del capital.").Show();
             }
         }
         else
         {
             X.Msg.Alert("Beneficiario", "ERROR: El beneficiario ya existe.").Show();
         }
     }
     catch (Exception ex)
     {
         log.Fatal("Error fatal al agregar beneficiario.", ex);
         throw;
     }
 }