📄 decrease.cpp
字号:
// decrease.cpp : implementation file
//
#include "stdafx.h"
#include "图书馆管理系统.h"
#include "decrease.h"
#include "BookSystem.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// decrease dialog
extern BookSystem * student;
decrease::decrease(CWnd* pParent /*=NULL*/)
: CDialog(decrease::IDD, pParent)
{
booksystem = 1;
//{{AFX_DATA_INIT(decrease)
m_bookname = _T("");
m_booknum = _T("");
m_author = _T("");
//}}AFX_DATA_INIT
}
void decrease::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(decrease)
DDX_Control(pDX, IDC_COMBO_PUBLISH, m_press);
DDX_Text(pDX, IDC_BOOKNAME, m_bookname);
DDX_Text(pDX, IDC_BOOKNUM, m_booknum);
DDX_Text(pDX, IDC_BOOKWR, m_author);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(decrease, CDialog)
//{{AFX_MSG_MAP(decrease)
ON_BN_CLICKED(IDD_ABOUTBOX7, OnAboutbox7)
ON_BN_CLICKED(IDD_ABOUTBOX6, OnAboutbox6)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// decrease message handlers
void decrease::OnAboutbox7()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
void decrease::OnAboutbox6()
{
// TODO: Add your control notification handler code here
UpdateData(1);
int pressnum = m_press.GetCurSel();
if (m_bookname=="" && m_author==""&&pressnum==-1 ) MessageBox("没有书要出库!","注意");
else if (m_author==""&&pressnum==-1)
{
student = student->Print_Bookname(m_bookname,student);
MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
else if (m_bookname==""&&pressnum==-1) {student = student->Print_Author(m_author,student);
MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
else if (m_bookname==""&&m_author=="") {m_press.GetLBText(pressnum,m_publish);
student = student->Print_Press(m_publish,student);
// MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
else if (pressnum==-1) {student = student->Print_BandA(m_bookname,m_author,student);
MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
else if (m_bookname=="") {m_press.GetLBText(pressnum,m_publish);student = student->Print_PandA(m_publish,m_author,student);
MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
else if (m_author=="") {m_press.GetLBText(pressnum,m_publish);student = student->Print_PandB(m_publish,m_bookname,student);
MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
else {m_press.GetLBText(pressnum,m_publish);student = student->Print_PandBandA(m_publish,m_bookname,m_author,student);
MessageBox (student->bookname+" "+student->author+" "+student->press+" "+student->type);
}
m_bookname = '\0';
m_author = '\0';
m_press.SetCurSel(-1);
UpdateData(0);
}
BOOL decrease::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if (booksystem) m_bookname="",m_author="",m_press.ResetContent();
CFile Read_BookStore;
student=new BookSystem;
CString temp_bookname;
CString temp_author;
CString temp_press;
CString temp_type;
CString temp_number;
int create = 0; //数据文件建立标志;
int flag1 = 1;
int flag2 = 1;
int flag3 = 1;
int flag4 = 1;
int flag5 = 1;
///////////////////////////////////////////////////////////建立连表
if(booksystem)
{
if(Read_BookStore.Open("BookStore\\BookStore.txt",CFile::modeRead))
{ create = 1;
char temp[1];
while(Read_BookStore.Read(temp,1))//while
{
while(temp[0]!='~'&&temp[0]!='\n')//读取一个文本对象信息;
{
if(flag1){while(temp[0]!='#'){temp_bookname+=temp[0];Read_BookStore.Read(temp,1);}flag1 = 0;}
else{
if(flag2){Read_BookStore.Read(temp,1);while(temp[0]!='#'){temp_author+=temp[0];Read_BookStore.Read(temp,1);}flag2 = 0;}
else{
if(flag3){Read_BookStore.Read(temp,1);while(temp[0]!='#'){temp_press+=temp[0];Read_BookStore.Read(temp,1);}flag3 = 0;}
else{
if(flag4){Read_BookStore.Read(temp,1);while(temp[0]!='#'){temp_type+=temp[0];Read_BookStore.Read(temp,1);}flag4 = 0;}
else{
if(flag5){Read_BookStore.Read(temp,1);while(temp[0]!='~'){temp_number+=temp[0];Read_BookStore.Read(temp,1);}flag5 = 0;}}}}}
}
////////////////******************
// MessageBox(temp_bookname+" "+temp_author+" "+temp_press+" "+temp_type+" "+temp_number); //读出检验
student->InsertBookSystem(temp_press,temp_bookname,temp_author,temp_type,student);//链表建立
flag1 = 1;temp_bookname.Empty();//数据回原;
flag2 = 1;temp_type.Empty();
flag3 = 1;temp_author.Empty();
flag4 = 1;temp_press.Empty();
flag5 = 1;temp_number.Empty();
}//end while;
Read_BookStore.Close();//关闭文件;
}//读取信息文件;
else{
if(Read_BookStore.Open("BookStore\\BookStore.txt",CFile::modeCreate))
create = 1;
Read_BookStore.Close();//关闭文件;
}//bookname创建信息文Type件;
booksystem = 0;
}
////////////////////////////
if (create) {}
else MessageBox("系统出现问题!","警告");
booksystem = 0;
////////////////////读入出版社资料
CFile file;
CString pb;
char t[1];
file.Open("Publish.txt",CFile::modeRead);
///////////////////////读文档
while (file.Read(t,1))
{
if(t[0] == '&')
{
type=pb;
m_press.AddString(type);
pb = "";
continue;
}
pb+=t[0];
}
UpdateData(1);
file.Close();
///////////////////////读入完毕
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -