📄 guestpe.cpp
字号:
// guestpe.cpp : implementation file
//
#include "stdafx.h"
#include "flowerSaleSystem.h"
#include "guestpe.h"
#include "guset.h"
#include "warehouse.h"
#include "orflin.h"
#include "deor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CString m_iden;
/////////////////////////////////////////////////////////////////////////////
// guestpe property page
IMPLEMENT_DYNCREATE(guestpe, CPropertyPage)
guestpe::guestpe() : CPropertyPage(guestpe::IDD)
{
//{{AFX_DATA_INIT(guestpe)
m_name = _T("");
m_phn = _T("");
m_psw = _T("");
m_user = _T("");
m_year = 0;
m_city = _T("");
//}}AFX_DATA_INIT
}
guestpe::~guestpe()
{
}
void guestpe::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(guestpe)
DDX_Control(pDX, IDC_LIST1, m_list);
DDX_Text(pDX, IDC_EDITname, m_name);
DDX_Text(pDX, IDC_EDITphn, m_phn);
DDX_Text(pDX, IDC_EDITpsw, m_psw);
DDX_Text(pDX, IDC_EDITuser, m_user);
DDX_Text(pDX, IDC_EDITyear, m_year);
DDX_Text(pDX, IDC_EDITcity, m_city);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(guestpe, CPropertyPage)
//{{AFX_MSG_MAP(guestpe)
ON_BN_CLICKED(IDC_BUTTONmodify, OnBUTTONmodify)
ON_BN_CLICKED(IDC_BUTTONrefrush, OnBUTTONrefrush)
ON_WM_PAINT()
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// guestpe message handlers
BOOL guestpe::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
guset m_set;
m_set.m_strFilter.Format("gid='%s'",m_iden);
if(m_set.Open())
{
m_user=m_set.m_gid;
m_psw=m_set.m_gpassword;
m_phn=m_set.m_gphone;
//m_year.Format("%d",m_set.m_myear);
m_year=m_set.m_gyear;
m_name=m_set.m_gname;
m_city=m_set.m_gcity;
if(m_set.m_gsex=="男") CheckRadioButton(IDC_RADIO,IDC_RADIO3,IDC_RADIO);
else CheckRadioButton(IDC_RADIO,IDC_RADIO3,IDC_RADIO3);
}
m_set.Close();
CWnd *wnd1=GetDlgItem(IDC_EDITphn);
CWnd *wnd2=GetDlgItem(IDC_EDITname);
CWnd *wnd3=GetDlgItem(IDC_EDITuser);
CWnd *wnd4=GetDlgItem(IDC_EDITpsw);
CWnd *wnd5=GetDlgItem(IDC_EDITyear);
CWnd *wnd6=GetDlgItem(IDC_RADIO);
CWnd *wnd7=GetDlgItem(IDC_EDITcity);
wnd1->EnableWindow(FALSE);
wnd2->EnableWindow(FALSE);
wnd3->EnableWindow(FALSE);
wnd4->EnableWindow(FALSE);
wnd5->EnableWindow(FALSE);
wnd6->EnableWindow(FALSE);
wnd7->EnableWindow(FALSE);
m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_list.SetBkColor(RGB(247,247,255));
m_list.SetTextColor(RGB(0,0,255));
m_list.SetTextBkColor(RGB(247,247,255));
m_font.CreateFont(16, 0,0,0,FW_NORMAL, 0,0,0,
DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Georgia");
m_list.SetFont(&m_font);
m_list.InsertColumn(0,"记录",LVCFMT_CENTER,60);
m_list.InsertColumn(1,"花号",LVCFMT_CENTER,80);
m_list.InsertColumn(2,"花名",LVCFMT_CENTER,60);
m_list.InsertColumn(3,"数量",LVCFMT_CENTER,60);
m_list.InsertColumn(4,"单价",LVCFMT_CENTER,60);
m_list.InsertColumn(5,"金额",LVCFMT_CENTER,60);
m_list.InsertColumn(6,"订购日期",LVCFMT_CENTER,100);
m_list.InsertColumn(7,"送货日期",LVCFMT_CENTER,100);
m_brush.CreateSolidBrush(RGB(0,0,0));
m_list.DeleteAllItems();
orflin or;
int n=0;
CString s;
or.m_strFilter.Format("gid='%s'",m_iden);
or.Open();
while(!or.IsEOF())
{
m_list.InsertItem(n,"");
s.Format("第%d笔",n+1);
m_list.SetItemText(n,0,s);
m_list.SetItemText(n,1,or.m_fid);
warehouse wa;
wa.m_strFilter.Format("wid='%s'",or.m_fid);
wa.Open();
m_list.SetItemText(n,2,wa.m_wnaem);
wa.Close();
s.Format("%d",or.m_amount);
m_list.SetItemText(n,3,s);
s.Format("%g",or.m_salePrice);
m_list.SetItemText(n,4,s);
s.Format("%g",or.m_salePrice*or.m_amount);
m_list.SetItemText(n,5,s);
s=or.m_orderDate.Format("%Y-%m-%d");
m_list.SetItemText(n,6,s);
if(or.m_state==0)m_list.SetItemText(n,7,"发货中..");
else
{
deor dr;
dr.m_strFilter.Format("oid='%s'",or.m_oid);
dr.Open();
s=dr.m_dealDate.Format("%Y-%m-%d");
m_list.SetItemText(n,7,s);
dr.Close();
}
n++;
or.MoveNext();
}
or.Close();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void guestpe::OnBUTTONmodify()
{
// TODO: Add your control notification handler code here
CString bttext;
CWnd *wnd=GetDlgItem(IDC_BUTTONmodify);
GetDlgItemText(IDC_BUTTONmodify,bttext);
if(bttext=="我要修改")
{
CWnd *wnd1=GetDlgItem(IDC_EDITphn);
CWnd *wnd2=GetDlgItem(IDC_EDITname);
//CWnd *wnd3=GetDlgItem(IDC_EDITuser);
CWnd *wnd4=GetDlgItem(IDC_EDITpsw);
CWnd *wnd5=GetDlgItem(IDC_EDITyear);
CWnd *wnd6=GetDlgItem(IDC_RADIO);
CWnd *wnd7=GetDlgItem(IDC_EDITcity);
CWnd *wnd8=GetDlgItem(IDC_RADIO3);
wnd1->EnableWindow(TRUE);
wnd2->EnableWindow(TRUE);
wnd4->EnableWindow(TRUE);
wnd5->EnableWindow(TRUE);
wnd6->EnableWindow(TRUE);
wnd7->EnableWindow(TRUE);
wnd8->EnableWindow(TRUE);
wnd->SetWindowText("确定修改");
}
else
{
UpdateData(TRUE);
if(m_name.GetLength()>6)
{
MessageBox("此系统只支持汉族名字,最多三个汉字!","温馨提示");
return;
}
if(m_psw.GetLength()>6)
{
MessageBox("此系统最多支持6位的密码!","温馨提示");
return;
}
if(m_phn.GetLength()>12)
{
MessageBox("此系统最多支持12位的电话号码!","温馨提示");
return;
}
if(m_city.GetLength()>8)
{
MessageBox("此系统最多支持4个汉字的城市!","温馨提示");
return;
}
guset de;
de.m_strFilter.Format("gid='%s'",m_iden);
if(de.Open())
{
de.Edit();
de.m_gid=m_iden;
de.m_gname=m_name;
int temp=GetCheckedRadioButton(IDC_RADIO,IDC_RADIO3);
if(temp==IDC_RADIO) de.m_gsex="男";
else de.m_gsex="女";
de.m_gyear=m_year;
de.m_gphone=m_phn;
de.m_gpassword=m_psw;
de.m_gcity=m_city;
}
de.Update();
de.Requery();
de.Close();
CWnd *wnd1=GetDlgItem(IDC_EDITphn);
CWnd *wnd2=GetDlgItem(IDC_EDITname);
CWnd *wnd3=GetDlgItem(IDC_EDITuser);
CWnd *wnd4=GetDlgItem(IDC_EDITpsw);
CWnd *wnd5=GetDlgItem(IDC_EDITyear);
CWnd *wnd6=GetDlgItem(IDC_RADIO);
CWnd *wnd7=GetDlgItem(IDC_EDITcity);
CWnd *wnd8=GetDlgItem(IDC_RADIO3);
wnd1->EnableWindow(FALSE);
wnd2->EnableWindow(FALSE);
wnd3->EnableWindow(FALSE);
wnd4->EnableWindow(FALSE);
wnd5->EnableWindow(FALSE);
wnd6->EnableWindow(FALSE);
wnd7->EnableWindow(FALSE);
wnd8->EnableWindow(FALSE);
wnd->SetWindowText("我要修改");
}
}
void guestpe::OnBUTTONrefrush()
{
// TODO: Add your control notification handler code here
m_list.DeleteAllItems();
orflin or;
int n=0;
CString s;
or.m_strFilter.Format("gid='%s'",m_iden);
or.Open();
while(!or.IsEOF())
{
m_list.InsertItem(n,"");
s.Format("第%d笔",n+1);
m_list.SetItemText(n,0,s);
m_list.SetItemText(n,1,or.m_fid);
warehouse wa;
wa.m_strFilter.Format("wid='%s'",or.m_fid);
wa.Open();
m_list.SetItemText(n,2,wa.m_wnaem);
wa.Close();
s.Format("%d",or.m_amount);
m_list.SetItemText(n,3,s);
s.Format("%g",or.m_salePrice);
m_list.SetItemText(n,4,s);
s.Format("%g",or.m_salePrice*or.m_amount);
m_list.SetItemText(n,5,s);
s=or.m_orderDate.Format("%Y-%m-%d");
m_list.SetItemText(n,6,s);
if(or.m_state==0)m_list.SetItemText(n,7,"发货中..");
else
{
deor dr;
dr.m_strFilter.Format("oid='%s'",or.m_oid);
dr.Open();
s=dr.m_dealDate.Format("%Y-%m-%d");
m_list.SetItemText(n,7,s);
dr.Close();
}
n++;
or.MoveNext();
}
or.Close();
}
void guestpe::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC memDC;
CBitmap bitmap;
BITMAP bmp;
bitmap.LoadBitmap(IDB_BITMAPg);
bitmap.GetObject (sizeof(BITMAP),&bmp);
memDC.CreateCompatibleDC (&dc);
memDC.SelectObject (bitmap);
dc.BitBlt (0,0,bmp.bmWidth ,bmp.bmHeight ,&memDC,0,0,SRCCOPY);
// Do not call CPropertyPage::OnPaint() for painting messages
}
HBRUSH guestpe::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_LISTBOX)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,0,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(0,255,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,255,0));
return m_brush
;
}
if(nCtlColor==CTLCOLOR_DLG)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(175,216,229)); //浅色字体
return hbr;
}if(nCtlColor==CTLCOLOR_LISTBOX)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,0,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(0,255,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,255,0));
return m_brush
;
}
if(nCtlColor==CTLCOLOR_DLG)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(175,216,229)); //浅色字体
return hbr;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -