Example #1
0
 public FACascHit(FACascHit 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 FetchCascPowerList(string analysis, int fa_id, IDBManager dbmgr)
        {
            FACascHit item = new FACascHit();											    // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(2);											            // create parameters
            dbmgr.AddParameters(0, "@analysis", analysis);							            // fire area id
            dbmgr.AddParameters(1, "@fa_id", fa_id);
            dbmgr.ExecuteReader(CommandType.StoredProcedure, "dbo.FACASC_POWER_s"); // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FACascHit();											            // create new item
                item = (FACascHit)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }
            dbmgr.CloseReader();
            _firearea.cascpowerlist = list;											        // update item list
        }