public void add(InspectionPlant insp) { inspUtils.add(insp.ItemNo, insp.DamageMechanism, insp.Method, insp.Coverage, insp.Availability, insp.LastInspectionDate, insp.InspectionInterval, insp.DueDate, insp.System); }
public List <InspectionPlant> GetListInspectionPlant() { List <InspectionPlant> lstInsp = new List <InspectionPlant>(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "SELECT ID, DMItemID, LastInspDate, InspDueDate FROM [rbi].[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) { InspectionPlant ins = new InspectionPlant(); if (!reader.IsDBNull(0)) { ins.IDProposal = reader.GetInt32(0); } if (!reader.IsDBNull(1)) { ins.DMItemID = reader.GetInt32(1); } if (!reader.IsDBNull(2)) { ins.LastInspectionDate = reader.GetDateTime(2).ToString(); } if (!reader.IsDBNull(3)) { ins.DueDate = reader.GetDateTime(3).ToString(); } lstInsp.Add(ins); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(lstInsp); }
public void edit(InspectionPlant insp, String olderDamageMechanism, String olderMethod, String olderItemNo) { inspUtils.edit(insp.ItemNo, insp.DamageMechanism, insp.Method, insp.Coverage, insp.Availability, insp.LastInspectionDate, insp.InspectionInterval, insp.DueDate, insp.System, olderDamageMechanism, olderMethod, olderItemNo); }
public List <InspectionPlant> loads() { List <InspectionPlant> listEq = new List <InspectionPlant>(); MySqlConnection conn = DBUtils.getDBConnection(); conn.Open(); String sql = "SELECT * FROM tbl_inspectionplan"; try { MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { insp = new InspectionPlant(); insp.System = reader.GetString(0); insp.DamageMechanism = reader.GetString(1); insp.Method = reader.GetString(2); insp.Coverage = reader.GetString(3); insp.Availability = reader.GetString(4); insp.LastInspectionDate = reader.GetString(5); insp.InspectionInterval = reader.GetString(6); insp.DueDate = reader.GetString(7); insp.ItemNo = reader.GetString(8); listEq.Add(insp); } } } } catch { MessageBox.Show("Load data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.Close(); conn.Dispose(); } return(listEq); }
public void delete(InspectionPlant insp) { inspUtils.delete(insp.DamageMechanism, insp.Method, insp.ItemNo); }