private void Stat(string xml) { if (string.IsNullOrEmpty(xml)) { return; } lvwDayStats.Items.Clear(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlNodeList nlStockout = doc.SelectNodes(".//action[@amount<0]"); _daystats = new List <DayStat>(); foreach (XmlNode nodeStockout in nlStockout) { DateTime date = DateTime.Parse(nodeStockout.Attributes.GetNamedItem("date").Value); DayStat day = GetDayStat(_daystats, date); if (null == day) { day = (DayStat)Activator.CreateInstance(((DayStatInfo)tscboProductBunds.SelectedItem).DayStatType, date); _daystats.Add(day); } day.AddProductStockRecord( nodeStockout.Attributes.GetNamedItem("product").Value, -1 * int.Parse(nodeStockout.Attributes.GetNamedItem("amount").Value)); } RefreshList(); }