void CLryEDBQryDoc::OnCursorMove(UINT nID) { try { switch(nID) { case ID_RECORD_FIRST: MoveFirst(); break; case ID_RECORD_PREV: MovePrevious(); break; case ID_RECORD_NEXT: MoveNext(); break; case ID_RECORD_LAST: MoveLast(); break; default: break; } } catch(_com_error &e) { dump_com_error(e); } UpdateAllViews( NULL,1); }
int CSessions::addRecord() { if (!IsBOF() || !IsEOF()) { MoveLast(); m_prevID = m_ID; } else m_prevID = -1; AddNew(); m_ID = ++m_prevID; m_NAME.Format(_T("Session%d"), m_ID); Update(); return m_prevID; }
int CFaces::addRecord(int figureID) { if (!IsBOF() || !IsEOF()) { MoveLast(); m_prevID = m_ID; } else m_prevID = -1; AddNew(); m_ID = ++m_prevID; m_FIGURE_ID = figureID; m_NAME.Format(_T("%dFace%d"), figureID, m_ID); Update(); return m_prevID; }
int CFigures::addRecord(int sessionID) { if (!IsBOF() || !IsEOF()) { MoveLast(); m_prevID = m_ID; } else m_prevID = -1; AddNew(); m_ID = ++m_prevID; m_SESSION_ID = sessionID; m_NAME.Format(_T("%dFigure%d"), sessionID, m_ID); Update(); return m_prevID; }
bool AflStringHistory::AddString(LPCSTR pString) { if(!m_ppString) return false; int iIndex; iIndex = GetStringIndex(pString); if(iIndex == -1) { DelString(0); m_ppString[m_iCount-1] = new std::string; *m_ppString[m_iCount-1] = pString; } else { MoveLast(iIndex); } return true; }
dbf_data_type GetFieldType(int field, const CDaoFieldInfo& info, size_t* length) { dbf_data_type type; switch (info.m_nType) { case dbDate: { bool date = false; bool time = false; if (!(IsBOF() && IsEOF())) for (MoveFirst(); !IsEOF(); MoveNext()) { COleVariant var; GetFieldValue(field, var); if (var.vt == VT_DATE) { SYSTEMTIME st; COleDateTime dt(var.date); if (dt.GetAsSystemTime(st)) { date = date || (st.wYear != 1899); time = time || st.wHour || st.wMinute || st.wSecond; } } } if (date && time) { type = DBF_DATA_TYPE_DATETIME; *length = DBF_LEN_DATETIME; } else if (time) { type = DBF_DATA_TYPE_TIME; *length = DBF_LEN_TIME; } else { type = DBF_DATA_TYPE_DATE; *length = DBF_LEN_DATE; } break; } case dbDecimal: case dbFloat: case dbSingle: case dbDouble: type = DBF_DATA_TYPE_FLOAT; break; case dbText: case dbMemo: case dbChar: type = DBF_DATA_TYPE_CHAR; if (0 == *length) { *length = 80; } break; case dbInteger: case dbLong: case dbByte: case dbNumeric: case dbBigInt: type = DBF_DATA_TYPE_INTEGER; // workaround: it may be a running number, check if highest one fits. // Increase field size if needed if (!(IsBOF() && IsEOF())) { MoveLast(); COleVariant var; GetFieldValue(field, var); int n = 0; switch (var.vt) { case VT_I2: n = var.iVal; break; case VT_I4: n = var.lVal; break; } if (n) { char temp[80]; size_t len = _snprintf(temp, _countof(temp), "%d", n); if (len > *length) { *length = len; } } } break; case dbBoolean: type = DBF_DATA_TYPE_BOOLEAN; *length = DBF_LEN_BOOLEAN; break; case dbCurrency: case dbBinary: case dbLongBinary: case dbGUID: case dbVarBinary: case dbTime: case dbTimeStamp: default: type = DBF_DATA_TYPE_UNKNOWN; break; } return type; }