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;
這是我自己寫的可惜不對
InsertCheck加上一個參數,不同的按鈕調用的時候傳不同的參數。它再判斷。