public List <DM_ITEMS> getDataSource() { List <DM_ITEMS> list = new List <DM_ITEMS>(); DM_ITEMS obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = " Use [rbi] Select [DMItemID]" + ",[DMDescription]" + ",[DMSeq]" + ",[DMCategoryID]" + ",[DMCode]" + ",[HasDF]" + ",[HasRule]" + ",[FailureMode]" + "From [rbi].[dbo].[DM_ITEMS]"; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new DM_ITEMS(); obj.DMItemID = reader.GetInt32(0); obj.DMDescription = reader.GetString(1); obj.DMSeq = reader.GetInt32(2); obj.DMCategoryID = reader.GetInt32(3); obj.DMCode = reader.GetString(4); obj.HasDF = reader.GetInt32(5); obj.HasRule = reader.GetInt32(6); obj.FailureMode = reader.GetString(7); list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public void delete(DM_ITEMS obj) { DAL.delete(obj.DMItemID); }
public void edit(DM_ITEMS obj) { DAL.edit(obj.DMItemID, obj.DMDescription, obj.DMSeq, obj.DMCategoryID, obj.DMCode, obj.HasDF, obj.FailureMode); }