public WinnerItem(DrawItem item, int historyGroupIndex) { this.MajorColumnValue = item.MajorColumnValue; this.SecondaryColumnValue = item.SecondaryColumnValue; this.DrawWeight = item.DrawWeight; this.DrawnTimeStamp = DateTime.Now; this.HistroyGroupIndex = historyGroupIndex; }
public static async Task <DataSourceResult> ReadFileForDrawItem(StorageFile file) { DataSourceResult r = new DataSourceResult(); using (var inputStream = await file.OpenReadAsync()) using (var classicStream = inputStream.AsStreamForRead()) using (var streamReader = new StreamReader(classicStream)) { string line1 = await streamReader.ReadLineAsync(); if (string.IsNullOrWhiteSpace(line1)) { return(null); } var titles = line1.Split(new char[] { ',' }); r.ColumnTitles[0] = titles.FirstOrDefault(); r.ColumnTitles[1] = titles.ElementAtOrDefault(1); while (!streamReader.EndOfStream) { String line = streamReader.ReadLine(); var patten = line.Split(new[] { ',' }); DrawItem drawItem = new DrawItem() { MajorColumnValue = patten.FirstOrDefault(), SecondaryColumnValue = patten.ElementAtOrDefault(1) }; if (String.IsNullOrEmpty(drawItem.MajorColumnValue) && String.IsNullOrEmpty(drawItem.SecondaryColumnValue)) { continue; } else { r.ItemList.Add(drawItem); } } } return(r); }
public bool UpdateDrawData(DrawItem item) { lock (listLock) { var group = DrawHistory.FirstOrDefault(); if (group != null) { if ((!group.Items.Contains(item)) && DrawItems.Contains(item)) { group.Items.Insert(0, item.ToWinnerItem(group.groupIndex)); DrawItems.Remove(item); return(true); } } return(false); } }