public bool enableAlarmReport(string alarm_id, Boolean isEnable) { bool isSuccess = true; try { string enable_flag = (isEnable ? SCAppConstants.YES_FLAG : SCAppConstants.NO_FLAG); using (DBConnection_EF con = DBConnection_EF.GetUContext()) { ALARMRPTCOND cond = null; cond = alarmRptCondDao.getRptCond(con, alarm_id); if (cond != null) { cond.ENABLE_FLG = enable_flag; alarmRptCondDao.insertRptCond(con, cond); } else { cond = new ALARMRPTCOND() { ALAM_CODE = alarm_id, ENABLE_FLG = enable_flag }; alarmRptCondDao.insertRptCond(con, cond); } } } catch (Exception ex) { isSuccess = true; logger.Error(ex, "Exception"); } return(isSuccess); }
public virtual bool enableAllAlarmReport(Boolean isEnable) { bool isSuccess = true; try { using (DBConnection_EF con = DBConnection_EF.GetUContext()) { alarmRptCondDao.deleteAllRptCond(con); List <AlarmMap> alarmMaps = loadAlarmMaps(); foreach (AlarmMap alarmMap in alarmMaps) { ALARMRPTCOND cond = new ALARMRPTCOND() { ALAM_CODE = alarmMap.ALARM_ID, EQPT_ID = alarmMap.EQPT_REAL_ID, ENABLE_FLG = (isEnable ? SCAppConstants.YES_FLAG : SCAppConstants.NO_FLAG) }; alarmRptCondDao.insertRptCond(con, cond); } } } catch (Exception ex) { isSuccess = true; logger.Error(ex, "Exception"); } return(isSuccess); }
/// <summary> /// Updates the RPT cond. /// </summary> /// <param name="conn">The connection.</param> /// <param name="cond">The cond.</param> public void updateRptCond(DBConnection_EF conn, ALARMRPTCOND cond) { try { conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }
/// <summary> /// Inserts the RPT cond. /// </summary> /// <param name="conn">The connection.</param> /// <param name="cond">The cond.</param> public void insertRptCond(DBConnection_EF conn, ALARMRPTCOND cond) { try { conn.ALARMRPTCOND.Add(cond); conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }
/// <summary> /// Gets the RPT cond. /// </summary> /// <param name="conn">The connection.</param> /// <param name="readLock">The read lock.</param> /// <param name="eqpt_id">The eqpt_id.</param> /// <param name="alarm_code">The alarm_code.</param> /// <returns>AlarmRptCond.</returns> public ALARMRPTCOND getRptCond(DBConnection_EF conn, string alarm_code) { ALARMRPTCOND cond = null; try { var query = from rptCond in conn.ALARMRPTCOND where rptCond.ALAM_CODE == alarm_code.Trim() select rptCond; cond = query.SingleOrDefault(); } catch (Exception ex) { logger.Warn(ex); throw; } return(cond); }