Ejemplo n.º 1
0
        }       //	MSchedulerLog

        /// <summary>
        /// Parent Constructor
        /// </summary>
        /// <param name="parent">parent</param>
        /// <param name="summary">summary</param>
        public MSchedulerLog(MScheduler parent, String summary)
            : this(parent.GetCtx(), 0, parent.Get_TrxName())
        {
            SetClientOrg(parent);
            SetAD_Scheduler_ID(parent.GetAD_Scheduler_ID());
            SetSummary(summary);
        }       //	MSchedulerLog
Ejemplo n.º 2
0
        protected override void DoWork()
        {
            m_summary = new StringBuilder(m_model.ToString())
                        .Append(" - ");
            MProcess process = m_model.GetProcess();

            //
            try
            {
                //	Explicitly set Environment
                Ctx ctx = m_model.GetCtx();
                ctx.SetAD_Client_ID(m_model.GetAD_Client_ID());
                ctx.SetContext("AD_Client_ID", m_model.GetAD_Client_ID());
                ctx.SetAD_Org_ID(m_model.GetAD_Org_ID());
                ctx.SetContext("AD_Org_ID", m_model.GetAD_Org_ID());
                ctx.SetAD_User_ID(m_model.GetUpdatedBy());
                ctx.SetContext("AD_User_ID", m_model.GetUpdatedBy());
                ctx.SetContext("#SalesRep_ID", m_model.GetUpdatedBy());
                //
                m_trx = Trx.Get("Scheduler");
                String result = m_model.Execute(m_trx);
                m_summary.Append(result);
                m_trx.Commit();
            }
            catch (Exception e)
            {
                if (m_trx != null)
                {
                    m_trx.Rollback();
                }
                log.Log(Level.WARNING, process.ToString(), e);
                m_summary.Append(e.ToString());
            }
            if (m_trx != null)
            {
                m_trx.Close();
            }
            //
            int no = m_model.DeleteLog();

            m_summary.Append("Logs deleted=").Append(no);
            //
            MSchedulerLog pLog = new MSchedulerLog(m_model, m_summary.ToString());

            pLog.SetReference("#" + (_runCount.ToString())
                              + " - " + TimeUtil.FormatElapsed(VAdvantage.Classes.CommonFunctions.CovertMilliToDate(_startWork)));
            pLog.Save();
        }