public PersonLayer(MODBEntities db, string name, PersonEnum type) : base(null, true) { this.name = name; this.db = db; this.type = type; EventClass.getInstance().UpdateEvent += Update; }
protected void Page_Load(object sender, EventArgs e) { Person[] persons = new Person[2]; Person person = new Person("小明",12); persons[0] = person; person = new Person("小红", 21); persons[1] = person; PersonEnum personEnum = new PersonEnum(persons); IList<Person> li = new List<Person>() { new Person("su",21),new Person("jing",24) }; Response.Write(li.JoinToString("$$")); //foreach (var v in personEnum) //{ // Response.Write(v+","); //} }
public void completePersonListForEach(PersonEnum editable, PersonEnum order, Action<MRListData> todo) { SQLiteCommand command = new SQLiteCommand(connection); command.CommandText = "SELECT idPerson, Name, Birthday, " + editable.ToString() + " FROM Person ORDER BY " + order.ToString(); SQLiteDataReader reader = executeReaderThreadSafe(command); while (reader.Read()) { int years = 0; if (reader.GetDateTime(2).Year != 1) { DateTime now = DateTime.Today; years = now.Year - reader.GetDateTime(2).Year; if (reader.GetDateTime(2) > now.AddYears(-years)) years--; } todo(new MRListData(reader.GetInt32(0), reader["Name"].ToString(), years, reader[editable.ToString()].ToString())); } command.Dispose(); }