public void ChangeDisplay(Part relyPart, string relyType = "") { if (!string.IsNullOrEmpty(relyType)) { IsDisplay = RelyTypes.Any(irbaApplicationType => relyType == irbaApplicationType); return; } if (RelyParts == null) { IsDisplay = true; return; } IsDisplay = RelyParts.Any(part => part.BelongSection == relyPart.BelongSection && part.PartName == relyPart.PartName); }
private List<Part> CreatePart(int count, Section section, List<PartRelys> partRelys = null) { var parts = new List<Part>(); for (int i = 1; i <= count; i++) { var part = new Part(section.SectionName.Last().ToString(CultureInfo.InvariantCulture) + i) { BelongSection = section }; if (partRelys != null) { foreach (var partRelyse in partRelys) { var partsName = partRelyse.PartsName.Split(','); foreach (var s in partsName) { if (s == "All") { part.RelyTypes.Add(partRelyse.Type); } else if (s == part.PartName) { part.RelyTypes.Add(partRelyse.Type); } } } } parts.Add(part); } return parts; }