public FZIgnition(FZIgnition obj) { PropertyInfo[] p = obj.GetType().GetProperties(); // get entity properties for (int i = 0; i < (p.Length); i++) { if (!p[i].PropertyType.Name.Contains("list") && !p[i].Name.Contains("arg")) p[i].SetValue(this, p[i].GetValue(obj, null), null); // set entity's property values to obj properties } }
private void FetchIgnitionList(int id, IDBManager dbmgr) { string qryString = "SELECT * FROM viewFZIGNITION WHERE FA_ID = @fa_id ORDER BY FZ, IG"; FZIgnition item = new FZIgnition(); ArrayList list = new ArrayList(); PropertyInfo[] p = item.GetType().GetProperties(); dbmgr.CreateParameters(1); dbmgr.AddParameters(0, "@fa_id", id); dbmgr.ExecuteReader(CommandType.Text, qryString); while (dbmgr.DataReader.Read()) { item = new FZIgnition(); item = (FZIgnition)FetchObject(item, p, dbmgr); list.Add(item); } dbmgr.CloseReader(); _firearea.ignitionlist = list; }