Exemple #1
0
        /// <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 = eventRptCondDao.getRptCond(conn, ceid);
                if (cond != null)
                {
                    cond.ENABLE_FLG = (isEnable ? SCAppConstants.YES_FLAG : SCAppConstants.NO_FLAG);
                    eventRptCondDao.updateRptCond(conn, cond);
                }
                else
                {
                    cond = new AEVENTRPTCOND()
                    {
                        CEID       = ceid.Trim(),
                        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);
        }