示例#1
0
 public FACompDisp(FACompDisp 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 FetchCompDispList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFACOMPDISP_LIVE WHERE FA_ID = @fa_id ORDER BY COMP, DISP";
            FACompDisp item = new FACompDisp();											    // 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, "@fa_id", id);							                // fire area id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FACompDisp();
                item = (FACompDisp)FetchObject(item, p, dbmgr);
                item.in_fa = Convert.ToBoolean(dbmgr.DataReader["in_fa"]);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _firearea.compdisplist = list;
        }