Esempio n. 1
0
 public PSBkrCab(PSBkrCab 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
     }
 }
Esempio n. 2
0
 private void UpdateStatus(IDBManager dbmgr, PSBkrCab item, int statustype_id, string user_id, DateTime status_date)
 {
     if ((user_id == "N/A") || (user_id == ""))
     {
         // delete status
         dbmgr.CreateParameters(2);
         dbmgr.AddParameters(0, "@psbkrcab_id", item.psbkrcab_id);
         dbmgr.AddParameters(1, "@statustype_id", statustype_id);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.PSBKRCABSTATUS_d");
     }
     else
     {
         // update status
         dbmgr.CreateParameters(4);
         dbmgr.AddParameters(0, "@psbkrcab_id", item.psbkrcab_id);
         dbmgr.AddParameters(1, "@statustype_id", statustype_id);
         dbmgr.AddParameters(2, "@user_id", user_id);
         if (status_date == Convert.ToDateTime(null))
             // set date to null
             dbmgr.AddParameters(3, "@status_date", null);
         else
             // update date
             dbmgr.AddParameters(3, "@status_date", status_date);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.PSBKRCABSTATUS_u");
     }
 }
Esempio n. 3
0
        private void FetchPSBkrCabList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewPSBKRCAB ps WHERE ps.PSLOAD_ID = @psload_id ORDER BY ps.CABLE";
            PSBkrCab item = new PSBkrCab();											        // 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, "@psload_id", id);								        // power id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

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

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