private static List <ParentDependencyInfo> BuildParents(FormContext context, List <string> parentFileds, string parentId) { var parents = new List <ParentDependencyInfo>(); foreach (string s in parentFileds) { var p = new ParentDependencyInfo() { WidgetId = s, IsRequired = true }; parents.Add(p); var childCtrl = context.GetWidget(s); if (childCtrl != null) { if (childCtrl.Dependency == null) { childCtrl.Dependency = new WidgetDependencyInfo(); } childCtrl.Dependency.AddChild(new ChildDependencyInfo() { WidgetId = parentId, Clear = true }); } context.MissingFields.Add(s); } return(parents); }
public static void Build(FormContext context, BaseField field, IWidget widget) { if (field.IsRelatedField) { var linkField = field.Related.LinkField; var ctrl = context.GetWidget(linkField); if (ctrl != null) { if (ctrl.Dependency == null) { ctrl.Dependency = new WidgetDependencyInfo(); } ctrl.Dependency.AddChild(new ChildDependencyInfo() { WidgetId = widget.WidgetId }); } } }