public void edit(RW_DAMAGE_MECHANISM obj) { DAL.edit(obj.ID, obj.DMItemID, obj.IsActive, obj.Notes, obj.ExpectedTypeID, obj.IsEL, obj.ELValue, obj.IsDF, obj.IsUserDisabled, obj.DF1, obj.DF2, obj.DF3, obj.DFBase, obj.RLI, obj.HighestInspectionEffectiveness, obj.SecondInspectionEffectiveness, obj.NumberOfInspections, obj.LastInspDate, obj.InspDueDate); }
//get datasource public List <RW_DAMAGE_MECHANISM> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <RW_DAMAGE_MECHANISM> list = new List <RW_DAMAGE_MECHANISM>(); RW_DAMAGE_MECHANISM obj = null; String sql = "Use[rbi] Select[ID]" + ",[DMItemID]" + ",[IsActive]" + ",[Notes]" + ",[ExpectedTypeID]" + ",[IsEL]" + ",[ELValue]" + ",[IsDF]" + ",[IsUserDisabled]" + ",[DF1]" + ",[DF2]" + ",[DF3]" + ",[DFBase]" + ",[RLI]" + ",[HighestInspectionEffective]" + ",[SecondInspectionEffectiveness]" + ",[NumberOfInspections]" + ",[LastInspDate]" + ",[InspDueDate]" + "From [dbo].[RW_DAMAGE_MECHANISM] "; 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_DAMAGE_MECHANISM(); obj.ID = reader.GetInt32(0); obj.DMItemID = reader.GetInt32(1); obj.IsActive = reader.GetInt32(2); if (!reader.IsDBNull(3)) { obj.Notes = reader.GetString(3); } obj.ExpectedTypeID = reader.GetInt32(4); obj.IsEL = reader.GetInt32(5); if (!reader.IsDBNull(6)) { obj.ELValue = reader.GetFloat(6); } obj.IsDF = reader.GetInt32(7); obj.IsUserDisabled = reader.GetInt32(8); if (!reader.IsDBNull(9)) { obj.DF1 = reader.GetFloat(9); } if (!reader.IsDBNull(10)) { obj.DF2 = reader.GetFloat(10); } if (!reader.IsDBNull(11)) { obj.DF3 = reader.GetFloat(11); } if (!reader.IsDBNull(12)) { obj.DFBase = reader.GetFloat(12); } if (!reader.IsDBNull(13)) { obj.RLI = reader.GetFloat(13); } if (!reader.IsDBNull(14)) { obj.HighestInspectionEffectiveness = reader.GetString(14); } if (!reader.IsDBNull(15)) { obj.SecondInspectionEffectiveness = reader.GetString(15); } if (!reader.IsDBNull(16)) { obj.NumberOfInspections = reader.GetInt32(16); } if (!reader.IsDBNull(17)) { obj.LastInspDate = reader.GetDateTime(17); } if (!reader.IsDBNull(18)) { obj.InspDueDate = reader.GetDateTime(18); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public void delete(RW_DAMAGE_MECHANISM obj) { DAL.delete(obj.DMItemID, obj.ID); }