/// <summary>
        /// Sets the summary from database
        /// </summary>
        /// <param name="pi">ProcessInfo object</param>
        public static void SetSummaryFromDB(ProcessInfo pi)
        {
            int sleepTime = 2000;   //	2 secomds
            int noRetry   = 5;      //  10 seconds total
            //
            String sql = "SELECT Result, ErrorMsg FROM AD_PInstance "
                         + "WHERE AD_PInstance_ID=@instanceid"
                         + " AND Result IS NOT NULL";
            IDataReader dr = null;

            try
            {
                SqlParameter[] param = new SqlParameter[1];
                for (int noTry = 0; noTry < noRetry; noTry++)
                {
                    param[0] = new SqlParameter("@instanceid", pi.GetAD_PInstance_ID());
                    dr       = DataBase.DB.ExecuteReader(sql, param, null);
                    while (dr.Read())
                    {
                        //	we have a result
                        int i = Utility.Util.GetValueOfInt(dr[0].ToString());
                        if (i == 1)
                        {
                            pi.SetSummary(Msg.GetMsg(Env.GetContext(), "Success", true));
                        }
                        else
                        {
                            pi.SetSummary(Msg.GetMsg(Env.GetContext(), "Failure", true));
                        }

                        String Message = dr[1].ToString();
                        dr.Close();
                        //
                        if (Message != null)
                        {
                            if (Message != "")
                            {
                                pi.AddSummary("  (" + Utility.Msg.ParseTranslation(Utility.Env.GetContext(), Message) + ")");
                            }
                        }
                        return;
                    }

                    dr.Close();
                    //	sleep
                    try
                    {
                        Thread.Sleep(sleepTime);
                    }
                    catch (Exception ie)
                    {
                        if (dr != null)
                        {
                            dr.Close();
                        }
                        _log.Log(Level.SEVERE, "Sleep Thread", ie);
                    }
                }
            }
            catch (SqlException e)
            {
                if (dr != null)
                {
                    dr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
                pi.SetSummary(e.Message, true);
                return;
            }
            pi.SetSummary(Msg.GetMsg(Env.GetContext(), "Timeout", true));
        }       //	setSummaryFromDB