public IEnumerable <string> GetFieldItemsOfSelectedField() { var fn = FieldListBox.SelectedItemText; var fdata = FieldFile.GetFieldFile(fn, currDatabase.folder); var ds = fdata.ReadFieldHeaders(); return(from d in ds select d.name); }
public void Test() { //return; var fieldData = FieldFile.GetFieldFile("REP30040", DatabaseDir); SwitchSpec spec = new SwitchSpec { demographicField = new FieldDetail() { fieldName = "WPOCITY", fieldItems = { "全国总体", " 上海", " 北京", } }, period1Field = new FieldDetail() { fieldName = "W_PERIOD", fieldItems = new SortedSet <string>((from header in FieldFile.GetFieldFile("W_PERIOD", DatabaseDir).ReadFieldHeaders() select header.name).Skip(1).ToList()) }, dataFilter = new FieldDetail() { fieldName = "REP30031", fieldItems = { " 新鲜酸奶", " 果粒酸奶" } }, brands = new FieldDetail() { fieldName = "REP30040", fieldItemsIndex = new SortedSet <int> { 1, 2, 3 } }, primaryVolume = new FieldDetail() { fieldName = "R_SPEND", }, secondaryVolume = new FieldDetail() { fieldName = "R_SPEND", }, isRolling = true, periodLength = 13, waveInterval = 13, }; }
public void SetField(FieldDetail field) { Console.WriteLine("Searching field {0}", field.fieldName); FieldDescListBox.Items[FieldListBox.Items.FindIndex(x => x.Name == field.fieldName)].Select(); if (field.fieldItems.Count == 0 && field.fieldItemsIndex.Count == 0) { return; } var headers = FieldFile.GetFieldFile(field.fieldName, dbFolder).ReadFieldHeaders(); var indices = headers .Select((item, index) => new { item.name, index }) .Where(pair => { return(field.fieldItems.Contains(pair.name)); }) .Select(x => x.index) .Concat(field.fieldItemsIndex) .OrderBy(x => x); foreach (var idx in indices) { Console.WriteLine("{0} -> {1}", idx, headers[idx].name); } SelectFieldItems(indices); }