void CAttendance::OnCapture(BOOL ActionResult, const VARIANT FAR& ATemplate)
{
if (Identify == 0)//比对指纹(1:N)
{
if (Identifys(m_zkeng.GetTemplateAsString()))
{
InsertCheck(m_zkeng.GetTemplateAsString());
MessageBox("考勤成功!");
}
else
MessageBox("考勤失败,请再次按压指纹!");
}
if (IdentifyType != 0)
IdentifyType = 0;
}
void CAttendance::InsertCheck(CString Templage)//向数据库插入数据
{
CTime time = CTime::GetCurrentTime();
CString SQL = "Select top 2 * From Check";
CADODataSet dataset;
dataset.SetConnection(::GetConnection());
dataset.Open(SQL);
dataset.AddNew();
dataset.SetFieldValue("Name",(_variant_t)m_PersonName);
dataset.SetFieldValue("checkdate",(_bstr_t)time.Format("%Y-%m-%d"));
if(OnStartClass())
dataset.SetFieldValue("checktype",(_bstr_t)"正点上课");
else
if(OnLater())
dataset.SetFieldValue("checktype",(_bstr_t)"迟到");
else
if(OnFinshClass())
dataset.SetFieldValue("checktype",(_bstr_t)"正点下课");
dataset.SetFieldValue("checktime",(_bstr_t)time.Format("%H:%M:%S"));
dataset.Save();
}
void CAttendance::OnLater() //BUTTON迟到
{
if (m_zkeng.GetIsRegister())
m_zkeng.CancelEnroll();
Identify = 0;
}
void CAttendance::OnFinshClass() //BUTTON下课
{
if (m_zkeng.GetIsRegister())
m_zkeng.CancelEnroll();
Identify = 0;
}
void CAttendance::OnStartClass() //BUTTON上课
{
if (m_zkeng.GetIsRegister())
m_zkeng.CancelEnroll();
Identify = 0;
这是我自己写的可惜不对