Example #1
0
 public FComp(FComp 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 FetchComponentList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT DISTINCT RM_ID, RM, FZ_ID, FZ, COMP_ID, COMP, dbo.IN_FR(COMP_ID, FZ_ID) AS IN_FZ FROM viewFRDATA " +
                "WHERE COMP_SSD_REQ=1 AND CABLE_SSD_REQ=1 AND COMP IS NOT NULL AND RM_ID=@rm_id ORDER BY COMP";

            FComp item = new FComp();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create required parameters
            dbmgr.AddParameters(0, "@rm_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FComp();											            // create new item
                item = (FComp)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to ArrayList
            }

            dbmgr.CloseReader();
            _fireroom.componentlist = list;												    // update object item list
        }