char *asumetime (char *t1, char *t2) { long total, t_1, t_2 ; static char r [60] ; t_1 = etime2long (t1) ; t_2 = etime2long (t2) ; total = t_1 + t_2 ; strcpy (r, cetime ((time_t) total)); return ((char *) r) ; }
void CDLGHistoryReport::OnButtonSearch() { // TODO: Add your control notification handler code here UpdateData(TRUE); char STime[32]={0}; char ETime[32]={0}; if( m_StartMon.GetYear() <1900 || m_StartMon.GetYear() >2100 || m_EndMon.GetYear()<1900 || m_EndMon.GetYear() >2100) { MessageBox("时间范围不能小于1900年,不大于2100年",MESSAGEBOX_TITLE); return ; } sprintf(STime,"%04d%02d%02d%02d%02d%02d", m_StartMon.GetYear(), m_StartMon.GetMonth(), m_StartMon.GetDay(), m_StartHour.GetHour(), m_StartHour.GetMinute(), m_StartHour.GetSecond()); sprintf(ETime,"%04d%02d%02d%02d%02d%02d", m_EndMon.GetYear(), m_EndMon.GetMonth(), m_EndMon.GetDay(), m_EndHour.GetHour(), m_EndHour.GetMinute(), m_EndHour.GetSecond()); /////////获取 searchFlag = 0; if(!m_user.IsEmpty()) { searchFlag |= 0x01; } if(m_CheckTime) { searchFlag |= 0x02; COleDateTime cstime( m_StartMon.GetYear(), m_StartMon.GetMonth(), m_StartMon.GetDay(), m_StartHour.GetHour(), m_StartHour.GetMinute(), m_StartHour.GetSecond()); COleDateTime cetime( m_EndMon.GetYear(), m_EndMon.GetMonth(), m_EndMon.GetDay(), m_EndHour.GetHour(), m_EndHour.GetMinute(), m_EndHour.GetSecond()); if(cstime>cetime) { MessageBox("起始时间 不得大于 结束时间"); return ; } } ListTotal=0; ListTotal=MySqlIO.LOG_GetSystemLogNum(m_user.GetBuffer(0),STime,ETime,searchFlag,sqlstr); ListNow=0; DisplayerList(); }
void CDLGHistoryFace::OnButtonSearch() { // TODO: Add your control notification handler code here UpdateData(TRUE); DlgFaceSreachLite.UpdateData(TRUE); HTREEITEM treeid=m_tree.GetSelectedItem(); memset(SqlStr,0,1024); char STime[32]={0}; char ETime[32]={0}; if( DlgFaceSreachLite.m_StartMon.GetYear() <1900 || DlgFaceSreachLite.m_StartMon.GetYear() >2100 || DlgFaceSreachLite.m_EndMon.GetYear()<1900 || DlgFaceSreachLite.m_EndMon.GetYear() >2100) { MessageBox("时间范围不能小于1900年,不大于2100年",MESSAGEBOX_TITLE); return ; } sprintf(STime,"%04d%02d%02d%02d%02d%02d", DlgFaceSreachLite.m_StartMon.GetYear(), DlgFaceSreachLite.m_StartMon.GetMonth(), DlgFaceSreachLite.m_StartMon.GetDay(), DlgFaceSreachLite.m_StartHour.GetHour(), DlgFaceSreachLite.m_StartHour.GetMinute(), DlgFaceSreachLite.m_StartHour.GetSecond()); sprintf(ETime,"%04d%02d%02d%02d%02d%02d", DlgFaceSreachLite.m_EndMon.GetYear(), DlgFaceSreachLite.m_EndMon.GetMonth(), DlgFaceSreachLite.m_EndMon.GetDay(), DlgFaceSreachLite.m_EndHour.GetHour(), DlgFaceSreachLite.m_EndHour.GetMinute(), DlgFaceSreachLite.m_EndHour.GetSecond()); /////////获取 searchFlag = 0; if(DlgFaceSreachLite.m_age_start >DlgFaceSreachLite.m_age_end) { MessageBox("起始年龄 不得大于 结束年龄"); return ; } long ncam=0; bool ncamflag=false; if(treeid == rootitem) { ncamflag=false; } else { for(int i=0;i<dbtotal;i++) { if(treeid == dblist[i].item) { ncam=dblist[i].ncamera; ncamflag=true; break; } } } if(ncamflag) { searchFlag |= 0x01; } if(DlgFaceSreachLite.m_c_sex!=0) { searchFlag |= 0x02; } searchFlag |= 0x04; if(DlgFaceSreachLite.m_CheckTime) { searchFlag |= 0x08; COleDateTime cstime( DlgFaceSreachLite.m_StartMon.GetYear(), DlgFaceSreachLite.m_StartMon.GetMonth(), DlgFaceSreachLite.m_StartMon.GetDay(), DlgFaceSreachLite.m_StartHour.GetHour(), DlgFaceSreachLite.m_StartHour.GetMinute(), DlgFaceSreachLite.m_StartHour.GetSecond()); COleDateTime cetime( DlgFaceSreachLite.m_EndMon.GetYear(), DlgFaceSreachLite.m_EndMon.GetMonth(), DlgFaceSreachLite.m_EndMon.GetDay(), DlgFaceSreachLite.m_EndHour.GetHour(), DlgFaceSreachLite.m_EndHour.GetMinute(), DlgFaceSreachLite.m_EndHour.GetSecond()); if(cstime>cetime) { MessageBox("起始时间 不得大于 结束时间"); return ; } } ListTotal=0; switch(flag) { case HISTORY_DETECT_FLAG_FACE : ListTotal=MySqlIO.FACE_Capture_GetNum( ncam, DlgFaceSreachLite.m_c_sex, DlgFaceSreachLite.m_age_start, DlgFaceSreachLite.m_age_end, STime, ETime, searchFlag, SqlStr); break; case HISTORY_DETECT_FLAG_FACEALARM: ListTotal=MySqlIO.FACE_Capture_GetAlarmNum( ncam, DlgFaceSreachLite.m_c_sex, DlgFaceSreachLite.m_age_start, DlgFaceSreachLite.m_age_end, STime, ETime, searchFlag, SqlStr); break; default: MessageBox("CDLGHistoryFace::OnButtonSearch A error",MESSAGEBOX_TITLE); return ; } ListNow=0; DisplayerList(); }