public NextSection AddExpectedChildren(ExpectedChildren expectedChildren) { Validate(expectedChildren); ExpectedChildren = expectedChildren; return(OnSectionCompleted(Sections.ExpectedChildren)); }
public static ExpectedChildren NoBabyExpected(this ExpectedChildren expectedChildren) { expectedChildren.IsBabyExpected = false; expectedChildren.ExpectancyDate = null; expectedChildren.ExpectedBabyCount = null; return(expectedChildren); }
public static ExpectedChildren ExpectedBabyCount(this ExpectedChildren expectedChildren, int?babyCount) { expectedChildren.IsBabyExpected = babyCount > 0; expectedChildren.ExpectancyDate = DomainRegistry.NowUtc().Date.AddDays(100); expectedChildren.IsMoreThan1BabyExpected = babyCount > 1; expectedChildren.ExpectedBabyCount = babyCount > 1 ? babyCount.Value : (int?)null; return(expectedChildren); }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <returns>Required elements in this particle.</returns> public ExpectedChildren GetRequiredElements() { var requiredElements = new ExpectedChildren(); GetRequiredElements(requiredElements); return(requiredElements); }
public static ExpectedChildren NewValid(Action <ExpectedChildren> mutator = null) { var expectedChildren = new ExpectedChildren(); BestStartGrantForms.Dto.ExpectedChildrenBuilder.Populate(expectedChildren); mutator?.Invoke(expectedChildren); return(expectedChildren); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <returns>Expected elements in this particle.</returns> public ExpectedChildren GetExpectedElements() { var expectedElements = new ExpectedChildren(); GetExpectedElements(expectedElements); return(expectedElements); }
internal static string GetExpectedChildrenMessage(OpenXmlElement parent, ExpectedChildren expectedChildrenIds) { if (expectedChildrenIds is not null) { return(expectedChildrenIds.GetExpectedChildrenMessage(parent)); } return(string.Empty); }
private ActionResult ExpectedChildren_Render(string formId, ExpectedChildren details) { return(NavigableView <ExpectedChildrenModel>(formId, Sections.ExpectedChildren, (m, f) => { m.TitlePrefix = BsgText.TitlePrefix(); m.Title = BsgText.ExpectedChildrenTitle(); m.ExpectedChildren = details ?? f.ExpectedChildren; })); }
public static ExpectedChildren Populate(ExpectedChildren expectedChildren, Action <ExpectedChildren> mutator = null) { expectedChildren.IsBabyExpected = true; expectedChildren.ExpectancyDate = DomainRegistry.NowUtc().Date + TimeSpan.FromDays(100); expectedChildren.IsMoreThan1BabyExpected = true; expectedChildren.ExpectedBabyCount = 2; mutator?.Invoke(expectedChildren); return(expectedChildren); }
private ActionResult ExpectedChildren_Render(string formId, ExpectedChildren details) { return(NavigableView <ExpectedChildrenModel>(formId, Bsg.BsgViews.ExpectedChildren, Sections.ExpectedChildren, (m, f) => { m.TitlePrefix = CocText.TitlePrefix(); m.Title = "Expected baby"; m.ExpectedChildren = details ?? f.ExpectedChildren ?? new ExpectedChildren(); m.ExpectedChildren.IsBabyExpected = true; m.HideIsBabyExpected = true; })); }
public ActionResult ExpectedChildren(string id, ExpectedChildren expectedChildren) { var cmd = new AddExpectedChildren { FormId = id, ExpectedChildren = expectedChildren, }; return(Exec(cmd, success: next => RedirectNext(next), failure: () => ExpectedChildren_Render(id, expectedChildren))); }
public NextSection AddExpectedChildren(ExpectedChildren expectedChildren) { if (expectedChildren.IsBabyExpected == false) { throw new DomainException("Must indicate having a baby in Change of Circumstances"); } new BestStartGrantForms.Commands.Validate { ExpectedChildren = expectedChildren }.Execute(); ExpectedChildren = expectedChildren; return(OnSectionCompleted(Sections.ExpectedChildren)); }
internal static void Validate(ExpectedChildren expectedChildren) { var ctx = new ValidationContext <ExpectedChildren>(expectedChildren); ctx.Required(c => c.IsBabyExpected, "Please indicate if you are expecting a baby"); if (expectedChildren.IsBabyExpected == false) { expectedChildren.ExpectancyDate = null; expectedChildren.IsMoreThan1BabyExpected = null; expectedChildren.ExpectedBabyCount = null; } if (expectedChildren.IsBabyExpected == true) { ctx.Required(m => m.ExpectancyDate, "Please supply the date the baby is due"); if (expectedChildren.ExpectancyDate.HasValue) { ctx.InFuture(m => m.ExpectancyDate, "Please supply a due date in the future"); } ctx.Required(m => m.IsMoreThan1BabyExpected, "Please indicate if more than one baby is expected"); if (expectedChildren.IsMoreThan1BabyExpected == false) { expectedChildren.ExpectedBabyCount = null; } if (expectedChildren.IsMoreThan1BabyExpected == true) { ctx.Required(m => m.ExpectedBabyCount, "Please supply how many babies are expected"); ctx.Custom(m => m.ExpectedBabyCount, babyCount => babyCount.HasValue && (babyCount.Value < 2 || babyCount.Value > 10) ? "Please supply a number of babies between 2 and 10" : null); } } ctx.ThrowIfError(); }
public static ExpectedChildren Invalid(this ExpectedChildren expectedChildren) { expectedChildren.IsBabyExpected = null; return(expectedChildren); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public virtual bool GetExpectedElements(ExpectedChildren result) { return(false); }