示例#1
0
/*----------------------------------------------------------------------------------------------
	Check to see if we are editing a new record, if so, update the date modified on the old
	record if changes were made.
----------------------------------------------------------------------------------------------*/
void CleDeSplitChild::BeginEdit(AfDeFieldEditor * pdfe)
{
	HVO hvoNew = pdfe->GetObj();
	if (m_hvoLastObj && m_hvoLastObj != hvoNew)
	{
		// We've opened an editor on a new object.
		CustViewDaPtr qcvd;
		m_qlpi->GetDataAccess(&qcvd);
		AssertPtr(qcvd);
		int clid;
		// Find out if this is a kind of CmPossibility.
		CheckHr(qcvd->get_ObjClid(m_hvoLastObj, &clid));
		IFwMetaDataCachePtr qmdc;
		m_qlpi->GetDbInfo()->GetFwMetaDataCache(&qmdc);
		AssertPtr(qmdc);
		do
		{
			if (clid == kclidCmPossibility)
			{
				// The object has a DateModified property, so see that it is current.
				RecMainWnd * prmw = dynamic_cast<RecMainWnd *>(MainWindow());
				Assert(prmw);
				prmw->UpdateDateModified(m_hvoLastObj, kflidCmPossibility_DateModified);
				break;
			}
			ulong uclid;
			qmdc->GetBaseClsId(clid, &uclid);
			clid = (int)uclid;
		} while (clid != 0);
	}
}