private void AddEnrollment(int FinalTimeOfPurchase, DateTime DateTime) { string NewEnrollment = txtMessage.Text.Replace(" ", ""); Enrollment Enrollment = new Enrollment(NewEnrollment.Substring(0, 3), Int32.Parse(NewEnrollment.Substring(3, 4))); if (Repository.IsRepeatedEnrollment(Enrollment.LettersOfEnrollment, Enrollment.NumbersOfEnrollment)) { Enrollment = Repository.GetAnEnrollment(Enrollment.LettersOfEnrollment, Enrollment.NumbersOfEnrollment); } else { Repository.AddEnrollment(Enrollment); } AddPurchase(FinalTimeOfPurchase, Enrollment, DateTime); }
private void ValidateRepeatEnrollment(string Letters, string Numbers) { if (ValidatorOfEnrollment.ValidateIsNumeric(Numbers)) { if (Repository.IsRepeatedEnrollment(Letters, int.Parse(Numbers))) { Enrollment EnrollmentOfPurchase = Repository.GetAnEnrollment(Letters, int.Parse(Numbers)); ValidateDate(EnrollmentOfPurchase); } else { SetMessage("No hay ninguna compra con esa matrícula."); } } else { SetMessage("El formato de la matrícula no es válido."); } }
public void ValidateGrabAnEnrollmentWithListEmpty() { Assert.AreEqual(null, Repository.GetAnEnrollment("sbn", 4040)); }