public List <RW_INSPECTION_HISTORY> getListInsp(String path) { List <RW_INSPECTION_HISTORY> list = new List <RW_INSPECTION_HISTORY>(); OleDbConnection conn = getConnect(path); try { conn.Open(); String sql = "SELECT * FROM [Inspections$] "; OleDbCommand cmd = new OleDbCommand(sql, conn); OleDbDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { if (reader.HasRows) { if (!(reader.IsDBNull(2) || reader.IsDBNull(3) || reader.IsDBNull(4) || reader.IsDBNull(6))) { obj = new RW_INSPECTION_HISTORY(); //obj.ID = 1; obj.InspectionPlanName = reader[0].ToString(); obj.InspectionCoverageName = reader[1].ToString(); obj.EquipmentNumber = reader[2].ToString(); obj.ComponentNumber = reader[3].ToString(); obj.DM = reader[4].ToString(); obj.InspectionType = reader[5].ToString(); try { obj.InspectionDate = Convert.ToDateTime(reader[6].ToString()); } catch { obj.InspectionDate = DateTime.Now; } try { obj.InspectionEffective = reader[7].ToString(); } catch { obj.InspectionEffective = "E"; } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show("ERROR!" + e.ToString()); } finally { conn.Close(); conn.Dispose(); } return(list); }
public List <RW_INSPECTION_HISTORY> getDataComp(String CompNum) { List <RW_INSPECTION_HISTORY> list = new List <RW_INSPECTION_HISTORY>(); RW_INSPECTION_HISTORY obj = null; SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "SELECT [ID]" + ",[InspectionPlanName] " + ",[InspectionCoverageName]" + ",[EquipmentNumber]" + ",[ComponentNumber]" + ",[DM]" + ",[InspectionType]" + ",[InspectionDate]" + ",[InspectionEffective]" + " FROM [rbi].[dbo].[RW_INSPECTION_HISTORY] WHERE [ComponentNumber] ='" + CompNum + "'"; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_INSPECTION_HISTORY(); obj.ID = reader.GetInt32(0); obj.InspectionPlanName = reader.GetString(1); obj.InspectionCoverageName = reader.GetString(2); obj.EquipmentNumber = reader.GetString(3); obj.ComponentNumber = reader.GetString(4); obj.DM = reader.GetString(5); obj.InspectionType = reader.GetString(6); obj.InspectionDate = reader.GetDateTime(7); obj.InspectionEffective = reader.GetString(8); list.Add(obj); } } } } catch { // do nothing } finally { conn.Close(); conn.Dispose(); } return(list); }
private List <RW_INSPECTION_HISTORY> getData() { RW_INSPECTION_HISTORY_BUS busInspHis = new RW_INSPECTION_HISTORY_BUS(); List <RW_INSPECTION_HISTORY> listInspHis = busInspHis.getDataSource(); List <RW_INSPECTION_HISTORY> listData = new List <RW_INSPECTION_HISTORY>(); EQUIPMENT_MASTER_BUS busEqMaster = new EQUIPMENT_MASTER_BUS(); SITES_BUS busSite = new SITES_BUS(); FACILITY_BUS busFacility = new FACILITY_BUS(); foreach (RW_INSPECTION_HISTORY inspHis in listInspHis) { String eqNumber = inspHis.EquipmentNumber; int eqID = busEqMaster.getIDbyNumber(inspHis.EquipmentNumber); RW_INSPECTION_HISTORY rwInspHis = inspHis; rwInspHis.SiteName = busSite.getSiteName(busEqMaster.getSiteID(eqID)); rwInspHis.FacilityName = busFacility.getFacilityName(busEqMaster.getFacilityID(eqID)); listData.Add(rwInspHis); } return(listData); }
public Boolean checkExist(RW_INSPECTION_HISTORY obj) { return(DAL.checkExist(obj.ComponentNumber, obj.DM, obj.InspectionDate)); }
public void delete(RW_INSPECTION_HISTORY obj) { DAL.delete(obj.ID); }
public void edit(RW_INSPECTION_HISTORY obj) { DAL.edit(obj.ID, obj.InspectionPlanName, obj.InspectionCoverageName, obj.EquipmentNumber, obj.ComponentNumber, obj.DM, obj.InspectionType, obj.InspectionDate, obj.InspectionEffective); }