Example #1
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 刷新时间
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEccGenTitle::refreshTime()
{
    if(m_pTime)
    {
         TTime ttime =  TTime::GetCurrentTimeEx();
        m_pTime->setText(SVResString::getResString("IDS_Refresh_Time") + ttime.Format());
    }
}
Example #2
0
CHZDLReport::CHZDLReport(TTime starttime, TTime endtime, WContainerWidget *parent):
	WTable(parent)
{
	m_starttime = starttime;
	m_endtime = endtime;

	//生成xml文件的名字
	szXSLReportName = "HZDL";
	szXSLReportName += starttime.Format();
	szXSLReportName += endtime.Format();
	replace_all_distinct(szXSLReportName, ":", "");
	replace_all_distinct(szXSLReportName, " ", "");
	replace_all_distinct(szXSLReportName, ".", "");
	replace_all_distinct(szXSLReportName, "-", "");
	replace_all_distinct(szXSLReportName, "\\", "");
	replace_all_distinct(szXSLReportName, "/", "");
	szXSLReportName += ".xls";

	initForm();
}
Example #3
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 初始化
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEccGenTitle::initForm()
{
    m_pTitle = new WTable(elementAt(0, 0));
    if(m_pTitle)
    {
        m_pTitle->setStyleClass("padding_2");
        m_pTime = new WText("refresh time", m_pTitle->elementAt(0, 1));
        if(m_pTime)
        {
             TTime ttime =  TTime::GetCurrentTimeEx();
            m_pTime->setText(SVResString::getResString("IDS_Refresh_Time") + ttime.Format());
        }
        m_pTitle->elementAt(0, 1)->setStyleClass("width40p");
        m_pTitle->elementAt(0, 1)->setContentAlignment(AlignRight | AlignTop);
    }

    elementAt(0, 0)->setStyleClass("padding_top");
}
Example #4
0
void CTuopList::EditReturn(int keyCode)
{
	string strUserID = GetWebUserID();

	HitLog LogItem;
	LogItem.sUserName = strUserID;
	LogItem.sHitPro = "TuopList";
	LogItem.sHitFunc = "EditReturn";
	LogItem.sDesc = strReturnSave;

	DWORD dcalBegin=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0);

//	OutputDebugString("EditReturn\n");
	if(keyCode == 13)
	{	
		char buf[1024];
		memset(buf, 0, 1023);
		string str = pCurrEditUserName->text();
		sprintf(buf, "%s", str.c_str());
		
//		OutputDebugString(buf);
		std::list<string> keylist;
		std::list<string>::iterator itemkey;
	#ifdef	 Tuopu
		bool bret = GetIniFileKeys("filename", keylist, "tuopfile.ini");
	#else
		bool bret = GetIniFileKeys("filename", keylist, "maintainfile.ini");
	#endif

		if(!bret)
		{
			//
		}
		
		bool bExist1 = true;
		std::string sVal = "";
		std::string defaultret = "error";
		std::string sret = "";
		
		//此名字是否已经存在?
		for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++)
		{
			sVal = *itemkey;
		#ifdef	 Tuopu
			sret = GetIniFileString("filename", sVal, defaultret, "tuopfile.ini");
		#else
			sret = GetIniFileString("filename", sVal, defaultret, "maintainfile.ini");
		#endif				
			
			if(strcmp(sret.c_str(), bStrCurr.c_str()) == 0)
			{
				continue;
			}

			if(strcmp(sret.c_str(), str.c_str()) == 0)
			{
				bExist1 = false;
			}
		}
