public static void Execute1() { StoreData list = new StoreData(); list.Add(1); list.Add(2); list.Add(3); list.Add(4); foreach (var item in list) { Console.WriteLine(item); if (item != null && Convert.ToInt32(item) == 2) { break; } } Console.WriteLine("*****************************"); foreach (var item in list) { Console.WriteLine(item); } IEnumerator enumerator = list.GetEnumerator(); Console.WriteLine("*****************************"); while (enumerator.MoveNext()) { Console.WriteLine(enumerator.Current); if (Convert.ToInt32(enumerator.Current) == 3) { break; } } Console.WriteLine("*****************************"); while (enumerator.MoveNext()) { Console.WriteLine(enumerator.Current); } Console.ReadLine(); }
private void EnumerateStoreFiles() { StoreData.Clear(); var enumerateFiles = Directory.EnumerateFiles(StorePath, "*.mustachioPackage"); foreach (var enumerateFile in enumerateFiles) { StoreData.Add(new StoreMetaModel() { FileName = enumerateFile, Name = Path.GetFileName(enumerateFile) }); } }
public void StoreMonitor(string storeId, bool old = true) { if (!old) { StoreData = new List <Series>(); } if (String.IsNullOrEmpty(storeId)) { StoreData = new List <Series>(); foreach (TrxDataStore v in Warehouse.Values) { DotNet.Highcharts.Options.Point[] pt = new DotNet.Highcharts.Options.Point[v.testRunList.Count]; int i = 0; foreach (TestRun t in v.testRunList.Values) { pt[i] = new DotNet.Highcharts.Options.Point(); pt[i].Name = t.StartTime.ToString(); pt[i].Id = t.Id; pt[i].Y = t.Failed; pt[i].X = GetDateInJsFormat(t.StartTime); i++; } try { Array.Sort(pt, delegate(DotNet.Highcharts.Options.Point pt1, DotNet.Highcharts.Options.Point pt2) { return(pt1.X.ToString().CompareTo(pt2.X.ToString())); } ); StoreData.Add(new Series { Data = new Data(pt), Name = v.Id }); } catch (Exception e) { ViewBag.ErrorMessage = "Sorry, Error occurred"; } } } else { DotNet.Highcharts.Options.Point[] pt = new DotNet.Highcharts.Options.Point[Warehouse[storeId].testRunList.Count]; int i = 0; foreach (TestRun testRun in Warehouse[storeId].testRunList.Values) { pt[i] = new DotNet.Highcharts.Options.Point(); pt[i].Name = testRun.StartTime.ToString(); pt[i].Id = testRun.Id; pt[i].Y = testRun.Failed; pt[i].X = this.GetDateInJsFormat(testRun.StartTime); i++; } try { Array.Sort(pt, delegate(DotNet.Highcharts.Options.Point pt1, DotNet.Highcharts.Options.Point pt2) { return(pt1.X.ToString().CompareTo(pt2.X.ToString())); } ); StoreData.Add(new Series { Data = new Data(pt), Name = Warehouse[storeId].Id }); } catch (Exception e) { ViewBag.ErrorMessage = "Sorry, Error occurred"; } } //Response.Redirect("/XMLUtilityV1/Display"); //return this.Display(); }