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

📄 listdoc.h

📁 用户管理系统
💻 H
字号:
/*########################################################################
	【文件名】: 	ListDoc.h
	【名  称】:		DataWin 封装类.
	【版  本】:		1.0
	【作  者】:		梁均源
	【E-mail】:		KelvinSpace@citiz.net

  注意:必需保留以上信息!!!
  ########################################################################*/
// ListDoc.h: interface for the CListDoc class.
// 设计目的: 在IDE介面中设计数据库应用介面
// 介面包括: ReprotCtrl列表  
//            n个控件,对应列表中的列项目
//            必需指定单一控件为主键 例:SETKEY=ID
// 数据库  : 数据库默认使用立即更新模式
//            所有对数据的修改、删除操作将立即生效
//            如果需要统一保存,可以使用事务处理
// 其它    : 没办法实现对数据库的批处理           
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LISTDOC_H__50A9C0A6_502D_4E14_88C2_CCF6FBA05E44__INCLUDED_)
#define AFX_LISTDOC_H__50A9C0A6_502D_4E14_88C2_CCF6FBA05E44__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "DlgDoc.h"
#include "ListCtrlBase.H"

#define CLD_BEGIN    -1   //首行
#define CLD_END      -2   //末行
#define CLD_CURSOR  -3   //当前行

#define LD_NONE     0
#define LD_EDIT     1
#define LD_NEW      2 

//
class CListDoc : public CDlgDoc  
{
public:
	BOOL _DeleteAllColumns();
    int  _GetSelected();
    int  _GetSubItem(LPCSTR pItemName);

	void Db2List(CAdoRecordSet *pRecordSet);
	BOOL _MoveSelect(int nItem);    //移到数据库指针到指定位置
	BOOL _MoveSelect(CString sKey, int nMode);    //移到数据库指针到指定位置
    BOOL _CheckKey(CString &sNewKey);  //主键是否为一
//初始化
    BOOL Init(CDialog *pDlg, CListCtrlBase *pCtrl);
	BOOL InitList();                //初设列表控件
	CListCtrlBase *GetListCtrl(){return m_pListCtrl;} //指定列表控件
	void SetListCtrl(CListCtrlBase *pCtrl){m_pListCtrl = pCtrl;} //返回列表控件
    CListCtrlBase *m_pListCtrl;
	CStringArray m_caKey;
	long m_nAutoKey;
//数据操作
	void RetrieveA();   //无作用,只为快速搜索到Retrieve()
	virtual int Retrieve(CString strSQL = _T(""),  
		          BOOL bMsg = true,
	              long lOption = adCmdText, 
				  CursorTypeEnum CursorType = adOpenStatic, 
				  LockTypeEnum LockType = adLockOptimistic);
	void NewA();
	BOOL New(BOOL bMsg = true, LPCSTR pKey = NULL);
	virtual BOOL Save(BOOL bTrans= true, BOOL bMsg = true);
    virtual int Delete(BOOL bCon = true, BOOL bMsg = true); //删除当前行
    int DeleteAll(BOOL bCon = true, BOOL bMsg = true);      //删除所有行
//介面操作
	BOOL UpdateData(BOOL bFlog = true,int iCol = CLD_CURSOR,
		            BOOL bMsg = true);//导入导出
	virtual void ResetAll();       //清除所有显示内容
	virtual BOOL IsModify(void) {return m_bModify;}; //是否修改
	void SetModify(BOOL bFlog){m_bModify=bFlog;}; //设置修改标志
	BOOL SetModify(int nItem, int nFlog);
	int  GetModify(int nItem);

//其它
	virtual void Release();
	CListDoc();
	virtual ~CListDoc();
};

#endif // !defined(AFX_LISTDOC_H__50A9C0A6_502D_4E14_88C2_CCF6FBA05E44__INCLUDED_)

⌨️ 快捷键说明

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