private void ddlInfraction_SelectedIndexChanged(object sender, EventArgs e) { PenaltyEnum defaultPenalty = PenaltyClass.GetDefaultPenalty(((InfractionListItem)this.ddlInfraction.SelectedItem).Value); this.ddlPenalty.SelectedIndex = -1; foreach (ListItemPenaltyEnum listItemPenaltyEnum in this.ddlPenalty.Items) { if (listItemPenaltyEnum.Value == defaultPenalty) { this.ddlPenalty.SelectedItem = (object)listItemPenaltyEnum; break; } } }
public PenaltyListItem(PenaltyEnum inf) { this.Value = inf; }
public Penalty(PenaltyEnum penaltyType, int instanceCount) { PenaltyType = penaltyType; InstanceCount = instanceCount; }
private static int GetInstanceCount(IEnumerable <Penalty> penalties, PenaltyEnum type) => penalties.Where(a => a.PenaltyType == type).Select(a => a.InstanceCount).Sum();