Ejemplo n.º 1
0
        /// <summary>
        /// Gets ILC status data
        /// </summary>
        /// <returns>IlcStatusData object</returns>
        public static IlcStatusData GetStatusData()
        {
            IlcStatusData data = new IlcStatusData();

            using (DbConnection connection = new OracleConnection(WebSettings.GetConnectionString()))
            {
                connection.Open();

                using (DbCommand cmd = connection.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText =
                        "WITH STAT AS (SELECT FINISHED, COUNT(1) AS CNT FROM (SELECT  DECODE(STATUS, 'SUCCEEDED', 1, 'FAILED', 1, 'AWAITING', DECODE(ATTEMPTS, (SELECT MAX_ATTEMPTS FROM " +
                        schemaName + ".ILC_INSTANCE), 1, 0), 0) AS FINISHED FROM " + schemaName + ".SERVICE_VERIFICATION INNER JOIN " +
                        schemaName + ".SERVICE_VERIFICATION_SESSION ON SERVICE_VERIFICATION.REPORT_ID=SERVICE_VERIFICATION_SESSION.REPORT_ID AND SERVICE_VERIFICATION_SESSION.IS_REPORTED=0) S GROUP BY FINISHED) " +
                        "SELECT START_TIME, IS_REPORTED, NVL((SELECT CNT FROM STAT WHERE FINISHED=0), 0) AS REMAINING, NVL((SELECT CNT FROM STAT WHERE FINISHED=1), 0) AS FINISHED FROM " +
                        schemaName + ".SERVICE_VERIFICATION_SESSION";

                    using (DbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            data.lastCheckDate = (DateTime)reader[0];
                            int remained = Convert.ToInt32(reader[2]);
                            int passed   = Convert.ToInt32(reader[3]);
                            data.currServiceState = (Convert.ToInt32(reader[1]) == 0) ? "Working: " + passed + " out of " + (passed + remained) + "..."
                                                                                      : ConstExpressions.WORK_STATUS_IDLE;
                        }
                    }
                }
            }

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// returns initial QuickCheck button disabled status
        /// </summary>
        /// <returns>disabled or not</returns>
        public static string GetInitialQuickCheckStatus()
        {
            string status = StatusHandler.GetServiceStatus();

            if (status != ConstExpressions.SERVICE_STATUS_STARTED)
            {
                return("Disabled");
            }

            IlcStatusData data = IlcWebDao.GetStatusData();

            return(data.currServiceState == ConstExpressions.WORK_STATUS_IDLE ? "" : "Disabled");
        }
Ejemplo n.º 3
0
        private static string GetServiceInfo()
        {
            IlcStatusData data = IlcWebDao.GetStatusData();

            string status = GetServiceStatus();

            if (status != ConstExpressions.SERVICE_STATUS_STARTED)
            {
                data.currServiceState = ConstExpressions.WORK_STATUS_IDLE;
            }

            return(string.Format("{0},{1},{2},{3}",
                                 status, data.lastCheckDate, data.currServiceState, DateTime.Now));
        }
Ejemplo n.º 4
0
 protected static string Field(IlcStatusData data, FieldCallback accessor)
 {
     return(data == null ? "Error!" : accessor(data).ToString());
 }