Example #1
0
 public FAVFDR(FAVFDR 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 FetchVFDRList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT f.FA, v.* FROM FAVFDR v INNER JOIN FALIST f ON f.FA_ID = v.FA_ID WHERE v.FA_ID = @fa_id ORDER BY v.VFDR_ID";
            FAVFDR item = new FAVFDR();
            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 FAVFDR();
                item = (FAVFDR)FetchObject(item, p, dbmgr);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _firearea.vfdrlist = list;
        }