2 using System.Collections;
3 using System.Collections.Generic;
7 using System.Web.UI.WebControls;
9 using MonoTests.DataSource;
11 namespace MonoTests.DataObjects
13 public class EmployeeDynamicDataContainer : DynamicDataContainer <List <Employee>>
15 public override Type ContainedType
19 return typeof (Employee);
23 public EmployeeDynamicDataContainer ()
28 public EmployeeDynamicDataContainer (List<Employee> data)
35 void PopulateWithData ()
37 Data = new List<Employee> {
38 new Employee { FirstName = "Marek", LastName = "Habersack" }
42 public override int Update (IDictionary keys, IDictionary values, IDictionary oldValues)
44 throw new NotImplementedException ();
47 public override int Insert (IDictionary values)
49 throw new NotImplementedException ();
52 public override int Delete (IDictionary keys, IDictionary oldValues)
54 throw new NotImplementedException ();
57 public override IEnumerable Select (DataSourceSelectArguments args, string where, ParameterCollection whereParams)
59 List<Employee> data = Data;
60 int count = data == null ? 0 : data.Count;
62 if (args.RetrieveTotalRowCount)
63 args.TotalRowCount = count;
65 int startIndex = args.StartRowIndex;
66 if (count == 0 || count < startIndex)
67 return new Employee[0];
69 int max = args.MaximumRows;
70 if (max == 0 || max > count)
74 var ret = new List<Employee> ();
75 ret.AddRange (data.GetRange (args.StartRowIndex, max));
80 public override List<DynamicDataTable> GetTables ()
82 var ret = new List<DynamicDataTable> ();
83 ret.Add (new EmployeeTable ());