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