private _GradingPeriod stringToGradingPeriod(string input) { var output = new _GradingPeriod(); //if (SelectedSubject != null && SelectedSubject.GradingSystem?.GradingPeriods != null) //{ // foreach (var v in SelectedSubject.GradingSystem.GradingPeriods) // { // if (v.Name == input) // { // output.Name = v.Name; // output.Percentage = v.Percentage; // } // } //} if (SelectedSubject?.GradingSystem?.GradingPeriods == null) { return(output); } foreach (var v in SelectedSubject.GradingSystem.GradingPeriods) { if (v.Name != input) { continue; } output.Name = v.Name; output.Percentage = v.Percentage; } return(output); }
public GradingSystem() { GradingPeriodModel = new _GradingPeriod(); TestTypeModel = new TestType(); GradingPeriods = new ObservableCollection <_GradingPeriod>(); TestTypes = new ObservableCollection <TestType>(); isSet = false; }
private void AddNewGradingPeriodProc() { if (GradingPeriods.Any(c => c.Name == GradingPeriodModel.Name)) { return; //if <any> element in the collection satisfies the given condition } GradingPeriods.Add(GradingPeriodModel); GradingPeriodModel = new _GradingPeriod(); }
private void ClearFieldsProc() { if (TestTypeModel == null) { return; } TestTypeModel = new TestType(); if (GradingPeriodModel == null) { return; } GradingPeriodModel = new _GradingPeriod(); }