public List <COMPONENT_DETAIL> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <COMPONENT_DETAIL> list = new List <COMPONENT_DETAIL>(); COMPONENT_DETAIL obj = null; String sql = " Use [rbi] Select [ComponentID]" + ",[MaterialID]" + ",[StreamID]" + "From [rbi].[dbo].[COMPONENT_DETAIL]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new COMPONENT_DETAIL(); obj.ComponentID = reader.GetInt32(0); obj.MaterialID = reader.GetInt32(1); obj.StreamID = reader.GetInt32(2); list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public void delete(COMPONENT_DETAIL obj) { DAL.delete(obj.ComponentID); }
public void edit(COMPONENT_DETAIL obj) { DAL.edit(obj.ComponentID, obj.MaterialID, obj.StreamID); }