⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student_own_info.cpp

📁 图书管理系统 语言:C,SQL 功能:实现图书管理的数字化
💻 CPP
字号:
// Student_own_info.cpp : implementation file
//

#include "stdafx.h"
#include "Library.h"
#include "Student_own_info.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Student_own_info dialog


Student_own_info::Student_own_info(CWnd* pParent /*=NULL*/)
	: CDialog(Student_own_info::IDD, pParent)
{
	//{{AFX_DATA_INIT(Student_own_info)
	m_sid_temp = _T("");
	//}}AFX_DATA_INIT
}


void Student_own_info::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Student_own_info)
	DDX_Control(pDX, IDC_LIST9, m_sprofession_list);
	DDX_Control(pDX, IDC_LIST8, m_sid_list);
	DDX_Control(pDX, IDC_LIST1, m_student_borrow_list);
	DDX_Control(pDX, IDC_LIST2, m_sname_list);
	DDX_Text(pDX, IDC_EDIT1, m_sid_temp);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Student_own_info, CDialog)
	//{{AFX_MSG_MAP(Student_own_info)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Student_own_info message handlers

void Student_own_info::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);
	if(m_sid_temp.IsEmpty())
	{
	   MessageBox("请输入学生学号!");
	   return;
	}
	//查找
    CString str="Sid='"+m_sid_temp+"'";
	student_set.m_strFilter=str;
	student_set.Open();       //打开数据集合
	int recount=student_set.GetRecordCount();
	if(recount==0)
	{
		MessageBox("无此学生记录!");
		student_set.m_strFilter="";	
	}
	else
	{
		m_sname_list.ResetContent();//列表清空
		m_sid_list.ResetContent();//列表清空
		m_sprofession_list.ResetContent();//列表清空
		m_student_borrow_list.ResetContent();//列表清空

		
		CString sname,sid,sprofession,temp;

		sname.Format("%s",student_set.m_Sname);
		sid.Format("%s",student_set.m_Sid);
		sprofession.Format("%s",student_set.m_Sprofession);

		m_sname_list.InsertString(-1,sname);
		m_sid_list.InsertString(-1,sid);
		m_sprofession_list.InsertString(-1,sprofession);

		
		CString str2="Sid='"+m_sid_temp+"'";
		borrow_set.m_strFilter="";
		borrow_set.Open();//打开数据集合
		//int recount2=borrow_set.GetRecordCount();
		int i=0;
		while(!borrow_set.IsEOF())
		{	
			if(borrow_set.m_Sid==m_sid_temp)
			{
				CString temp1,temp2;
				CTime t1=borrow_set.m_Borrowtime.GetTime();
				CTime t2=borrow_set.m_Senttime.GetTime();
				CTime t=CTime::GetCurrentTime();
				temp1=t1.Format("%Y-%m-%d");
				temp2=t2.Format("%Y-%m-%d");
				if(t>t2)
					temp.Format("No.%d   ISBN:%s 借书日期:%s   还书日期:%s  超期",i+1,borrow_set.m_ISBN,temp1,temp2);
				else
					temp.Format("No.%d   ISBN:%s 借书日期:%s   还书日期:%s ",i+1,borrow_set.m_ISBN,temp1,temp2);
				i++;
				m_student_borrow_list.InsertString(-1,temp);
			}
			borrow_set.MoveNext();
		}
		if(i==0)
		{
			temp.Format("你没有图书借阅记录!");
			m_student_borrow_list.InsertString(-1,temp);
		}
		UpdateData(FALSE);
	}
	UpdateData(FALSE);//显示
	borrow_set.MoveFirst();
    borrow_set.Requery();
	borrow_set.Close();
	student_set.Close();
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -