private void FetchCabDispList(int fa_id, int comp_id, IDBManager dbmgr) { string qryString = "SELECT * FROM viewFACABDISP_LIVE WHERE FA_ID = @fa_id AND COMP_ID = @comp_id ORDER BY COMP, CABLE, DISP"; FACabDisp item = new FACabDisp(); // 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(2); // create parameters dbmgr.AddParameters(0, "@fa_id", fa_id); // fire area id dbmgr.AddParameters(1, "@comp_id", comp_id); dbmgr.ExecuteReader(CommandType.Text, qryString); // execute query while (dbmgr.DataReader.Read()) { item = new FACabDisp(); item = (FACabDisp)FetchObject(item, p, dbmgr); list.Add(item); // add item to the ArrayList } dbmgr.CloseReader(); _firearea.cabdisplist = list; // update item list }
private void FetchFACompCabList(int id, IDBManager dbmgr) { string qryString = "SELECT * FROM viewFACOMPCABDISP WHERE DISP_ID = @disp_id ORDER BY FA, COMP, CABLE"; FACabDisp item = new FACabDisp(); //create new object type to be able to get property info ArrayList list = new ArrayList(); //create new ArrayList to house objects try { PropertyInfo[] p = item.GetType().GetProperties(); //get property info for item dbmgr.Open(); //open database manager dbmgr.CreateParameters(1); //create parameters dbmgr.AddParameters(0, "@disp_id", id); //disp id dbmgr.ExecuteReader(CommandType.Text, qryString); //execute query while (dbmgr.DataReader.Read()) { item = new FACabDisp(); //create new item item = (FACabDisp)FetchObject(item, p, dbmgr); list.Add(item); //add item to the ArrayList } } catch (Exception ex) { throw ex; } finally { dbmgr.Dispose(); } _disp.facompcablist = list; //update item list }