//删除操作 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); }
/* * 函数介绍:程序入口函数 * 输入参数:argv[1]为-install是安装服务,-remove时删除服务,argv[2]安装时为服务控制台显示服务名称 删除时为注册服务名称,此程序为AlertService * 输出参数:无 * 返回值: */ int _tmain(int argc, _TCHAR* argv[]) { int nRetCode = 0; if(WriteIniFileString("testsection","testkey","testvalue","alert.ini")) { DeleteIniFileSection("testsection","alert.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","TxtTemplate.ini")) { DeleteIniFileSection("testsection","TxtTemplate.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","smsconfig.ini")) { DeleteIniFileSection("testsection","smsconfig.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","general.ini")) { DeleteIniFileSection("testsection","general.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","itsmConfig.ini")) { DeleteIniFileSection("testsection","itsmConfig.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","watchsheetcfg.ini")) { DeleteIniFileSection("testsection","watchsheetcfg.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","email.ini")) { DeleteIniFileSection("testsection","email.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","emailAdress.ini")) { DeleteIniFileSection("testsection","emailAdress.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","smsphoneset.ini")) { DeleteIniFileSection("testsection","smsphoneset.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","interfacedll.ini")) { DeleteIniFileSection("testsection","interfacedll.ini"); } if(WriteIniFileString("testsection","testkey","testvalue","OfbizConfig.ini")) { DeleteIniFileSection("testsection","OfbizConfig.ini"); } #if 1 try { if(hasrun()) return 0; CAlertMain alertmain; alertmain.Init(); //MSG msg; //BOOL bRet=TRUE; //while((bRet=::GetMessage(&msg,NULL,0,0))!=0) //{ // if(bRet==-1) // { // continue; // } // TranslateMessage(&msg); // ::DispatchMessage(&msg); //} MSG msg; while(::GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); ::DispatchMessage(&msg); switch(msg.message) { case WM_QUIT: exit(1); break; default: break; } } } catch(...) { } #else // argc = 2; // argv[1] = "-remove"; // argv[2] = "AlertService"; //#if 1 // RunThread(NULL); //#else // initialize MFC and print and error on failure if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: change error code to suit your needs cerr << _T("Fatal Error: MFC initialization failed") << endl; nRetCode = 1; } g_strRootPath= FuncGetInstallRootPath(); SERVICE_TABLE_ENTRY Table[] = { {"AlertService7",StartAlertService}, {NULL, NULL} }; CString outStr = "parameter required in the command line"; if(argc <= 1) { cout << (LPCTSTR)outStr << endl; } else { if(_stricmp(argv[1],"-install") == 0) { InstallService(argv[2]); } else if(_stricmp(argv[1],"-remove") == 0) { StopService(argv[2]); } else { cout << outStr << endl; } } if(!StartServiceCtrlDispatcher(Table)) { g_strMessage.Format("StartServiceCtrlDispatcher error = %d\r\n", GetLastError()); WriteLogFile(g_strMessage); } #endif //CAlertMain::pSender.Release(); return nRetCode; }
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); }