📄 adminreaderinfo.cpp
字号:
r.SetNo(vNo);
r.SetPW(vNo);
r.SQL_Insert();
}
else
{
stype = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("RNo");
m_AdoConn.ExitConnect();
stype = stype.Mid(1);
int i=atoi(stype);
i = i+1;
stype.Format("%06d",i);
vNo += stype;
r.SetNo(vNo);
r.SetPW(vNo);
r.SQL_Insert();
}
MessageBox("注册成功!\n 帐号为:"+vNo+" 密码为: "+vNo+" 请记住帐号和密码!");
}
m_ado.Refresh();
RefreshData();
UpdateData(false);
((CButton *)GetDlgItem(IDC_BTN_QUERY))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_DATAGRID1))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_ADODC1))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_INSERT))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_DELETE))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_FRESH))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_EDIT))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_CAOZUO))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT2))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT4))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT5))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT6))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT7))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT8))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT9))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT10))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT11))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_COMBO2))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_COMBO3))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_OK))->EnableWindow(FALSE);
}
void CAdminReaderInfo::OnBtnInsert()
{
// TODO: Add your control notification handler code here
((CButton *)GetDlgItem(IDC_CAOZUO))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT1))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT2))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT4))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT5))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT6))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT7))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT10))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT11))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT8))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT9))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_COMBO2))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_COMBO3))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_OK))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_QUERY))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_DATAGRID1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_ADODC1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_INSERT))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_DELETE))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_FRESH))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_EDIT))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_PW))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_EDIT1))->SetWindowText("自动生成");
((CButton *)GetDlgItem(IDC_EDIT2))->SetWindowText("跟帐号一样");
((CButton *)GetDlgItem(IDC_EDIT7))->SetWindowText("0.0");
((CButton *)GetDlgItem(IDC_EDIT8))->SetWindowText("0");
((CButton *)GetDlgItem(IDC_EDIT9))->SetWindowText("0");
((CButton *)GetDlgItem(IDC_EDIT4))->SetWindowText("");
((CButton *)GetDlgItem(IDC_EDIT5))->SetWindowText("");
((CButton *)GetDlgItem(IDC_EDIT6))->SetWindowText("");
((CButton *)GetDlgItem(IDC_EDIT7))->SetWindowText("");
m_flag=1;
}
void CAdminReaderInfo::OnBtnFresh()
{
// TODO: Add your control notification handler code here
m_ado.Refresh();
RefreshData();
UpdateData(false);
}
void CAdminReaderInfo::OnBtnEdit()
{
// TODO: Add your control notification handler code here
((CButton *)GetDlgItem(IDC_CAOZUO))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT1))->SetWindowText(reader.GetNo());
((CButton *)GetDlgItem(IDC_EDIT2))->SetWindowText(reader.GetPW());
((CButton *)GetDlgItem(IDC_EDIT1))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT2))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT4))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT5))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT6))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT7))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT10))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT11))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT8))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT9))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_COMBO2))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_COMBO3))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_EDIT7))->SetWindowText("0.0");
((CButton *)GetDlgItem(IDC_EDIT8))->SetWindowText("0");
((CButton *)GetDlgItem(IDC_EDIT9))->SetWindowText("0");
((CButton *)GetDlgItem(IDC_BTN_OK))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_QUERY))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_DATAGRID1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_ADODC1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_INSERT))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_DELETE))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_FRESH))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_EDIT))->EnableWindow(FALSE);
m_flag=2;
}
void CAdminReaderInfo::OnBtnDelete()
{
// TODO: Add your control notification handler code here
CString str;
str.Format("%s%s%s","真的要删除帐号为: ",reader.GetNo(),"的读者??");
int res;
res = MessageBox(str,"确认删除",MB_YESNO);
if (res==IDYES)
{
if(reader.GetBrNum()==0)
{
reader.SQL_Delete(reader.GetNo());
m_ado.Refresh();
RefreshData();
UpdateData(false);
}
}
}
void CAdminReaderInfo::OnSelchangeCombo2()
{
// TODO: Add your control notification handler code here
int iType = m_Combo2.GetCurSel();
switch(iType)
{
case 0:
((CButton *)GetDlgItem(IDC_EDIT10))->SetWindowText("8");
((CButton *)GetDlgItem(IDC_EDIT11))->SetWindowText("28");
break;
case 1:
((CButton *)GetDlgItem(IDC_EDIT10))->SetWindowText("12");
((CButton *)GetDlgItem(IDC_EDIT11))->SetWindowText("60");
break;
case 2:
((CButton *)GetDlgItem(IDC_EDIT10))->SetWindowText("5");
((CButton *)GetDlgItem(IDC_EDIT11))->SetWindowText("60");
break;
}
}
BEGIN_EVENTSINK_MAP(CAdminReaderInfo, CDialog)
//{{AFX_EVENTSINK_MAP(CAdminReaderInfo)
ON_EVENT(CAdminReaderInfo, IDC_DATAGRID1, 218 /* RowColChange */, OnRowColChangeDatagrid1, VTS_PVARIANT VTS_I2)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CAdminReaderInfo::OnRowColChangeDatagrid1(VARIANT FAR* LastRow, short LastCol)
{
// TODO: Add your control notification handler code here
RefreshData();
UpdateData(false);
}
void CAdminReaderInfo::RefreshData()
{
if (m_ado.GetRecordset().GetEof()==1)
{
MessageBox("没有找到你所要的记录!请重来!");
m_RNo="";
m_RPW="";
m_RName="";
m_RAdd="";
m_RTel="";
m_RPay=0.0;
m_RNow=0;
m_RTotal=0;
//((CButton *)GetDlgItem(IDC_BTN_QUERY))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_DATAGRID1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_ADODC1))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_INSERT))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_DELETE))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_FRESH))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_EDIT))->EnableWindow(FALSE);
((CButton *)GetDlgItem(IDC_BTN_PW))->EnableWindow(FALSE);
return;
}
reader.GetData(m_DataGrid.GetItem(0));
m_RNo = reader.GetNo();
m_RPW = reader.GetPW();
m_RName = reader.GetName();
m_RAdd = reader.GetAddress();
m_RTel = reader.GetTel();
m_RPay = reader.GetPay();
m_RNow = reader.GetBrNum();
m_RTotal = reader.GetTotalNum();
CString sex, type;
sex = reader.GetSex();
if (sex == "男")
m_Combo3.SetCurSel(0);
else
m_Combo3.SetCurSel(1);
type = reader.GetType();
if(type == "学生")
{
m_Combo2.SetCurSel(0);
m_RTime = "28";
m_RMax = "8";
}
else if (type == "教师")
{
m_Combo2.SetCurSel(1);
m_RTime = "60";
m_RMax = "12";
}
else
{
m_Combo2.SetCurSel(2);
m_RTime = "60";
m_RMax = "5";
}
((CButton *)GetDlgItem(IDC_DATAGRID1))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_ADODC1))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_INSERT))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_DELETE))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_FRESH))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_EDIT))->EnableWindow(TRUE);
((CButton *)GetDlgItem(IDC_BTN_PW))->EnableWindow(TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -