From 37e38afa13ddbf357f1cf4f92d9af65f1c47f1e8 Mon Sep 17 00:00:00 2001 From: ~ Alone <1197284744@qq.com> Date: Thu, 23 May 2024 00:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=88=BF=E9=97=B4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=EF=BC=8C=E7=BB=99=E6=8C=89=E9=92=AE=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aike/IDNameDlg.cpp | 310 ++++++++++++++++++++++++++++++++++++++ aike/IDNameDlg.h | 44 ++++++ aike/LogInDlg.cpp | 15 +- aike/RoomSetUpDlg.cpp | 164 ++++++++++++++++++++ aike/RoomSetUpDlg.h | 12 +- aike/aike.h | 3 + aike/aike.rc | Bin 19032 -> 21860 bytes aike/aike.vcxproj | 2 + aike/aike.vcxproj.filters | 6 + aike/aikeDlg.cpp | 33 +++- aike/aikeDlg.h | 14 +- aike/pch.h | 10 ++ aike/resource.h | 9 +- 13 files changed, 596 insertions(+), 26 deletions(-) create mode 100644 aike/IDNameDlg.cpp create mode 100644 aike/IDNameDlg.h diff --git a/aike/IDNameDlg.cpp b/aike/IDNameDlg.cpp new file mode 100644 index 0000000..227a4a8 --- /dev/null +++ b/aike/IDNameDlg.cpp @@ -0,0 +1,310 @@ +// IDNameDlg.cpp: 实现文件 +// + +#include "pch.h" +#include "aike.h" +#include "aikeDlg.h" +#include "afxdialogex.h" +#include "IDNameDlg.h" + + +// IDNameDlg 对话框 + +IMPLEMENT_DYNAMIC(IDNameDlg, MyDialog) + +IDNameDlg::IDNameDlg(CWnd* pParent /*=nullptr*/) + : MyDialog(IDD_IDNAMEDLG, pParent) +{ + m_Parent = pParent; +} + +IDNameDlg::~IDNameDlg() +{ +} + +void IDNameDlg::DoDataExchange(CDataExchange* pDX) +{ + MyDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_LIST1, m_List); +} + + +BEGIN_MESSAGE_MAP(IDNameDlg, MyDialog) + ON_BN_CLICKED(IDOK, &IDNameDlg::OnBnClickedOk) + ON_NOTIFY(NM_CLICK, IDC_LIST1, &IDNameDlg::OnNMClickList1) +END_MESSAGE_MAP() + + +// IDNameDlg 消息处理程序 + + +void IDNameDlg::OnBnClickedOk() +{ + // TODO: 在此添加控件通知处理程序代码 + +} + + +BOOL IDNameDlg::OnInitDialog() +{ + MyDialog::OnInitDialog(); + + // TODO: 在此添加额外的初始化 + FixedSize(); + m_List.SetExtendedStyle(m_List.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_HEADERDRAGDROP | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); + int i = 0; + m_List.InsertColumn(i++, _T("ID"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("名称"), LVCFMT_LEFT, 120); + LoadData(); + CRect rt = { 0, 0, 75, 30 }; + rt.MoveToXY(10, 300); + AddButton(1, rt); + SetLClick(1, [this](int i) {AddClick(i); }); + SetButText(1, _T("添加")); + + rt.OffsetRect(80,0); + AddButton(2, rt); + SetLClick(2, [this](int i) {UpdateClick(i); }); + SetButText(2, _T("修改")); + + rt.OffsetRect(80, 0); + AddButton(3, rt); + SetLClick(3, [this](int i) {DeleteClick(i); }); + SetButText(3, _T("删除")); + + rt.OffsetRect(80, 0); + AddButton(4, rt); + SetLClick(4, [this](int i) {PreserveClick(i); }); + EnableButton(4, FALSE); + SetButText(4, _T("保存")); + + rt.OffsetRect(80, 0); + AddButton(5, rt); + SetLClick(5, [this](int i) {CancelClick(i); }); + EnableButton(5, FALSE); + SetButText(5, _T("取消")); + + rt.OffsetRect(80, 0); + AddButton(6, rt); + SetLClick(6, [this](int i) {CloseClick(i); }); + SetButText(6, _T("关闭")); + + return TRUE; // return TRUE unless you set the focus to a control + // 异常: OCX 属性页应返回 FALSE +} + +void IDNameDlg::LoadData() +{ + m_List.DeleteAllItems(); + CaikeDlg* dlg = (CaikeDlg*)theApp.MainDlg; + CString sqlStr,tmp; + sqlStr.Format(_T("select * from %s"), form); + _RecordsetPtr m_pRecor; + _variant_t var; + dlg->AdoSql.QuerySql(sqlStr, m_pRecor); + int i = 0; + while (!m_pRecor->GetadoEOF()) + { + var = m_pRecor->GetCollect("ID"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + } + if (tmp == _T("")) + { + m_pRecor->MoveNext(); + continue; + } + m_List.InsertItem(i, tmp); + var = m_pRecor->GetCollect("name"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_List.SetItemText(i, 1, tmp); + } + m_pRecor->MoveNext(); + i++; + } +} + +VOID IDNameDlg::AddDate() +{ + CaikeDlg* dlg = (CaikeDlg*)theApp.MainDlg; + CString name; + GetDlgItemText(IDC_EDIT2, name); + if (name.GetLength() > 10) + { + MessageBox(_T("名称不能超过十位汉字"), _T("温馨提示")); + return; + } + if (name == _T("")) + { + MessageBox(_T("名称不能为空"), _T("温馨提示")); + return; + } + CString sqlStr; + sqlStr.Format(_T("INSERT INTO %s (name) VALUES ('%s')"), form, name); + if (!dlg->AdoSql.ImplementSQL(sqlStr)) + { + MessageBox(_T("名称添加失败,请检查项目名称是否重复"), _T("温馨提示")); + } + +} + +VOID IDNameDlg::UpdateDate() +{ + CaikeDlg* dlg = (CaikeDlg*)theApp.MainDlg; + CString name, id; + GetDlgItemText(IDC_EDIT1, id); + GetDlgItemText(IDC_EDIT2, name); + if (id == _T("")) + { + return; + } + if (name.GetLength() > 10) + { + MessageBox(_T("名称不能超过十位汉字"), _T("温馨提示")); + return; + } + if (name == _T("")) + { + MessageBox(_T("名称不能为空"), _T("温馨提示")); + return; + } + CString sqlStr; + sqlStr.Format(_T("UPDATE %s set name = '%s' where ID = %s"), form, name, id); + if (!dlg->AdoSql.ImplementSQL(sqlStr)) + { + MessageBox(_T("名称添加失败,请检查项目名称是否重复"), _T("温馨提示")); + } +} + + +VOID IDNameDlg::AddClick(int ID) +{ + flag = 1; + GetDlgItem(IDC_EDIT2)->EnableWindow(TRUE); + EnableButton(1, FALSE); + EnableButton(2, FALSE); + EnableButton(3, FALSE); + EnableButton(4, TRUE); + EnableButton(5, TRUE); + PaintDlg(); +} + +VOID IDNameDlg::UpdateClick(int ID) +{ + CString tmp; + GetDlgItemText(IDC_EDIT1, tmp); + if (tmp == _T("")) + { + return; + } + flag = 2; + GetDlgItem(IDC_EDIT2)->EnableWindow(TRUE); + EnableButton(1, FALSE); + EnableButton(2, FALSE); + EnableButton(3, FALSE); + EnableButton(4, TRUE); + EnableButton(5, TRUE); + LoadData(); + PaintDlg(); +} + +VOID IDNameDlg::DeleteClick(int ID) +{ + CaikeDlg* dlg = (CaikeDlg*)theApp.MainDlg; + CString sqlStr, tmp; + GetDlgItemText(IDC_EDIT1, tmp); + if (tmp != _T("")) + { + _RecordsetPtr m_pRecor; + _variant_t var; + if (form == _T("roomregion") || form == _T("roomtype")) + { + sqlStr.Format(_T("select * from room where %s = '%s'"), form, tmp); + dlg->AdoSql.QuerySql(sqlStr, m_pRecor); + int i = 0; + if (!m_pRecor->GetadoEOF()) + { + MessageBox(_T("该名称已经使用,不允许删除"), _T("温馨提示")); + return; + } + } + sqlStr.Format(_T("delete from %s where ID = %s"), form, tmp); + if (!dlg->AdoSql.ImplementSQL(sqlStr)) + { + MessageBox(_T("SQL执行失败"), _T("温馨提示")); + } + else + { + flag = 0; + GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE); + SetDlgItemText(IDC_EDIT1, _T("")); + SetDlgItemText(IDC_EDIT2, _T("")); + LoadData(); + } + } +} + +VOID IDNameDlg::PreserveClick(int ID) +{ + if (flag == 1) + { + AddDate(); + } + else if (flag == 2) + { + UpdateDate(); + } + flag = 0; + GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE); + SetDlgItemText(IDC_EDIT1, _T("")); + SetDlgItemText(IDC_EDIT2, _T("")); + EnableButton(1, TRUE); + EnableButton(2, TRUE); + EnableButton(3, TRUE); + EnableButton(4, FALSE); + EnableButton(5, FALSE); + LoadData(); + PaintDlg(); +} + +VOID IDNameDlg::CancelClick(int ID) +{ + flag = 0; + GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE); + EnableButton(1, TRUE); + EnableButton(2, TRUE); + EnableButton(3, TRUE); + EnableButton(4, FALSE); + EnableButton(5, FALSE); + PaintDlg(); +} + +VOID IDNameDlg::CloseClick(int ID) +{ + MyDialog::OnCancel(); +} + + +void IDNameDlg::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) +{ + LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast(pNMHDR); + // TODO: 在此添加控件通知处理程序代码 + if (flag == 0) + { + if (pNMItemActivate->iItem == -1) + { + SetDlgItemText(IDC_EDIT1, _T("")); + SetDlgItemText(IDC_EDIT2, _T("")); + } + else + { + SetDlgItemText(IDC_EDIT1, m_List.GetItemText(pNMItemActivate->iItem, 0)); + SetDlgItemText(IDC_EDIT2, m_List.GetItemText(pNMItemActivate->iItem, 1)); + } + } + *pResult = 0; +} + diff --git a/aike/IDNameDlg.h b/aike/IDNameDlg.h new file mode 100644 index 0000000..874fda8 --- /dev/null +++ b/aike/IDNameDlg.h @@ -0,0 +1,44 @@ +#pragma once +#include "afxdialogex.h" + + +// IDNameDlg 对话框 + +class IDNameDlg : public MyDialog +{ + DECLARE_DYNAMIC(IDNameDlg) + +public: + IDNameDlg(CWnd* pParent = nullptr); // 标准构造函数 + virtual ~IDNameDlg(); + +// 对话框数据 +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_IDNAMEDLG }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 + + DECLARE_MESSAGE_MAP() +public: + CWnd* m_Parent = NULL; + afx_msg void OnBnClickedOk(); + virtual BOOL OnInitDialog(); + CString form; //表名 + void LoadData(); //加载数据 + int flag = 0; + CListCtrl m_List; + + VOID AddDate(); + VOID UpdateDate(); + + VOID AddClick(int ID); + VOID UpdateClick(int ID); + VOID DeleteClick(int ID); + VOID PreserveClick(int ID); + VOID CancelClick(int ID); + VOID CloseClick(int ID); + + afx_msg void OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult); +}; diff --git a/aike/LogInDlg.cpp b/aike/LogInDlg.cpp index dffec9a..a3341d5 100644 --- a/aike/LogInDlg.cpp +++ b/aike/LogInDlg.cpp @@ -4,7 +4,6 @@ #include "pch.h" #include "aike.h" #include "afxdialogex.h" -#include "LogInDlg.h" #include "aikeDlg.h" @@ -48,9 +47,11 @@ BOOL LogInDlg::OnInitDialog() rt.MoveToXY(120, 240); AddButton(1, rt); SetLClick(1, [this](int i) {LoginClick(i); }); + SetButText(1, _T("登录")); rt.MoveToXY(270, 240); AddButton(2, rt); SetLClick(2, [this](int i) {CloseClick(i); }); + SetButText(2, _T("取消")); if (IsLogin) { GetDlgItem(IDC_EDIT3)->ShowWindow(SW_HIDE); @@ -71,7 +72,6 @@ BOOL LogInDlg::OnInitDialog() VOID LogInDlg::LoginClick(int id) { - CaikeDlg* dlg = (CaikeDlg*)m_Parent; if (IsLogin) { CString Name, Pass, tmp; @@ -90,7 +90,8 @@ VOID LogInDlg::LoginClick(int id) { Name = _T("系统管理员"); } - switch (dlg->CheckUser(Name, Pass, 1)) + + switch (((CaikeDlg*)(theApp.MainDlg))->CheckUser(Name, Pass, 1)) { case 0: MessageBox(_T("账号不存在,或该账号不允许登录电脑端"), _T("温馨提示")); @@ -98,13 +99,13 @@ VOID LogInDlg::LoginClick(int id) case 1: if (sys) { - dlg->LogName = _T("系统管理员"); + ((CaikeDlg*)(theApp.MainDlg))->LogName = _T("系统管理员"); } else { - dlg->LogName = Name; + ((CaikeDlg*)(theApp.MainDlg))->LogName = Name; } - dlg->SetLogInInfo(dlg->LogName); + ((CaikeDlg*)(theApp.MainDlg))->SetLogInInfo(((CaikeDlg*)(theApp.MainDlg))->LogName); MyDialog::OnOK(); break; case 2: @@ -130,7 +131,7 @@ VOID LogInDlg::LoginClick(int id) MessageBox(_T("密码长度不能超过16位"), _T("温馨提示")); return; } - switch (dlg->ChangePass(dlg->LogName, Pass2, Pass)) + switch (((CaikeDlg*)(theApp.MainDlg))->ChangePass(((CaikeDlg*)(theApp.MainDlg))->LogName, Pass2, Pass)) { case 0: MessageBox(_T("账号不存在"), _T("温馨提示")); diff --git a/aike/RoomSetUpDlg.cpp b/aike/RoomSetUpDlg.cpp index 0d3952a..9448912 100644 --- a/aike/RoomSetUpDlg.cpp +++ b/aike/RoomSetUpDlg.cpp @@ -5,6 +5,7 @@ #include "aike.h" #include "afxdialogex.h" #include "RoomSetUpDlg.h" +#include "aikeDlg.h" // RoomSetUpDlg 对话框 @@ -24,10 +25,15 @@ RoomSetUpDlg::~RoomSetUpDlg() void RoomSetUpDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); + DDX_Control(pDX, IDC_LIST1, m_List); } BEGIN_MESSAGE_MAP(RoomSetUpDlg, CDialogEx) + ON_BN_CLICKED(IDC_BUTTON1, &RoomSetUpDlg::OnBnClickedButton1) + ON_BN_CLICKED(IDC_BUTTON5, &RoomSetUpDlg::OnBnClickedButton5) + ON_BN_CLICKED(IDC_BUTTON6, &RoomSetUpDlg::OnBnClickedButton6) + ON_BN_CLICKED(IDC_BUTTON7, &RoomSetUpDlg::OnBnClickedButton7) END_MESSAGE_MAP() @@ -48,3 +54,161 @@ void RoomSetUpDlg::OnOK() //CDialogEx::OnOK(); } + + +void RoomSetUpDlg::OnBnClickedButton1() +{ + // TODO: 在此添加控件通知处理程序代码 + +} + + +void RoomSetUpDlg::OnBnClickedButton5() +{ + // TODO: 在此添加控件通知处理程序代码 + IDNameDlg dlg(this); + dlg.form = _T("roomtype"); + dlg.DoModal(); +} + + +void RoomSetUpDlg::OnBnClickedButton6() +{ + // TODO: 在此添加控件通知处理程序代码 + IDNameDlg dlg(this); + dlg.form = _T("roomregion"); + dlg.DoModal(); +} + + +void RoomSetUpDlg::OnBnClickedButton7() +{ + // TODO: 在此添加控件通知处理程序代码 + IDNameDlg dlg(this); + dlg.form = _T("roomstyle"); + dlg.DoModal(); +} + +VOID RoomSetUpDlg::LoadRoom() +{ + CaikeDlg* dlg = (CaikeDlg*)theApp.MainDlg; + RoomInfo = Json(); + m_List.DeleteAllItems(); + _RecordsetPtr m_pRecor; + _variant_t var; + CString str = (_T("select a.roomID,a.bedcount,a.roomfloor,b.name 'roomtype',c.name 'roomregion',d.name 'roomstyle1',e.name 'roomstyle2',f.name 'roomstyle3',g.name 'roomstyle4',h.name 'BillingRules' from room a left join roomtype b on a.roomtype = b.ID left join roomregion c on a.roomregion = c.id left join roomstyle d on a.roomstyle1 = d.id left join roomstyle e on a.roomstyle2 = e.id left join roomstyle f on a.roomstyle3 = f.id left join roomstyle g on a.roomstyle4 = g.id left join BillingRules h on a.BillingRules = h.id")), tmp, roomId, roomStyle; + dlg->AdoSql.QuerySql(str, m_pRecor); + int i = 0; + while (!m_pRecor->GetadoEOF()) + { + Json tmpRoom,tmpStyle; + var = m_pRecor->GetCollect("roomID"); + if (var.vt != VT_NULL) + { + roomId = (LPCTSTR)_bstr_t(var); + if (roomId == _T("")) + { + m_pRecor->MoveNext(); + continue; + } + m_List.InsertItem(i, roomId); + } + else + { + m_pRecor->MoveNext(); + continue; + } + var = m_pRecor->GetCollect("bedcount"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_List.SetItemText(i, 1, tmp + _T("位")); + tmpRoom["bedcount"] = tmp; + } + var = m_pRecor->GetCollect("roomtype"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_List.SetItemText(i, 2, tmp); + tmpRoom["roomtype"] = tmp; + } + var = m_pRecor->GetCollect("roomregion"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_List.SetItemText(i, 3, tmp); + tmpRoom["roomregion"] = tmp; + } + var = m_pRecor->GetCollect("roomfloor"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_List.SetItemText(i, 4, tmp + _T("楼")); + tmpRoom["roomfloor"] = tmp; + } + var = m_pRecor->GetCollect("BillingRules"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_List.SetItemText(i, 5, tmp); + tmpRoom["BillingRules"] = tmp; + } + var = m_pRecor->GetCollect("roomstyle1"); + roomStyle = _T(""); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + tmpStyle = tmp; + tmpRoom["roomstyle"].append(tmpStyle); + roomStyle += tmp + _T(","); + } + var = m_pRecor->GetCollect("roomstyle2"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + tmpStyle = tmp; + tmpRoom["roomstyle"].append(tmpStyle); + roomStyle += tmp + _T(","); + } + var = m_pRecor->GetCollect("roomstyle3"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + tmpStyle = tmp; + tmpRoom["roomstyle"].append(tmpStyle); + roomStyle += tmp + _T(","); + } + var = m_pRecor->GetCollect("roomstyle4"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + tmpStyle = tmp; + tmpRoom["roomstyle"].append(tmpStyle); + roomStyle += tmp + _T(","); + } + m_List.SetItemText(i, 6, roomStyle); + m_pRecor->MoveNext(); + RoomInfo[roomId] = tmpRoom; + i++; + } + +} + + +BOOL RoomSetUpDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); + + // TODO: 在此添加额外的初始化 + m_List.SetExtendedStyle(m_List.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_HEADERDRAGDROP | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); + int i = 0; + m_List.InsertColumn(i++, _T("房间号"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("床位"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("类型"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("区域"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("楼层"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("计费方案"), LVCFMT_LEFT, 60); + m_List.InsertColumn(i++, _T("风格"), LVCFMT_LEFT, 60); + return TRUE; // return TRUE unless you set the focus to a control + // 异常: OCX 属性页应返回 FALSE +} diff --git a/aike/RoomSetUpDlg.h b/aike/RoomSetUpDlg.h index 75338bd..e3b08c2 100644 --- a/aike/RoomSetUpDlg.h +++ b/aike/RoomSetUpDlg.h @@ -1,6 +1,6 @@ #pragma once #include "afxdialogex.h" - +#include "IDNameDlg.h" // RoomSetUpDlg 对话框 @@ -23,4 +23,14 @@ protected: DECLARE_MESSAGE_MAP() virtual void OnCancel(); virtual void OnOK(); +public: + afx_msg void OnBnClickedButton1(); + afx_msg void OnBnClickedButton5(); + afx_msg void OnBnClickedButton6(); + afx_msg void OnBnClickedButton7(); + VOID LoadRoom(); + CListCtrl m_List; + virtual BOOL OnInitDialog(); + Json RoomInfo; + }; diff --git a/aike/aike.h b/aike/aike.h index dc3d077..d299930 100644 --- a/aike/aike.h +++ b/aike/aike.h @@ -19,7 +19,9 @@ class CaikeApp : public CWinApp { public: CaikeApp(); + CWnd* MainDlg = NULL; + // 重写 public: virtual BOOL InitInstance(); @@ -30,3 +32,4 @@ public: }; extern CaikeApp theApp; + diff --git a/aike/aike.rc b/aike/aike.rc index 70d86d191ae831577c2f43aa011f689c5fba5b89..b0c88980d015b1d6209df6cf654d0140934530a6 100644 GIT binary patch delta 825 zcmaJFyzW@8*`DfvJOV|!IHl)A= z4dT!SNl-z-rRFm%gyrbZH|rxZeIJB8^g#uB;T4Qh4MCA`aY!SEyM1jVRs0ri6%_W? zaXXZm^5P_kqf(_f^84#6+Y6cE$TXM?+1WjLw>rOIm%Y$Bp*2<>C&rs@;J(h$w Wxqws6RUiD9d$ebadwJJ;S@RnaV73qd delta 81 zcmaE|it)x2#tkAuo6pIyF>=@^eVMwiJFkB70U58!avnmHtrX-or-`QtPqyOUu=$gI k59j1_){{01SWV;He8%M;<77Wism*d8UMyhw7T*W#074ERd;kCd diff --git a/aike/aike.vcxproj b/aike/aike.vcxproj index 7cf9369..c01ff6e 100644 --- a/aike/aike.vcxproj +++ b/aike/aike.vcxproj @@ -191,6 +191,7 @@ + @@ -208,6 +209,7 @@ + diff --git a/aike/aike.vcxproj.filters b/aike/aike.vcxproj.filters index 6b9e12b..f11d6a8 100644 --- a/aike/aike.vcxproj.filters +++ b/aike/aike.vcxproj.filters @@ -63,6 +63,9 @@ 头文件 + + 头文件 + @@ -104,6 +107,9 @@ 源文件 + + 源文件 + diff --git a/aike/aikeDlg.cpp b/aike/aikeDlg.cpp index f310dfd..2ac333b 100644 --- a/aike/aikeDlg.cpp +++ b/aike/aikeDlg.cpp @@ -53,6 +53,7 @@ END_MESSAGE_MAP() BOOL CaikeDlg::OnInitDialog() { MyDialog::OnInitDialog(); + theApp.MainDlg = this; Initialize(); return TRUE; // 除非将焦点设置到控件,否则返回 TRUE @@ -243,7 +244,6 @@ VOID CaikeDlg::Initialize() AddButton(600, rt, img, img1, img1, img1); SetLClick(600, [this](int i) {SetUpClick(i); }); - rt = { 0,0,180,40 }; AddButton(5, rt); SetLogInInfo(_T("未登录")); @@ -278,6 +278,8 @@ VOID CaikeDlg::Initialize() exit(0); } MoveAllWin(); + + TrayMylcon(TRUE); } @@ -598,6 +600,10 @@ VOID CaikeDlg::SetLogInInfo(CString info) HDC hdc = img.GetDC(); SetBkMode(hdc, TRANSPARENT); FillRect(hdc, CRect(0, 0, 180, 40), CreateSolidBrush(RGB(0, 255, 0))); + CFont font;//用来设置大小、样式,颜色用dc.SetTextColor设置 + font.CreatePointFont(120, _T("微软雅黑")); + SelectObject(hdc, font); + TextOut(hdc, 0, 0, _T("爱客"), 2); TextOut(hdc, 0, 20, _T("软件"), 2); TextOut(hdc, 50, 10, info, info.GetLength()); @@ -616,47 +622,57 @@ VOID CaikeDlg::SetUpClick(int id) HideAllBt(); CRect rt = { 0,0,100,30 }; rt.MoveToXY(30, 50); - if (AddButton(1001, rt)) + if (AddButton(101, rt)) { - SetLClick(1001, [this](int i) {HomepageClick(i); }); + SetLClick(101, [this](int i) {HomepageClick(i); }); + SetButText(101, _T("主页")); rt.MoveToXY(30, 90); AddButton(601, rt); SetLClick(601, [this](int i) {RoomSetUpClick(i); }); - + SetButText(601,_T("房间设置")); + rt.MoveToXY(30, 130); AddButton(602, rt); SetLClick(602, [this](int i) {CommodityClick(i); }); + SetButText(602, _T("商品信息")); rt.MoveToXY(30, 170); AddButton(603, rt); SetLClick(603, [this](int i) {PaymentClick(i); }); + SetButText(603, _T("付款方式")); rt.MoveToXY(30, 210); AddButton(604, rt); SetLClick(604, [this](int i) {MemberSetUpClick(i); }); + SetButText(604, _T("会员设置")); rt.MoveToXY(30, 250); AddButton(605, rt); SetLClick(605, [this](int i) {DiscountClick(i); }); + SetButText(605, _T("折扣方案")); rt.MoveToXY(30, 290); AddButton(606, rt); SetLClick(606, [this](int i) {StaffClick(i); }); + SetButText(606, _T("员工信息")); rt.MoveToXY(30, 330); AddButton(607, rt); SetLClick(607, [this](int i) {PrintSetUpClick(i); }); + SetButText(607, _T("打印设置")); rt.MoveToXY(30, 370); AddButton(608, rt); SetLClick(608, [this](int i) {CouponClick(i); }); + SetButText(608, _T("票券设置")); rt.MoveToXY(30, 410); AddButton(609, rt); SetLClick(609, [this](int i) {ParameterClick(i); }); + SetButText(609, _T("参数设置")); } - ShowButton(1001, TRUE); + ShowButton(101, TRUE); ShowButton(601, TRUE); ShowButton(602, TRUE); ShowButton(603, TRUE); @@ -681,7 +697,7 @@ VOID CaikeDlg::HomepageClick(int id) m_CouponDlg.ShowWindow(SW_HIDE); m_ParameterDlg.ShowWindow(SW_HIDE); - ShowButton(1001, FALSE); + ShowButton(101, FALSE); ShowButton(601, FALSE); ShowButton(602, FALSE); ShowButton(603, FALSE); @@ -698,6 +714,10 @@ VOID CaikeDlg::HomepageClick(int id) //点击房间设置 VOID CaikeDlg::RoomSetUpClick(int id) { + if (!CheckAuthority(_T("601"))) + { + return; + } m_CommodityDlg.ShowWindow(SW_HIDE); PaymentDlg.ShowWindow(SW_HIDE); MemberSetUpDlg.ShowWindow(SW_HIDE); @@ -707,6 +727,7 @@ VOID CaikeDlg::RoomSetUpClick(int id) m_CouponDlg.ShowWindow(SW_HIDE); m_ParameterDlg.ShowWindow(SW_HIDE); m_RoomSetUpDlg.ShowWindow(SW_SHOW); + m_RoomSetUpDlg.LoadRoom(); } //点击商品设置 diff --git a/aike/aikeDlg.h b/aike/aikeDlg.h index 9cb2925..b59c5d4 100644 --- a/aike/aikeDlg.h +++ b/aike/aikeDlg.h @@ -3,16 +3,6 @@ // #pragma once -#include "StaffDlg.h" -#include "RoomSetUpDlg.h" -#include "CommodityDlg.h" -#include "DiscountDlg.h" -#include "MemberSetUpDlg.h" -#include "PaymentDlg.h" -#include "PrintSetUpDlg.h" -#include "CouponDlg.h" -#include "ParameterDlg.h" -#include "LogInDlg.h" // CaikeDlg 对话框 class CaikeDlg : public MyDialog @@ -41,6 +31,7 @@ protected: DECLARE_MESSAGE_MAP() public: //变量 + ADOSQL AdoSql; //连接数据库 //SocketClien SClien; //连接服务器 CString m_Path; //本程序路径 @@ -82,7 +73,7 @@ public: BOOL CheckAuthority(CString Authority); //检查权限 INT CheckUser(CString Name, CString Pass, int type); //检查账号密码 INT ChangePass(CString Name, CString OPass, CString NPass); //修改密码 - VOID SetLogInInfo(CString info); //设置登录信息 + VOID SetLogInInfo(CString info);//设置登录信息 VOID SetUpClick(int id); //设置按钮 VOID HomepageClick(int id); //回到主页 VOID RoomSetUpClick(int id); //点击房间设置 @@ -99,6 +90,7 @@ public: }; + //按钮对照表 /* 1 最小化 diff --git a/aike/pch.h b/aike/pch.h index 9425adc..60c7143 100644 --- a/aike/pch.h +++ b/aike/pch.h @@ -19,5 +19,15 @@ #endif +#include "StaffDlg.h" +#include "RoomSetUpDlg.h" +#include "CommodityDlg.h" +#include "DiscountDlg.h" +#include "MemberSetUpDlg.h" +#include "PaymentDlg.h" +#include "PrintSetUpDlg.h" +#include "CouponDlg.h" +#include "ParameterDlg.h" +#include "LogInDlg.h" #endif //PCH_H diff --git a/aike/resource.h b/aike/resource.h index 2213260..71ebc65 100644 --- a/aike/resource.h +++ b/aike/resource.h @@ -15,16 +15,23 @@ #define IDD_DISCOUNTDLG 140 #define IDD_PARAMENTERDLG 141 #define IDD_LOGINDLG 142 +#define IDD_IDNAMEDLG 144 #define IDC_LIST1 1000 #define IDC_BUTTON1 1001 #define IDC_BUTTON2 1002 #define IDC_EDIT1 1002 #define IDC_EDIT2 1003 +#define IDC_BUTTON3 1003 #define IDC_CHECK1 1004 +#define IDC_BUTTON4 1004 #define IDC_STATIC1 1005 +#define IDC_BUTTON5 1005 #define IDC_STATIC2 1006 +#define IDC_BUTTON6 1006 #define IDC_EDIT3 1007 +#define IDC_BUTTON7 1007 #define IDC_EDIT4 1008 +#define IDC_BUTTON8 1008 #define IDC_STATIC3 1009 #define ID_32771 32771 #define ID_32772 32772 @@ -35,7 +42,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 144 +#define _APS_NEXT_RESOURCE_VALUE 146 #define _APS_NEXT_COMMAND_VALUE 32775 #define _APS_NEXT_CONTROL_VALUE 1007 #define _APS_NEXT_SYMED_VALUE 101