Exemplo n.º 1
0
int retreiver::run() {
	LOG4CXX_INFO("Entering thread.");
	int count = 0;
	bool offline = false;
	bool duplicates = true;
	bool savecopy = true;

	m_itemindex = 0;
	m_batch = 1;
	time(&m_then);
	while(runable() == true) {
		if(offline == true) {
			if((m_msg = on_nextcopy()) != NULL) { // pull from buffer
				if(duplicates == true)
					insertitem(m_msg); // re-insert a new copy
				postmessage(PROC_RETR, EV_DATA, count++, (long int)m_msg);
				continue;
			}
			if(duplicates == true)
				insertitem(NULL); // insert an END
		} else {
			m_itemindex++;
			if((m_msg = on_nextrecord()) != NULL) { // pull from database
				if(savecopy == true)
					insertitem(m_msg); // insert copy into buffer
				postmessage(PROC_RETR, EV_DATA, count++, (long int)m_msg);
				continue;
			}
			insertitem(NULL); // insert an END
		}

		offline = true;
		if((m_batch%m_modpoint) == 0) {
			offline = false;
			clearbuffer();
			m_itemindex = 0;
		}

		if(m_singlestep == 1) // singlestep used for debugging
			break;

		ondelay(count, offline);
		if(queuewait(count) == true)
			time(&m_then);

		count = 0;
		if(m_batch++ > 999999) { // rollover
			m_batch = 0;
			m_overloaded = 1;
		}
	}
	LOG4CXX_INFO("Exiting thread.");
	return 0;
}
Exemplo n.º 2
0
//
//建立新工程
//
void newproject::OnAddnewproject()
{
    BOOL bRet;
    CString OldPrjID;

    UpdateData(TRUE);

    m_str4=_T("");
    newpro=1;

    GetDlgItem(IDC_BUTTON_new)->EnableWindow(FALSE);
    GetDlgItem(IDC_DELETESELECTPROJECT)->EnableWindow(FALSE);

    OldPrjID=EDIBgbl::SelPrjID;
    EDIBgbl::SelPrjID=m_eng_code;   //把EDIBgbl::SelPrjID的值付成新建工程的工程编号

    UpdateData(TRUE);//zsy pd

    bRet=insertitem();    //调用函数,插入新工程的数据
    OnUpdateState();

    //如果新建工程成功关闭对话框
    if(bRet)
    {
        //在标题栏上显示当前的工程名
        ((CMainFrame*)::AfxGetMainWnd())->ShowCurrentProjectName();
        OnOK();
    }
    else
    {
        //在标题栏上显示当前的工程名
        EDIBgbl::SelPrjID=OldPrjID;
        ((CMainFrame*)::AfxGetMainWnd())->ShowCurrentProjectName();
    }
}
Exemplo n.º 3
0
//
//套用工程
//
void newproject::OnBUTTONnew()
{
    BOOL bRet;
    CString OldPrjID;

    m_str4.TrimLeft();
    if(m_str4==_T(""))
    {
        return;   //说明没有选择可套用的工程返回
    }

    newpro=0;

    UpdateData(TRUE);

    OldPrjID=EDIBgbl::SelPrjID;
    EDIBgbl::SelPrjID=m_eng_code;   //把EDIBgbl::SelPrjID的值付成新建工程的工程编号

    UpdateData(TRUE);  //zsy pd

    bRet=insertitem();    //调用函数,插入新工程的数据
    OnUpdateState();

    //如果新建工程成功关闭对话框
    if(bRet)
    {
        //在标题栏上显示当前的工程名
        ((CMainFrame*)::AfxGetMainWnd())->ShowCurrentProjectName();
        OnOK();
    }
    else
    {
        //在标题栏上显示当前的工程名
        ((CMainFrame*)::AfxGetMainWnd())->ShowCurrentProjectName();
        EDIBgbl::SelPrjID=OldPrjID;
    }
}