예제 #1
0
 public PSLoad(PSLoad 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
     }
 }
예제 #2
0
 private void FetchCRDPowerList(int id, IDBManager dbmgr)
 {
     string qryString = "SELECT * FROM viewCRDPOWERCAB cc WHERE cc.CABLE_ID = @cable_id ORDER BY cc.POWER, cc.BKRFUSE";
     PSLoad item = new PSLoad();
     ArrayList list = new ArrayList();
     try
     {
         PropertyInfo[] p = item.GetType().GetProperties();
         dbmgr.Open();
         dbmgr.CreateParameters(1);
         dbmgr.AddParameters(0, "@cable_id", id);
         dbmgr.ExecuteReader(CommandType.Text, qryString);
         while (dbmgr.DataReader.Read())
         {
             item = new PSLoad();
             item = (PSLoad)FetchObject(item, p, dbmgr);
             list.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
     _cable.crdpowerlist = list;
 }
예제 #3
0
        private void FetchPSLoadList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewPSLOADS ps WHERE ps.POWER_ID = @power_id ORDER BY ps.BKRFUSE";
            PSLoad item = new PSLoad();											            // 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(1);											            // create parameters
            dbmgr.AddParameters(0, "@power_id", id);								        // power id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

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

            dbmgr.CloseReader();
            _power.psloadlist = list;									                    // update item list
        }