private void InitData() { foreach (var measureLawItemOlder in this.measureLawsOlder) { var measureLawGroupByCategory = this.measureLawsGroupByCategory.FirstOrDefault(k => string.Equals(k.AgeCategory, measureLawItemOlder.ageCategory, StringComparison.CurrentCultureIgnoreCase)); if (measureLawGroupByCategory != null) { measureLawGroupByCategory.MeasureLawsOlder.Add(measureLawItemOlder); } else { measureLawGroupByCategory = new MeasureLawGroupByCategory(measureLawItemOlder.ageCategory); measureLawGroupByCategory.MeasureLawsOlder.Add(measureLawItemOlder); this.measureLawsGroupByCategory.Add(measureLawGroupByCategory); } } foreach (var measureLawItemNew in this.measureLawsNew) { var measureLawGroupByCategory = this.measureLawsGroupByCategory.FirstOrDefault(k => string.Equals(k.AgeCategory, measureLawItemNew.ageCategory, StringComparison.CurrentCultureIgnoreCase)); if (measureLawGroupByCategory != null) { measureLawGroupByCategory.MeasureLawsNew.Add(measureLawItemNew); } else { measureLawGroupByCategory = new MeasureLawGroupByCategory(measureLawItemNew.ageCategory); measureLawGroupByCategory.MeasureLawsNew.Add(measureLawItemNew); this.measureLawsGroupByCategory.Add(measureLawGroupByCategory); } } int numericalorder = 0; var listData = new List <DataItemViewModelBase>(); foreach (var measureLawItem in this.measureLawsGroupByCategory) { var dataOlder = measureLawItem.GetStringDataOlder(); var dataNew = measureLawItem.GetStringDataOlder(); var itemViewModel = new DataItemViewModelBase(measureLawItem.GetIds(), string.Empty, dataOlder, dataNew, true, measureLawItem.MeasureLawsOlder, measureLawItem.MeasureLawsNew, false); listData.Add(itemViewModel); } // sort foreach (var item in listData.OrderBy(k => k.Sort).ThenBy(k => k.SortName).ToList()) { numericalorder++; item.NameColumn = numericalorder.ToString(); item.Show = numericalorder == 1; this.Items.Add(item); } }
private void InitData() { foreach (var measureLawItemOlder in this.measureLawsOlder) { var measureLawGroupByCategory = this.measureLawsGroupByCategory.FirstOrDefault(k => string.Equals(k.AgeCategory, measureLawItemOlder.ageCategory, StringComparison.CurrentCultureIgnoreCase)); if (measureLawGroupByCategory != null) { measureLawGroupByCategory.MeasureLawsOlder.Add(measureLawItemOlder); } else { measureLawGroupByCategory = new MeasureLawGroupByCategory(measureLawItemOlder.ageCategory); measureLawGroupByCategory.MeasureLawsOlder.Add(measureLawItemOlder); this.measureLawsGroupByCategory.Add(measureLawGroupByCategory); } } foreach (var measureLawItemNew in this.measureLawsNew) { var measureLawGroupByCategory = this.measureLawsGroupByCategory.FirstOrDefault(k => string.Equals(k.AgeCategory, measureLawItemNew.ageCategory, StringComparison.CurrentCultureIgnoreCase)); if (measureLawGroupByCategory != null) { measureLawGroupByCategory.MeasureLawsNew.Add(measureLawItemNew); } else { measureLawGroupByCategory = new MeasureLawGroupByCategory(measureLawItemNew.ageCategory); measureLawGroupByCategory.MeasureLawsNew.Add(measureLawItemNew); this.measureLawsGroupByCategory.Add(measureLawGroupByCategory); } } int numericalorder = 0; var listData = new List<DataItemViewModelBase>(); foreach (var measureLawItem in this.measureLawsGroupByCategory) { var dataOlder = measureLawItem.GetStringDataOlder(); var dataNew = measureLawItem.GetStringDataOlder(); var itemViewModel = new DataItemViewModelBase(measureLawItem.GetIds(), string.Empty, dataOlder, dataNew, true, measureLawItem.MeasureLawsOlder, measureLawItem.MeasureLawsNew, false); listData.Add(itemViewModel); } // sort foreach (var item in listData.OrderBy(k => k.Sort).ThenBy(k => k.SortName).ToList()) { numericalorder++; item.NameColumn = numericalorder.ToString(); item.Show = numericalorder == 1; this.Items.Add(item); } }