/// <summary> /// Updates the crate. /// </summary> /// <param name="conn">The connection.</param> /// <param name="crt">The CRT.</param> public void updateCrate(DBConnection_EF conn, ACRATE crt) { try { conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }
/// <summary> /// Inserts the crate. /// </summary> /// <param name="conn">The connection.</param> /// <param name="crt">The CRT.</param> public void insertCrate(DBConnection_EF conn, ACRATE crt) { try { conn.ACRATE.Add(crt); conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }
/// <summary> /// Gets the crate. /// </summary> /// <param name="conn">The connection.</param> /// <param name="readLock">The read lock.</param> /// <param name="crate_id">The crate_id.</param> /// <returns>Crate.</returns> public ACRATE getCrate(DBConnection_EF conn, Boolean readLock, string crate_id) { ACRATE rtnCRT = null; try { var query = from crate in conn.ACRATE where crate.CRATE_ID == crate_id.Trim() select crate; rtnCRT = query.SingleOrDefault(); } catch (Exception ex) { logger.Warn(ex); throw; } return(rtnCRT); }
/// <summary> /// Deletes the crate. /// </summary> /// <param name="conn">The connection.</param> /// <param name="crate_id">The crate_id.</param> public void deleteCrate(DBConnection_EF conn, string crate_id) { ACRATE deleteCRT = null; try { var query = from crate in conn.ACRATE where crate.CRATE_ID == crate_id.Trim() select crate; deleteCRT = query.FirstOrDefault(); conn.ACRATE.Remove(deleteCRT); conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }