MojErr IntervalSchedule::ToJson(MojObject& rep, unsigned long flags) const
{
    MojErr err;

    if (flags & ACTIVITY_JSON_CURRENT) {
        err = rep.putString(_T("nextStart"),
                            Scheduler::TimeToString(m_nextStart, !m_local).c_str());
        MojErrCheck(err);
    }

    if (m_end != UNBOUNDED) {
        err = rep.putString(_T("end"),
                            Scheduler::TimeToString(m_end, !m_local).c_str());
        MojErrCheck(err);
    }

    if (m_skip) {
        err = rep.putBool(_T("skip"), true);
        MojErrCheck(err);
    }

    if (m_lastFinished != NEVER) {
        err = rep.putString(_T("lastFinished"),
                            Scheduler::TimeToString(m_lastFinished, !m_local).c_str());
        MojErrCheck(err);
    }

    err = rep.putString(_T("interval"), IntervalToString(m_interval).c_str());
    MojErrCheck(err);

    return Schedule::ToJson(rep, flags);
}
Beispiel #2
0
void ScheduleCfg::QueryResponse (QObject *p, const QString &c, int State, QObject*caller) // notify transaction completerequestrt needs the name record added8,repname text, action text,repprint int2);ate text);
{
	if(p != this) return;

	IT_IT("ScheduleCfg::QueryResponse");

	switch (State)
	{
		case tList:
		{
			// fill the name list box
			GetConfigureDb ()->FillComboBox (Name, "NAME");
			GetConfigureDb ()->DoneExec (this);
			Name->setCurrentItem (0);
			SelChanged (0);
			Name->setFocus ();
			//
		};
		break;
		case tItem:
		{
			
			IT_COMMENT("Received User Data");
						//
			// fill the fields 
			// 
			Comment->setText (UndoEscapeSQLText(GetConfigureDb()->GetString ("COMMENT")));
			FrequencyMode->setCurrentItem (GetConfigureDb ()->GetInt ("FREQMODE"));
			Time->setText (IntervalToString(GetConfigureDb ()->GetInt ("TOD")));
			SetComboItem (SamplePointList,
			GetConfigureDb ()->GetString ("TRIGGERPOINT"));
			RelOp->setCurrentItem (GetConfigureDb ()->GetInt ("RELOP"));
			//
			TagList->clear ();
			TagList->insertItem (GetConfigureDb ()->GetString ("TRIGGERTAG"));
			//
			// we should now fetch the tag list for the selected trigger point
			// 
			TriggerValue->setText (GetConfigureDb ()->GetString ("TRIGGERVAL"));
			//
			SetComboItem (ReportList, GetConfigureDb ()->GetString ("REPNAME"));
			//
			PrintReport->setChecked (GetConfigureDb ()->GetBool ("REPPRINT"));
			//
			// Get the action string
			//
			Action->setText(GetConfigureDb ()->GetString("ACTIONS"));
			SetComboItem(ReceipeList,GetConfigureDb()->GetString("RECEIPE"));
			//
			Comment->setFocus ();
			ButtonState (true);
			//
			SpChanged(0);
			//
		};
		return;
		case tTagList:		// 
		{
			QString s = TagList->currentText ();	// should have been set
			TagList->clear ();
			GetConfigureDb ()->FillComboBox (TagList, "TAG");
			//
			if (GetConfigureDb ()->GetNumberResults () > 0)
			{
				SetComboItem (TagList, s);	// put it back as it was
			}
			else
			{
				TagList->insertItem (tr(NONE_STR));
			};
			//
			GetConfigureDb ()->DoneExec (this);	// all done so release
		};
		break;
		case tReportList:		// get the list of reports
		{
			GetConfigureDb ()->FillComboBox (ReportList, "NAME");
			ReportList->insertItem(tr(NONE_STR));
			SetComboItem(ReportList,tr(NONE_STR));
		};
		break;
		case tSamplePointList:	//
		{
			GetConfigureDb ()->FillComboBox (SamplePointList, "NAME");
			SamplePointList->insertItem (tr(NONE_STR));	// the null choice
			SetComboItem(SamplePointList,tr(NONE_STR));
			ButtonState (true);	// the basic field are all set up now
			SelChanged (0);		// get the top of the list - load up first record
		};
		break;
		case tReceipeList:
		{
			GetConfigureDb ()->FillComboBox (ReceipeList, "NAME");
			ReceipeList->insertItem (tr(NONE_STR));	// the null choice
		};
		break;
		case tDelete:
		case tNew:
		case tApply:
		ButtonState (true);
		default:
		break;
	};
};