Ejemplo n.º 1
0
 public Subcomp(Subcomp 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
     }
 }
Ejemplo n.º 2
0
        // procedure fetches subcomponent list
        private void FetchSubcompList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewSUBCOMPS s WHERE s.COMP_ID = @comp_id ORDER BY s.SUBCOMP";

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

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

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

            dbmgr.CloseReader();
            _comp.subcomplist = list;												        // update component item list
        }