/// <summary>
        /// Enables the event report.
        /// </summary>
        /// <param name="ceid">The ceid.</param>
        /// <param name="isEnable">The is enable.</param>
        public bool enableEventReport(string ceid, Boolean isEnable)
        {
            bool            isSuccess = true;
            DBConnection_EF conn      = null;

            try
            {
                conn = DBConnection_EF.GetContext();
                conn.BeginTransaction();
                AEVENTRPTCOND cond = new AEVENTRPTCOND()
                {
                    CEID       = ceid.Trim(),
                    ENABLE_FLG = (isEnable ? SCAppConstants.YES_FLAG : SCAppConstants.NO_FLAG)
                };
                eventRptCondDao.updateRptCond(conn, cond);
                conn.Commit();
            }
            catch (Exception ex)
            {
                isSuccess = false;
                if (conn != null)
                {
                    try { conn.Rollback(); } catch (Exception ex_rollback) { logger.Error(ex_rollback, "Exception"); }
                }
                logger.Error(ex, "Exception");
            }
            finally
            {
                if (conn != null)
                {
                    try { conn.Close(); } catch (Exception ex_close) { logger.Error(ex_close, "Exception"); }
                }
            }
            return(isSuccess);
        }
Esempio n. 2
0
 /// <summary>
 /// Updates the RPT cond.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="cond">The cond.</param>
 public void updateRptCond(DBConnection_EF conn, AEVENTRPTCOND cond)
 {
     try
     {
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Inserts the RPT cond.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="cond">The cond.</param>
 public void insertRptCond(DBConnection_EF conn, AEVENTRPTCOND cond)
 {
     try
     {
         conn.AEVENTRPTCOND.Add(cond);
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Gets the RPT cond.
        /// </summary>
        /// <param name="conn">The connection.</param>
        /// <param name="readLock">The read lock.</param>
        /// <param name="ceid">The ceid.</param>
        /// <returns>EventRptCond.</returns>
        public AEVENTRPTCOND getRptCond(DBConnection_EF conn, string ceid)
        {
            AEVENTRPTCOND cond = null;

            try
            {
                var query = from rptid in conn.AEVENTRPTCOND
                            where rptid.CEID == ceid.Trim()
                            select rptid;
                cond = query.SingleOrDefault();
            }
            catch (Exception ex)
            {
                logger.Warn(ex);
                throw;
            }
            return(cond);
        }
        /// <summary>
        /// Enables all event report.
        /// </summary>
        /// <param name="isEnable">The is enable.</param>
        public bool enableAllEventReport(Boolean isEnable)
        {
            bool            isSuccess = true;
            DBConnection_EF conn      = null;

            try
            {
                conn = DBConnection_EF.GetUContext();
                conn.BeginTransaction();
                eventRptCondDao.deleteAllRptCond(conn);

                string[] ceidArray = SECSConst.CEID_ARRAY;
                for (int i = 0; i < ceidArray.Length; i++)
                {
                    AEVENTRPTCOND cond = new AEVENTRPTCOND()
                    {
                        CEID       = ceidArray[i],
                        ENABLE_FLG = isEnable ? SCAppConstants.YES_FLAG : SCAppConstants.NO_FLAG
                    };
                    eventRptCondDao.insertRptCond(conn, cond);
                }


                conn.Commit();
            }
            catch (Exception ex)
            {
                isSuccess = false;
                if (conn != null)
                {
                    try { conn.Rollback(); } catch (Exception ex_rollback) { logger.Error(ex_rollback, "Exception"); }
                }
                logger.Error(ex, "Exception");
            }
            finally
            {
                if (conn != null)
                {
                    try { conn.Close(); } catch (Exception ex_close) { logger.Error(ex_close, "Exception"); }
                }
            }
            return(isSuccess);
        }
        /// <summary>
        /// Determines whether [is enable report] [the specified ceid].
        /// </summary>
        /// <param name="ceid">The ceid.</param>
        /// <returns>Boolean.</returns>
        public Boolean isEnableReport(string ceid)
        {
            Boolean         isEnable = false;
            DBConnection_EF conn     = null;

            try
            {
                conn = DBConnection_EF.GetContext();
                conn.BeginTransaction();
                AEVENTRPTCOND cond = eventRptCondDao.getRptCond(conn, ceid);
                if (cond == null)
                {
                    isEnable = true;
                }
                else
                {
                    isEnable = BCFUtility.isMatche(cond.ENABLE_FLG, SCAppConstants.YES_FLAG);
                }
                conn.Commit();
            }
            catch (Exception ex)
            {
                if (conn != null)
                {
                    try { conn.Rollback(); } catch (Exception ex_rollback) { logger.Error(ex_rollback, "Exception"); }
                }
                logger.Error(ex, "Exception");
                return(isEnable);
            }
            finally
            {
                if (conn != null)
                {
                    try { conn.Close(); } catch (Exception ex_close) { logger.Error(ex_close, "Exception"); }
                }
            }
            return(isEnable);
        }