//		OutputDebugString("befor bExtit1\n");
		
		if(bExist1)
		{
			for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++)
			{
				sVal = *itemkey;

			#ifdef	 Tuopu
				sret = GetIniFileString("filename", sVal, defaultret, "tuopfile.ini");
			#else
				sret = GetIniFileString("filename", sVal, defaultret, "maintainfile.ini");
			#endif
				
				if(strcmp(sret.c_str(), bStrCurr.c_str()) == 0)
				{
//					OutputDebugString("befor write1\n");
				#ifdef	 Tuopu
					WriteIniFileString("filename", sVal, str, "tuopfile.ini");
				#else
					WriteIniFileString("filename", sVal, str, "maintainfile.ini");
				#endif

					break;
				}				
			}

			string strOpen;

			strOpen = "<a href=./showtuopu.exe?pageid=";
			strOpen += ReplaceStdString(sVal, ".htm", "");
		#ifdef	 Tuopu
			strOpen += "&version=0";
		#else
			strOpen += "&version=0&usrleader=0&maintain=1";
		#endif
			strOpen += " target=_blank>";
			strOpen += buf;
			strOpen += "</a>";
			
			pCurrName->setText(strOpen.c_str());
			pCurrName->show();		
			
			pCurrEditUserName->hide();

			//插记录到UserOperateLog表
			string strUserID = GetWebUserID();
			TTime mNowTime = TTime::GetCurrentTimeEx();
			OperateLog m_pOperateLog;
			m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),strEditTip,strMainTitle,buf);
		}
		else
		{
			WebSession::js_af_up = "alert('";
			WebSession::js_af_up += "have same name tuop";
			WebSession::js_af_up += "')";
		}
	}

	DWORD dcalEnd1=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin);
}
Example #5
0
//删除操作
void CTuopList::DelUser()
{
	string strUserID = GetWebUserID();

	HitLog LogItem;
	LogItem.sUserName = strUserID;
	LogItem.sHitPro = "TuopList";
	LogItem.sHitFunc = "DelUser";
	LogItem.sDesc = strDeleteType;

	DWORD dcalBegin=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0);

	string strDeleteTuop;

	for(m_pRecordList = RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList++)
    {       
        if (m_pRecordList->pCheckBox->isChecked())
        {			
			std::string sVal = m_pRecordList->strBackName;
			std::string sVsd = ReplaceStdString(sVal, ".htm", ".vsd");
			std::string sDiretory = ReplaceStdString(sVal, ".htm", ".files");

		#ifdef	 Tuopu
			DeleteIniFileKey("filename", sVal, "tuopfile.ini");
			DeleteIniFileKey("filename", sVsd, "tuopfile.ini");
		#else
			std::string sName = ReplaceStdString(m_pRecordList->strBackName, ".htm", "");
			DeleteIniFileKey("filename", sVal, "maintainfile.ini");
			DeleteIniFileKey("filename", sVsd, "maintainfile.ini");
			DeleteIniFileSection(sName, "maintain.ini");
		#endif			

			//std::string filepath = "C:\\Program Files\\Apache Group\\apache2\\htdocs\\tuoplist\\";			
			//删除了拓扑图  序号怎么变?---》是直接删除呢? 还是要加把其他的序号都整理一遍?---》或者把大于它的序号都减1即可。
			DelSortId(sVsd);

			string strDelDir;
		#ifdef	 Tuopu
			std::string filepath = GetSiteViewRootPath() + "\\htdocs\\tuoplist\\";
			
			filepath += sVal;
			
			bool bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}
		#else
			std::string filepath = GetSiteViewRootPath() + "\\htdocs\\maintainlist\\";
			std::string fileleaderpath = GetSiteViewRootPath() + "\\htdocs\\maintainleaderlist\\";
			strDelDir = GetSiteViewRootPath() + "\\htdocs\\maintainlist\\";

			filepath += sVal;			
			
			bool bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}

			fileleaderpath += sVal;
			
			bret = DeleteFile(fileleaderpath.c_str());
			if(!bret)
			{
				//
			}

			strDelDir += sDiretory;

			//DeleteDirectory(strDelDir);
		#endif			
			


		#ifdef	 Tuopu
			filepath = GetSiteViewRootPath() + "\\htdocs\\tuoplist\\";

			filepath += sVsd;
			
			bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}

		#else
			filepath = GetSiteViewRootPath() + "\\htdocs\\maintainlist\\";
			fileleaderpath = GetSiteViewRootPath() + "\\htdocs\\maintainleaderlist\\";

			filepath += sVsd;
			
			bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}

			fileleaderpath += sVsd;
			
			bret = DeleteFile(fileleaderpath.c_str());
			if(!bret)
			{
				//
			}

		#endif			


			//files目录是否也删除

            int nRow = ((WTableCell*)(m_pRecordList->pCheckBox->parent()))->row();
        
            list<OneRecord>::iterator pItem = m_pRecordList;
        
            m_pRecordList --;
        
			std::string temp = pItem->pstrUserName->text();		
			int pos = temp.find(">", 0);
			int pos1 = temp.find("<", pos);
			string strTemp = temp.substr(pos + 1, pos1 - pos - 1);			
 			strDeleteTuop += strTemp;
			strDeleteTuop += "  ";

			RecordList.erase(pItem);          
        
            m_pTopologyListTable->GeDataTable()->deleteRow(nRow); 						
        }
    }

	//列表为空
	if(RecordList.size() <= 0)
	{
		m_pTopologyListTable->ShowNullTip();
	}
	else
	{
		m_pTopologyListTable->HideNullTip();
	}

	//插记录到UserOperateLog表
	TTime mNowTime = TTime::GetCurrentTimeEx();
	OperateLog m_pOperateLog;
	m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),strDeleteType,strMainTitle,strDeleteTuop);

	DWORD dcalEnd1=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin);
}
Example #6
0
void CAlertMain::DoReceive()
{
	bool bStop = false;
	CAlertEventObj * lastEventobj = NULL;

	while(!bStop)
	{
		//printf("DoReceive:");
		::Sleep(50);
		//接收到m_AlertEventList

		//if(!waitlistmutex->test())
		//{
		//	continue;
		//}

		MQRECORD mrd;

		mrd=::BlockPopMessage("SiteView70-Alert");

		
		if(mrd!=INVALID_VALUE)
		{
			//puts("Pop message failed");

			string label;
			TTime ct;
			unsigned int len=0;

			if(!::GetMessageData(mrd, label, ct, NULL, len))
			{
				OutputDebugString("Get message data failed");
				//::CloseMQRecord(mrd);
				//waitlistmutex->leave();
				//continue;
			}

			//printf("Data len is :%d\n",len);
			char * buf = NULL;
			buf = new char[len];

			if(!::GetMessageData(mrd, label, ct, buf, len))
			{
				OutputDebugString("Get message data failed");
				//::CloseMQRecord(mrd);
				//waitlistmutex->leave();
				//continue;
			}			

			
			::CloseMQRecord(mrd);
			

			//OutputDebugString(label.c_str());
			//OutputDebugString("\n");
			if(label == "SmsTest")
			{
				//测试短信发送
				OutputDebugString("Get message From SmsTest:\n");
				OutputDebugString(buf);

				string szSmsTo = "";
				szSmsTo += buf;
				std::list<string> listSms;
				std::list<string>::iterator listSmsItem;
				
				CAlertMain::ParserToken(listSms, szSmsTo.c_str(), ",");
				bool bSucess = false;
				bool bAllSucess = true;
				for(listSmsItem = listSms.begin(); listSmsItem!=listSms.end(); listSmsItem++)
				{
					CString strSmsTo = (*listSmsItem).c_str();

					CAlertMain::SendSmsFromComm(strSmsTo, " This is a Test3");	
				}

				//CAlertMain::SendSmsFromComm(buf, " This is a Test2");
				//continue;
			}
			else if(label == "IniChange")
			{
				#ifdef AddOnEventSever				
				::PushMessage("EventSeverInputQueue", label, buf, len); //导出事件到EventSever记录队列 
				#endif

				//OutputDebugString(label.c_str());
				//OutputDebugString("\n");

				//配置文件发生变化
				string strIniName, strSection, strOperate;
				std::list<string> listIniParam;
				std::list<string>::iterator listIniParamItem;
				
				CAlertMain::ParserToken(listIniParam, buf, ",");
				
				strIniName = listIniParam.front();
				listIniParam.pop_front();
				strSection = listIniParam.front();
				listIniParam.pop_front();
				strOperate = listIniParam.front();				
				listIniParam.pop_front();

				OutputDebugString(strIniName.c_str());
				OutputDebugString("\n");
				OutputDebugString(strSection.c_str());
				OutputDebugString("\n");
				OutputDebugString(strOperate.c_str());
				OutputDebugString("\n");
				
				//进入临界区
				if(!waitlistmutex->test())
				{
					continue;
				}

				
				if(strIniName == "alert.ini")
				{
					//alert.ini	
					if(strOperate == "ADD")
					{
						//ADD
						ReadAlertObjFromIni(strSection);
					}
					else if(strOperate == "DELETE")
					{
						//DELETE
						DeleteAlertObjFromSection(strSection);
					}
					else
					{
						//EDIT UPDATE
						DeleteAlertObjFromSection(strSection);
						ReadAlertObjFromIni(strSection);
					}
				}
				else if(strIniName == "smsconfig.ini")
				{
					//smsconfig.ini
					//是否比较一下?...
					CAlertMain::CloseSerialPort();
					bInitSerialPort = CAlertMain::InitSerialPort();
				}
				else
				{
					
				}

				//退出临界区
				waitlistmutex->leave();
			}
			else
			{
				if(label != "alertlogs")
				{
					//事件
					SVDYN dyn;
					if(!BuildDynByData(buf, len, dyn))
					{
						//waitlistmutex->leave();
						//delete buf;
						//continue;			
					}

					event = new CAlertEventObj();

					event->strMonitorId = label;
					event->strEventDes = dyn.m_displaystr;
					event->nEventType = dyn.m_state;
					event->nEventCount = dyn.m_laststatekeeptimes;
					event->strTime = ct.Format();

					//苏合 2008-02-13
					typedef pair <string, int> Int_Pair; 
					map <string, int>::iterator tmpIter; 
					tmpIter = m_LastEventType.find(label);
					if (tmpIter == m_LastEventType.end())
					{
						event->nLastEventType =0; 
						m_LastEventType.insert(Int_Pair(label, event->nEventType));
					} 
					else 
					{
						event->nLastEventType = tmpIter->second;
						tmpIter->second = event->nEventType;
					}


					
					string strEvent;
					char tmpBuf[256];
					sprintf(tmpBuf, "Id:%s  Type:%d  Count:%d", label.c_str(), dyn.m_state, dyn.m_laststatekeeptimes);
					strEvent = tmpBuf;
					//OutputDebugString(strEvent.c_str());
					//OutputDebugString("\n");
					
					//bool PushMessage(string queuename,string label,const char *data,unsigned int datalen,string user="default",string addr="localhost");
					std::string defaultret = "error";
					std::string alertexport = GetIniFileString("ExportQueue", "Enable",  defaultret, "general.ini");
					if(strcmp(alertexport.c_str(), "error") == 0)
					{					
					}
					else if(strcmp(alertexport.c_str(), "1") == 0)
					{						
						::PushMessage("ExportQueue", label, buf, len); 
					}
					else
					{
						#ifdef AddOnEventSever				
						::PushMessage("EventSeverInputQueue", label, buf, len); //导出事件到EventSever记录队列 
						#endif
					}

					//进入临界区
					if(!waitlistmutex->test())
					{
						continue;
					}
		
					m_AlertEventList.push_back(event);

					//退出临界区
					waitlistmutex->leave();

				}
			}

			if(buf != NULL)
				delete buf;
		}
		else
		{
			DebugePrint("BlockPopMessage Error!!!");
			continue;
		}

		//waitlistmutex->leave();	

	}
	
}
Example #7
0
void CSVReportSet::DelPhone()
{
	string strDeletePhone;
	for(m_pListItem = m_pListReport.begin(); m_pListItem != m_pListReport.end(); m_pListItem++)
    {
        
        if (m_pListItem->pSelect->isChecked())
        {   
        
			std::string temp = m_pListItem->pName->text();
			
			int pos = temp.find(">", 0);
			int pos1 = temp.find("<", pos);
			temp = temp.substr(pos + 1, pos1 - pos - 1);

			DeleteIniFileSection(temp, "reportset.ini");

            int nRow = ((WTableCell*)(m_pListItem->pSelect->parent()))->row();
        
            list<REPORT_LIST>::iterator pItem = m_pListItem;                     
        
            m_pListItem --;
        
 			strDeletePhone += temp;
			strDeletePhone += "  ";

			m_pListReport.erase(pItem);          
        
			//jansion.zhou 2006-12-18
            //m_ptbPhone->deleteRow(nRow);
			m_pReportListTable->GeDataTable()->deleteRow(nRow);

			std::list<string> sectionlist;
			std::list<string>::iterator sectionitem;

			GetIniFileSections(sectionlist, "reportgenerate.ini");

			int num =2;
			for(sectionitem = sectionlist.begin(); sectionitem != sectionlist.end(); sectionitem++)
			{
				std::string tempsection = *sectionitem;
				
				pos = tempsection.find("$", 0);
				if(pos < 0)
				{
					continue;
				}

				std::string substr = tempsection.substr(0, pos);
				
				if(strcmp(substr.c_str(), temp.c_str()) == 0)
				{
					DeleteIniFileSection(tempsection, "reportgenerate.ini");
				}
			}
        }
    }


	
		if(m_pListReport.size() <= 0)
		{
			m_pReportListTable->ShowNullTip();
		}
		else
		{
			m_pReportListTable->HideNullTip();
		}

	//if(m_pListReport.size() == 0)
	//{
	//	WText * nText = new WText("[----------统计报告列表为空-----------]", (WContainerWidget*)nullTable -> elementAt(0, 0));
	//	nText ->decorationStyle().setForegroundColor(Wt::red);
	//	nullTable -> elementAt(0, 0) -> setContentAlignment(AlignTop | AlignCenter);
	//}

	//插记录到UserOperateLog表
	string strUserID = GetWebUserID();
	TTime mNowTime = TTime::GetCurrentTimeEx();
	OperateLog m_pOperateLog;
	m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),m_formText.szTipDel,m_formText.szMainTitle,strDeletePhone);

}
Example #8
0
void TrendReportFrame::initQueryTable(WSVFlexTable **pFlexTable_Add ,int nRow,std::string strTitle, WSVMainTable * pUserTable)
{
	*pFlexTable_Add = new WSVFlexTable((WContainerWidget *)pUserTable->GetContentTable()->elementAt(nRow,0), Blank, strTitle); 

	WSVFlexTable *pFlexTable = *pFlexTable_Add;



	if(pFlexTable->GetContentTable() != NULL)
	{
		//标题链接
		WTable *QueryTitleTable1 = new WTable(pFlexTable->GetContentTable()->elementAt(0,0));

		QueryTitleTable1->elementAt(0, 1)->resize(WLength(8,WLength::Percentage),0);
		WText * p2HourText = new WText("2h", QueryTitleTable1->elementAt(0, 1));
		p2HourText->setStyleClass("linktext");
		connect(p2HourText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query2HourText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 2)->resize(WLength(8,WLength::Percentage),0);
		WText * p4HourText = new WText("4h", QueryTitleTable1->elementAt(0, 2));
		p4HourText->setStyleClass("linktext");
		connect(p4HourText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query4HourText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 3)->resize(WLength(8,WLength::Percentage),0);
		WText * p8HourText = new WText("8h", QueryTitleTable1->elementAt(0, 3));
		p8HourText->setStyleClass("linktext");
		connect(p8HourText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query8HourText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 4)->resize(WLength(8,WLength::Percentage),0);
		WText * p1DayText = new WText("1d", QueryTitleTable1->elementAt(0, 4));
		p1DayText->setStyleClass("linktext");
		connect(p1DayText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query1DayText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 5)->resize(WLength(8,WLength::Percentage),0);
		WText * p3DayText = new WText("3d", QueryTitleTable1->elementAt(0, 5));
		p3DayText->setStyleClass("linktext");
		connect(p3DayText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query3DayText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 6)->resize(WLength(8,WLength::Percentage),0);
		WText * p5DayText = new WText("5d", QueryTitleTable1->elementAt(0, 6));
		p5DayText->setStyleClass("linktext");
		connect(p5DayText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query5DayText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 7)->resize(WLength(8,WLength::Percentage),0);
		WText * p1WeekText = new WText("1w", QueryTitleTable1->elementAt(0, 7));
		p1WeekText->setStyleClass("linktext");
		connect(p1WeekText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query1WeekText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 8)->resize(WLength(12,WLength::Percentage),0);
		WText * pCurWeekText = new WText(strWeek, QueryTitleTable1->elementAt(0, 8));
		pCurWeekText->setStyleClass("linktext");
		connect(pCurWeekText, SIGNAL(clicked()), "showbar();" ,this, SLOT(QueryCurWeekText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 9)->resize(WLength(8,WLength::Percentage),0);
		WText * p1MonthText = new WText("1m", QueryTitleTable1->elementAt(0, 9));
		p1MonthText->setStyleClass("linktext");
		connect(p1MonthText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query1MonthText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 10)->resize(WLength(8,WLength::Percentage),0);
		WText * p3MonthText = new WText("3m", QueryTitleTable1->elementAt(0, 10));
		p3MonthText->setStyleClass("linktext");
		connect(p3MonthText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query3MonthText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 11)->resize(WLength(8,WLength::Percentage),0);
		WText * p6MonthText = new WText("6m", QueryTitleTable1->elementAt(0, 11));
		p6MonthText->setStyleClass("linktext");
		connect(p6MonthText, SIGNAL(clicked()), "showbar();" ,this, SLOT(Query6MonthText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		QueryTitleTable1->elementAt(0, 12)->resize(WLength(12,WLength::Percentage),0);
		WText * pCurDayText = new WText(strDay, QueryTitleTable1->elementAt(0, 12));
		pCurDayText->setStyleClass("linktext");
		connect(pCurDayText, SIGNAL(clicked()), "showbar();" ,this, SLOT(QueryCurDayText()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	

		//时间
		WTable * QueryTitleTable2 = new WTable((WContainerWidget *)pFlexTable->GetContentTable()->elementAt(1,0));
		pFlexTable->GetContentTable()->elementAt(1, 0)->setContentAlignment(AlignTop | AlignCenter);

		QueryTitleTable2->resize(WLength(100,WLength::Percentage),WLength(30,WLength::Pixel));
		TTime curTime = TTime::GetCurrentTimeEx();
		new WText(strStartTimeLabel, QueryTitleTable2->elementAt(0, 0));
		pAlertStartTime = new WLineEdit("", QueryTitleTable2->elementAt(0, 1));
		TTimeSpan ts(0,24,0,0);
		curTime -= ts;
		pAlertStartTime->setText(curTime.Format());
		pAlertStartTime->setStyleClass("input_text");
		strcpy(pAlertStartTime->contextmenu_ , "onFocus=\"calendar()\"");

		curTime = TTime::GetCurrentTimeEx();
		new WText(strEndTimeLabel, QueryTitleTable2->elementAt(0, 3));
		pAlertEndTime = new WLineEdit("", QueryTitleTable2->elementAt(0, 4));
		pAlertEndTime->setText(curTime.Format());
		pAlertEndTime->setStyleClass("input_text");
		strcpy(pAlertEndTime->contextmenu_ , "onFocus=\"calendar()\"");

		pFlexTable->ShowOrHideHelp();
		pFlexTable->HideAllErrorMsg();
	}	

	if(pFlexTable->GetActionTable()!=NULL)
	{
		WTable *pTbl;
		pTbl = new WTable(pFlexTable->GetActionTable()->elementAt(0, 1));

		WSVButton * pQueryBtn = new WSVButton(pTbl->elementAt(0,0), strQueryBtn, "button_bg_m_black.png", "", true);
		connect(pQueryBtn, SIGNAL(clicked()), "showbar();" ,this, SLOT(TrendReportQuery()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC);	
	}
}
Example #9
0
void CSVAddPlan::Save()
{
	bool bEnd = false;	
	string strUserID = GetWebUserID();

	HitLog LogItem;
	LogItem.sUserName = strUserID;
	LogItem.sHitPro = "Plan Set";
	LogItem.sHitFunc = "Save";
	LogItem.sDesc = szSaveAddInPlan;

	DWORD dcalBegin=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0);

OPEnd:
	if(bEnd)
	{
		DWORD dcalEnd=GetTickCount();
		InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd -dcalBegin);
		return;
	}
	
	ADD_PLAN_OK addPlan;
    bool bCheck = 0;

    addPlan.szName = m_pName->text();

	std::list<string> errorMsgList;

	
    if (addPlan.szName.empty())
    {
		errorMsgList.push_back(m_FormShowText.szErrorMsg);
		AddRangeTable->ShowErrorMsg(errorMsgList);
		//m_pPlanNameError->show();
		bEnd = true;	
		goto OPEnd;
    }
	//else
	//{
	//	AddRangeTable -> HideAllErrorMsg();
	//	//m_pPlanNameError-> hide();
	//}

	std::string str1 = m_pTasklist->m_pStart[1]->text();
	//Jansion.zhou 2006-12-25
    //m_pErrMsg->setText("");
    //m_pErrMsg->hide();

    addPlan.nIndex = m_nIndex;

	std::list<string> tasknamelist;
	std::list<string>::iterator m_pItem;
	bool IsSave = false;
	bool IsConn = GetAllTaskName(tasknamelist);
	
	if(IsConn)
	{
		OutputDebugString("----------------isconn true------------------\n");
		for(m_pItem = tasknamelist.begin(); m_pItem != tasknamelist.end(); m_pItem++)
		{
			std::string str = *m_pItem;
			if(strcmp(str.c_str(), addPlan.szName.c_str()) == 0)
			{
				IsSave = true;
				break;
			}
		}
		
		
		if(strcmp(chgstr.c_str(), "") == 0)
		{
			if(!IsSave)
			{
				OutputDebugString("----------------Issave false------------------\n");
				OBJECT hTask = CreateTask(addPlan.szName);
				
				SetTaskValue("Type", m_FormShowText.szPlanTypeRel, hTask);
				char buf[256];
				for(int i = 0; i < 7; i++)
				{

					itoa(i, buf, 10);
					std::string temp = m_pTasklist->m_pStart[i]->text();
					std::string temp1 = "start";
					temp1 += buf;
					SetTaskValue(temp1, temp, hTask);
					
					temp = m_pTasklist->m_pEnd[i]->text();
					temp1 = "end";
					temp1 += buf;
					SetTaskValue(temp1, temp, hTask);
					
					temp1 = "Allow";
					temp1 += buf;

					std::string temp3 = m_pTasklist->m_pCombo[i]->currentText();
					if(strcmp(temp3.c_str(), strAllown.c_str()) == 0)
					{
						SetTaskValue(temp1, m_FormShowText.szStatusAllow, hTask);
					}
					else
					{
						SetTaskValue(temp1, m_FormShowText.szStatusDeny, hTask);
					}
				}
				SetTaskValue("Description", textarea->text(), hTask);
				SubmitTask(hTask);

				//Jansion.zhou 2006-12-25
				//m_pErrMsg->setText("");
				//m_pErrMsg->hide();
				addPlan.nIndex = m_nIndex;

				//插记录到UserOperateLog表
				string strUserID = GetWebUserID();
				TTime mNowTime = TTime::GetCurrentTimeEx();
				OperateLog m_pOperateLog;
				m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),strTypeAdd,strTimeTaskPlan,m_pName->text());

				emit Successful(addPlan);
			}
			else
			{
OutputDebugString("----------------Issave true------------------\n");
				//Jansion.zhou 2006-12-25
				//m_pErrMsg->setText(m_FormShowText.szErrorMsg1);
				//m_pErrMsg->show();

				errorMsgList.push_back(m_FormShowText.szErrorMsg1);
				AddRangeTable->ShowErrorMsg(errorMsgList);
			}
		}
		else
		{

			std::string str;
			for(m_pItem = tasknamelist.begin(); m_pItem != tasknamelist.end(); m_pItem++)
			{
				str = *m_pItem;
				if(strcmp(str.c_str(), addPlan.szName.c_str()) == 0)
				{
					if(strcmp(str.c_str(), chgstr.c_str()) != 0)
					{
						IsSave = true;
						break;
					}
					else
					{				
						IsSave = false;
						break;
					}
				}
			}

			
			if(!IsSave)
			{
				OutputDebugString("----------------Issave00 false------------------\n");
				OBJECT hTask = GetTask(chgstr);
				
				SetTaskValue("Type", m_FormShowText.szPlanTypeRel, hTask);
				char buf[256];
				for(int i = 0; i < 7; i++)
				{
					itoa(i, buf, 10);
					std::string temp = m_pTasklist->m_pStart[i]->text();
					std::string temp1 = "start";
					temp1 += buf;
					SetTaskValue(temp1, temp, hTask);
					
					temp = m_pTasklist->m_pEnd[i]->text();
					temp1 = "end";
					temp1 += buf;
					SetTaskValue(temp1, temp, hTask);

					temp1 = "Allow";
					temp1 += buf;

					std::string temp3 = m_pTasklist->m_pCombo[i]->currentText();
					if(strcmp(temp3.c_str(), strAllown.c_str()) == 0)
					{
						SetTaskValue(temp1, m_FormShowText.szStatusAllow, hTask);
					}
					else
					{
						SetTaskValue(temp1, m_FormShowText.szStatusDeny, hTask);
					}
				}
				SetTaskValue("Description", textarea->text(), hTask);
				EditTask(hTask,addPlan.szName);

				//Jansion.zhou 2006-12-25
				//m_pErrMsg->setText("");
				//m_pErrMsg->hide();

				addPlan.nIndex = m_nIndex;

				//插记录到UserOperateLog表
				string strUserID = GetWebUserID();
				TTime mNowTime = TTime::GetCurrentTimeEx();
				OperateLog m_pOperateLog;
				m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),strTypeEdit,strTimeTaskPlan,m_pName->text());

				chgstr = "";
				emit Successful(addPlan);
			}
			else
			{
				OutputDebugString("----------------Issave000 true------------------\n");
				//Jansion.zhou 2006-12-25
				//m_pErrMsg->setText(m_FormShowText.szErrorMsg1);
				//m_pErrMsg->show();

				errorMsgList.push_back(m_FormShowText.szErrorMsg1);
				AddRangeTable->ShowErrorMsg(errorMsgList);
			}
		}
	}
	else
	{

	}

	DWORD dcalEnd1=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin);
}