public static double weekly() { double result = 0; try { List<String> list = DataManagement.readInfo(); List<double> numbers = new List<double>(); List<InfoClass> classList = new List<InfoClass>(); for (int i = 0; i < list.Count; i++) { String[] temp = list.ElementAt(i).Split('|'); InfoClass temp1 = new InfoClass(temp[0], temp[1], temp[2]); classList.Add(temp1); } for (int i = 0; i < classList.Count; i++) { DateTime time = DateTime.Parse(classList.ElementAt(i).Date); DateTime timeToday = DateTime.Now; DateTime timeMinusSeven = timeToday.AddDays(-7); if (timeToday >= time && time >= timeMinusSeven) { double temporary = double.Parse(classList.ElementAt(i).Price); result += temporary; } } }catch(FileNotFoundException ex) { throw; } return result; }
protected void Page_Load(object sender, EventArgs e) { try { List<String> list = DataManagement.readInfo(); List<InfoClass> list1 = new List<InfoClass>(); for (int i = 0; i < list.Count; i++) { String[] temp = list.ElementAt(i).Split('|'); InfoClass temp1 = new InfoClass(temp[0], temp[1], temp[2]); list1.Add(temp1); } repeater.DataSource = list1; repeater.DataBind(); }catch(FileNotFoundException exe) { exception1.Text = exe.Message; } }