📄 createusers.cpp
字号:
void CCreateUsers::OnCancel()
{
update();
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
void CUpdateUsers::OnUpdate()
{
UpdateData(true);
if(m_pass != m_configpass)
{
AfxMessageBox(IDS_AFFIRM_PASS);
return ;
}
for(int i=0;i<m_telphone.GetLength();i++)
{
char dc=m_telphone.GetAt(i);
if(dc>'9'||dc<'0')
{
AfxMessageBox(IDS_TELNUMBER);
return;
}
}
if(!m_email.IsEmpty()&&(m_email.Find("@")==-1))
{
AfxMessageBox(IDS_EMAIL_ERROR);
return ;
}
for(int m=0;m<m_length;m++)
{
if(!strcmp(m_user[m].name,m_name))
{
strcpy(m_user[m].fullname,m_fullname);
strcpy(m_user[m].password,m_pass);
strcpy(m_user[m].description,m_description);
strcpy(m_user[m].address,m_address);
strcpy(m_user[m].email,m_email);
strcpy(m_user[m].telphone,m_telphone);
break;
}
}
Cfileoperation <User_Information> *m_fileoperation;
m_fileoperation->savefile(m_user_management_directory,"wb+",m_user,m_length);
AfxMessageBox(ID_UPDATE_USER_OK);
update();
}
void CUpdateUsers::Ondel()
{
UpdateData(true);
CString m_temstr;
m_temstr.Format(IDS_AdDMINISTRATOR);
if(!strcmp(m_temstr,m_name))
return;
for(int m=0;m<m_length;m++)
{
if(!strcmp(m_user[m].name,m_name))
{
strcpy(m_user[m].name ,"");
break ;
}
}
Cfileoperation <User_Information> *m_fileoperation;
m_fileoperation->savefilename(m_user_management_directory,"wb+",m_user,m_length);
Ondelotherfile();
AfxMessageBox(ID_DELETE_USER_OK);
update();
}
void CUpdateUsers::update()
{
m_description = _T("");
m_fullname = _T("");
m_name = _T("");
m_pass = _T("");
m_configpass = _T("");
m_address= _T("");
m_email= _T("");
m_telphone= _T("");
UpdateData(false);
}
void CUpdateUsers::Ondelotherfile()
{
Popedom_Setting m_popedom[120];
Cfileoperation <Popedom_Setting> *m_fileoperation;
int m_length=m_fileoperation->openfile(m_popedom_directory,"ab+",m_popedom);
for(int i=0;i<m_length;i++)
{
if(!strcmp(m_name,m_popedom[i].name))
strcpy(m_popedom[i].name ,"");
}
m_fileoperation->savefilename(m_popedom_directory,"wb+",m_popedom,m_length);
}
void CUpdateUsers::OnSelchangeName()
{
int index=m_namectrl.GetCurSel();
if (index!=CB_ERR)
{
m_namectrl.GetLBText(index,m_name);
}
for(int m=0;m<m_length;m++)
{
if(!strcmp(m_user[m].name,m_name))
{
m_fullname.Format(m_user[m].fullname);
m_pass.Format(m_user[m].password);
m_configpass.Format(m_user[m].password);
m_description.Format(m_user[m].description);
m_address.Format(m_user[m].address);
m_telphone.Format(m_user[m].telphone);
m_email.Format(m_user[m].email);
UpdateData(false);
return ;
}
}
}
void CUpdateUsers::OnSetfocusName()
{
m_namectrl.ResetContent();
int index=m_namectrl.GetCurSel();
if (index!=CB_ERR)
{
m_namectrl.GetLBText(index,m_name);
}
Cfileoperation <User_Information> *m_fileoperation;
m_length=m_fileoperation->openfile(m_user_management_directory,"ab+",m_user);
for(int m=0;m<m_length;m++)
m_namectrl.AddString(m_user[m].name);
UpdateData(false);
}
void CUpdateUsers::OnCancel()
{
update();
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
void CPopedomSet::OnSave()
{
CString m_str;
UpdateData(true);
if(m_name.IsEmpty()) return;
m_str.Format(IDS_AdDMINISTRATOR);
if(m_name == m_str) return;
for(int i=0;i<m_length;i++)
{
if(!strcmp(m_popedom[i].name,m_name))
{
m_popedom[i].alarm=m_alarm;
m_popedom[i].backup=m_backup;
m_popedom[i].channel=m_channel;
m_popedom[i].localrecord=m_localrecord;
m_popedom[i].localset=m_localset;
m_popedom[i].moverecord=m_moverecord;
strcpy(m_popedom[i].name,m_name);
m_popedom[i].ptzctrl=m_ptzctrl;
m_popedom[i].record=m_record;
m_popedom[i].remoteos=m_remoteos ;
m_popedom[i].timerecord=m_timerecord;
m_popedom[i].vedio=m_vedio;
}
}
Cfileoperation <Popedom_Setting> *m_fileoperation;
m_fileoperation->savefile(m_popedom_directory,"wb+",m_popedom,m_length);
CString m_logfile;
m_logfile.Format(IDS_POPEDOM_SET);
write_log_file(m_logfile);
AfxMessageBox(IDS_SET_POPEDOM_OK);
}
void CPopedomSet::OnCancel()
{
m_alarm = FALSE;
m_backup = FALSE;
m_channel = FALSE;
m_localrecord = FALSE;
m_localset = FALSE;
m_moverecord = FALSE;
m_name = _T("");
m_ptzctrl = FALSE;
m_record = FALSE;
m_remoteos = FALSE;
m_timerecord = FALSE;
m_vedio = FALSE;
UpdateData(false);
}
void CPopedomSet::OnSetfocusCombo1()
{
m_namectrl.ResetContent();
Cfileoperation <Popedom_Setting> *m_fileoperation;
m_length=m_fileoperation->openfile(m_popedom_directory,"ab+",m_popedom);
for(int m=0;m<m_length;m++)
{
m_namectrl.AddString(m_popedom[m].name);
}
UpdateData(false);
}
void CPopedomSet::OnCheck1()
{
if(m_checkbool)
{
m_alarm = FALSE;
m_backup = FALSE;
m_channel = FALSE;
m_localrecord = FALSE;
m_localset = FALSE;
m_moverecord = FALSE;
m_ptzctrl = FALSE;
m_record = FALSE;
m_remoteos = FALSE;
m_timerecord = FALSE;
m_vedio = FALSE;
m_checkbool=FALSE;
}
else
{
m_alarm = TRUE;
m_backup = TRUE;
m_channel = TRUE;
m_localrecord = TRUE;
m_localset = TRUE;
m_moverecord = TRUE;
m_ptzctrl = TRUE;
m_record = TRUE;
m_remoteos = TRUE;
m_timerecord = TRUE;
m_vedio = TRUE;
m_checkbool=TRUE;
}
UpdateData(false);
}
void CPopedomSet::OnSelchangeName()
{
int m_length=m_namectrl.GetCount();
int index=m_namectrl.GetCurSel();
if (index!=CB_ERR)
{
m_namectrl.GetLBText(index,m_name);
}
for(int i=0;i<m_length;i++)
{
if(!strcmp(m_popedom[i].name,m_name))
{
m_alarm = m_popedom[i].alarm;
m_backup = m_popedom[i].backup;
m_channel = m_popedom[i].channel;
m_localrecord = m_popedom[i].localrecord;
m_localset = m_popedom[i].localset;
m_moverecord = m_popedom[i].moverecord;
m_name.Format(m_popedom[i].name);
m_ptzctrl = m_popedom[i].ptzctrl;
m_record = m_popedom[i].record;
m_remoteos = m_popedom[i].remoteos;
m_timerecord = m_popedom[i].timerecord;
m_vedio = m_popedom[i].vedio;
UpdateData(false);
return ;
}
}
}
HBRUSH CUpdateUsers::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor==CTLCOLOR_DLG)
return (HBRUSH)m_brush .GetSafeHandle( ) ;
return hbr;
}
HBRUSH CCreateUsers::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor==CTLCOLOR_DLG)
return (HBRUSH)m_brush .GetSafeHandle( ) ;
return hbr;
}
HBRUSH CPopedomSet::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor==CTLCOLOR_DLG)
return (HBRUSH)m_brush .GetSafeHandle( ) ;
return hbr;
}
BOOL CCreateUsers::OnInitDialog()
{
CPropertyPage::OnInitDialog();
init_label(m_lable1);
init_label(m_lable2);
init_label(m_lable3);
init_label(m_lable4);
init_label(m_lable5);
init_label(m_lable6);
init_label(m_lable7);
init_label(m_lable8);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CUpdateUsers::OnInitDialog()
{
CPropertyPage::OnInitDialog();
init_label(m_lable1);
init_label(m_lable2);
init_label(m_lable3);
init_label(m_lable4);
init_label(m_lable5);
init_label(m_lable6);
init_label(m_lable7);
init_label(m_lable8);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CPopedomSet::OnInitDialog()
{
CPropertyPage::OnInitDialog();
init_label(m_lable1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -