📄 glyxxgl.cpp
字号:
// glyxxgl.cpp : implementation file
//
#include "stdafx.h"
#include "ordermanagement.h"
#include "glyxxgl.h"
#include "gly1.h"
#include "ADOConn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// glyxxgl dialog
ADOConn connf;
_bstr_t sSQLf;
_RecordsetPtr m_pRecordset;
glyxxgl::glyxxgl(CWnd* pParent /*=NULL*/)
: CDialog(glyxxgl::IDD, pParent)
{
//{{AFX_DATA_INIT(glyxxgl)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void glyxxgl::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(glyxxgl)
DDX_Control(pDX, IDC_LIST3, m_listCtr);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(glyxxgl, CDialog)
//{{AFX_MSG_MAP(glyxxgl)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_NOTIFY(NM_CLICK, IDC_LIST3, OnClickList3)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// glyxxgl message handlers
BOOL glyxxgl::OnInitDialog()
{
CDialog::OnInitDialog();
//初始化图标
m_imagelist.Create(16, 16,ILC_MASK,1,4);
HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON6);
m_imagelist.Add(hIcon);
//初始化列表框表头
m_listCtr.SetImageList(&m_imagelist,LVSIL_SMALL);
m_listCtr.InsertColumn(1, "管理员 ID", LVCFMT_LEFT,180);
//-- 设置单列全选,显示网格 -- //
m_listCtr.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
m_nSechType = 0;
this->oSBindList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void glyxxgl::oSBindList()
{
ADOConn conn;
_RecordsetPtr m_pRecordset;
_bstr_t vSQL;
int nItem;
CString sKey;
m_listCtr.DeleteAllItems();
vSQL= "select * from Admin ";
m_pRecordset = conn.GetRecordSet(vSQL);
while(!m_pRecordset->adoEOF)
{
conn.vOID = m_pRecordset->GetCollect("AdminID");
// -- 添加数据到列表控件中 -- //
nItem = m_listCtr.InsertItem(0xffff,(_bstr_t)conn.vOID,0);//;
m_listCtr.SetItemText(nItem,1,(_bstr_t)conn.vCID);
m_pRecordset->MoveNext();
}
// m_pRecordset->Close();
conn.ExitConnect();
}
void glyxxgl::OnOK()
{
UpdateData(false);
m_ncurrSel = -1;
m_nSechType = 0;
this->oSBindList();
}
void glyxxgl::OnButton1()
{
if(m_ncurrSel < 0)
AfxMessageBox("请在列表中选中要删除的项!");
else
{
if(MessageBox("是否确定删除?","请确认",MB_YESNO) == IDYES)
{
try
{
if(connf.m_pConn == NULL)
connf.OnInitADOConn();
glyxxglFormDel(IID);
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
}
}
glyxxgl::OnOK();
}
//删除生产单
void glyxxgl::glyxxglFormDel(CString pID)
{
sSQLf = "DELETE FROM Admin WHERE AdminID='"+pID+"'";
if(connf.ExecuteSQL(sSQLf))
{
AfxMessageBox("管理员删除!");
m_nSechType = 0;
this->oSBindList();
}
}
void glyxxgl::OnClickList3(NMHDR* pNMHDR, LRESULT* pResult)
{
m_ncurrSel = m_listCtr.GetSelectionMark();//获当前行值
if(m_ncurrSel >= 0)
{
IID = m_listCtr.GetItemText(m_ncurrSel,0);//取当前项的订单号,0表示列号
Date = m_listCtr.GetItemText(m_ncurrSel,10);//取当前项的截止有效时间
}
*pResult = 0;
}
void glyxxgl::OnButton2()
{
gly dd;
dd.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -