private void btnSearch_Click(object sender, EventArgs e) { PersonForVerification person = new PersonForVerification(); person.NationalityId = txtId.Text; person.TargetFirstName = txtTargetFirstName.Text; person.TargetLastName = txtTargetLastName.Text; person.TargetBirthYear = Convert.ToInt32(txtTargetBirthYear.Text); PersonManager personManager = new PersonManager(new NationalityIdServiceAdapter(), new CalculateUpperId()); if (radioButtonLower.Checked) { personManager = new PersonManager(new NationalityIdServiceAdapter(), new CalculateLowerId()); } var result = personManager.VerifyPerson(person); if (result.Success) { lblNationalityNumber.Text = person.TargetNationalityId; } else { lblNationalityNumber.Text = "Değer bulunamıyor!!!"; } }
public IResult VerifyPerson(PersonForVerification data) { int triggerForStop = 0; data.TargetNationalityId = _calculateBaseClass.Calculate(data.NationalityId); while (!_verificationService.CheckPerson(long.Parse(data.TargetNationalityId), data.TargetFirstName, data.TargetLastName, data.TargetBirthYear)) { triggerForStop++; data.TargetNationalityId = _calculateBaseClass.Calculate(data.TargetNationalityId); if (triggerForStop == 100) { return(new Result(false)); } } return(new Result(true, "Başarılı", data)); }
public Result(bool success, string message, PersonForVerification data) : this(success) { Message = message; Data = data; }