加载房间数据,给按钮设置文字
This commit is contained in:
parent
6d5c509d01
commit
37e38afa13
310
aike/IDNameDlg.cpp
Normal file
310
aike/IDNameDlg.cpp
Normal file
@ -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<LPNMITEMACTIVATE>(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;
|
||||
}
|
||||
|
44
aike/IDNameDlg.h
Normal file
44
aike/IDNameDlg.h
Normal file
@ -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);
|
||||
};
|
@ -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("温馨提示"));
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
@ -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;
|
||||
|
||||
|
BIN
aike/aike.rc
BIN
aike/aike.rc
Binary file not shown.
@ -191,6 +191,7 @@
|
||||
<ClInclude Include="CouponDlg.h" />
|
||||
<ClInclude Include="DiscountDlg.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="IDNameDlg.h" />
|
||||
<ClInclude Include="LogInDlg.h" />
|
||||
<ClInclude Include="MemberSetUpDlg.h" />
|
||||
<ClInclude Include="ParameterDlg.h" />
|
||||
@ -208,6 +209,7 @@
|
||||
<ClCompile Include="CommodityDlg.cpp" />
|
||||
<ClCompile Include="CouponDlg.cpp" />
|
||||
<ClCompile Include="DiscountDlg.cpp" />
|
||||
<ClCompile Include="IDNameDlg.cpp" />
|
||||
<ClCompile Include="LogInDlg.cpp" />
|
||||
<ClCompile Include="MemberSetUpDlg.cpp" />
|
||||
<ClCompile Include="ParameterDlg.cpp" />
|
||||
|
@ -63,6 +63,9 @@
|
||||
<ClInclude Include="LogInDlg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IDNameDlg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="aike.cpp">
|
||||
@ -104,6 +107,9 @@
|
||||
<ClCompile Include="LogInDlg.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IDNameDlg.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="aike.rc">
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
//点击商品设置
|
||||
|
@ -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 最小化
|
||||
|
10
aike/pch.h
10
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user