📄 score.cpp
字号:
// Score.cpp: implementation of the Score class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "sm.h"
#include "Score.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//##ModelId=40A481F50243
Score::Score()
{
Set(0, "2004-1-1", 0, 0, 0);
}
//##ModelId=40A481F50244
Score::~Score()
{
}
//##ModelId=40A481F50206
inline void Score::Set(long id, CString date, long student_id, long teaching_id, long score)
{
COleDateTime dt;
dt.ParseDateTime(date);
Set(id, dt, student_id, teaching_id, score);
}
//##ModelId=40A481F501F5
inline void Score::Set(long id, COleDateTime date, long student_id, long teaching_id, long score)
{
ID = id, Date = date, StudentID = student_id, TeachingID = teaching_id, ScoreValue = score;
}
//##ModelId=40A481F501E7
void Score::AddNew(CDaoRecordset *RS)
{
RS->AddNew();
RS->SetFieldValue("score", COleVariant(ScoreValue));
RS->SetFieldValue("date", Date);
RS->SetFieldValue("teaching_id", COleVariant(TeachingID));
RS->SetFieldValue("student_id", COleVariant(StudentID));
RS->Update();
RS->MoveLast();
ID = RS->GetFieldValue("ID").lVal;
}
//##ModelId=40A481F501E5
void Score::Load(CDaoRecordset *RS)
{
RS->SetCurrentIndex("ID");
if(RS->Seek("=", &COleVariant(ID)))
{
// ID = RS->GetFieldValue(_T("ID")).lVal;
ScoreValue = RS->GetFieldValue(_T("score")).lVal;
Date = RS->GetFieldValue(_T("Date")).date;
TeachingID = RS->GetFieldValue(_T("teaching_id")).lVal;
StudentID = RS->GetFieldValue(_T("student_id")).lVal;
}
}
//##ModelId=40A481F501D7
void Score::Update(CDaoRecordset *RS)
{
RS->SetCurrentIndex("ID");
if(RS->Seek("=", &COleVariant(ID)))
{
RS->Edit();
RS->SetFieldValue("score", COleVariant(ScoreValue));
RS->SetFieldValue("date", Date);
RS->SetFieldValue("teaching_id", COleVariant(TeachingID));
RS->SetFieldValue("student_id", COleVariant(StudentID));
RS->Update();
}
}
//##ModelId=40A481F501D5
void Score::Delete(CDaoRecordset *RS)
{
RS->SetCurrentIndex("ID");
if(RS->Seek("=", &COleVariant(ID)))
RS->Delete();
}
//##ModelId=40A481F501C5
Score::Score(long id, COleDateTime date, long student_id, long teaching_id, long score)
{
Set(id, date, student_id, teaching_id, score);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -