AgentManager/DLG_Corp_User_Modify.cpp
2025-01-22 15:45:17 +08:00

224 lines
6.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// DLG_Corp_User_Modify.cpp: 实现文件
//
#include "stdafx.h"
#include "SmsManager.h"
#include "afxdialogex.h"
#include "DLG_Corp_User_Modify.h"
#include "MainFrm.h"
#include "DLG_Corp_User.h"
#include "DLG_ChangeCM.h"
// DLG_Corp_User_Modify 对话框
IMPLEMENT_DYNAMIC(DLG_Corp_User_Modify, CDialogEx)
DLG_Corp_User_Modify::DLG_Corp_User_Modify(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_CORP_USER_MODIFY, pParent)
, m_tBirthday(COleDateTime::GetCurrentTime())
, m_strBZ(_T(""))
, m_strCreateTime(_T(""))
, m_strCreateUser(_T(""))
, m_strCM(_T(""))
, m_strEmail(_T(""))
, m_strFax(_T(""))
, m_strJob(_T(""))
, m_strLoginCount(_T(""))
, m_strLoginName(_T(""))
, m_strLoginTime(_T(""))
, m_strMobile(_T(""))
, m_strName(_T(""))
, m_strNickName(_T(""))
, m_strQQ(_T(""))
, m_lSex(0)
, m_strSMSUsed(_T(""))
, m_strSMSSendAll(_T(""))
, m_strTel(_T(""))
{
m_pUserDlg = (DLG_Corp_User*)pParent;
//memset(&m_User, 0, sizeof(m_User));
_tcscpy(m_User.szLoginName, _T("")); //不知为何如果加上前一句memset会出错只能置一个空字符串在oninit中检测以防显示脏数据
m_Pos = 0;
m_pMainFrame = NULL;
m_pDlgChangeCM = NULL;
}
DLG_Corp_User_Modify::~DLG_Corp_User_Modify()
{
}
void DLG_Corp_User_Modify::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_DateTimeCtrl(pDX, IDC_CORP_USERMODIFY_BIRTHDAY, m_tBirthday);
DDX_Text(pDX, IDC_CORP_USERMODIFY_BZ, m_strBZ);
DDV_MaxChars(pDX, m_strBZ, 50);
DDX_Text(pDX, IDC_CORP_USERMODIFY_CREATETIME, m_strCreateTime);
DDX_Text(pDX, IDC_CORP_USERMODIFY_CREATEUSER, m_strCreateUser);
DDX_Text(pDX, IDC_CORP_USERMODIFY_CM, m_strCM);
DDV_MaxChars(pDX, m_strCM, 32);
DDX_Text(pDX, IDC_CORP_USERMODIFY_EMAIL, m_strEmail);
DDV_MaxChars(pDX, m_strEmail, 30);
DDX_Text(pDX, IDC_CORP_USERMODIFY_FAX, m_strFax);
DDV_MaxChars(pDX, m_strFax, 16);
DDX_Text(pDX, IDC_CORP_USERMODIFY_JOB, m_strJob);
DDV_MaxChars(pDX, m_strJob, 16);
DDX_Text(pDX, IDC_CORP_USERMODIFY_LOGINCOUNT, m_strLoginCount);
DDX_Text(pDX, IDC_CORP_USERMODIFY_LOGINNAME, m_strLoginName);
DDV_MaxChars(pDX, m_strLoginName, 16);
DDX_Text(pDX, IDC_CORP_USERMODIFY_LOGINTIME, m_strLoginTime);
DDX_Text(pDX, IDC_CORP_USERMODIFY_MOBILE, m_strMobile);
DDV_MaxChars(pDX, m_strMobile, 16);
DDX_Text(pDX, IDC_CORP_USERMODIFY_NAME, m_strName);
DDV_MaxChars(pDX, m_strName, 16);
DDX_Text(pDX, IDC_CORP_USERMODIFY_NICKNAME, m_strNickName);
DDV_MaxChars(pDX, m_strNickName, 16);
DDX_Text(pDX, IDC_CORP_USERMODIFY_QQ, m_strQQ);
DDV_MaxChars(pDX, m_strQQ, 16);
DDX_CBIndex(pDX, IDC_CORP_USERMODIFY_SEX, m_lSex);
DDX_Text(pDX, IDC_CORP_USERMODIFY_SMSUSED, m_strSMSUsed);
DDX_Text(pDX, IDC_CORP_USERMODIFY_SMSSENDALL, m_strSMSSendAll);
DDX_Text(pDX, IDC_CORP_USERMODIFY_TEL, m_strTel);
DDV_MaxChars(pDX, m_strTel, 16);
}
BEGIN_MESSAGE_MAP(DLG_Corp_User_Modify, CDialogEx)
ON_BN_CLICKED(IDC_CORP_USERMODIFY_CHANGECM, &DLG_Corp_User_Modify::OnBnClickedCorpUsermodifyChangecm)
END_MESSAGE_MAP()
// DLG_Corp_User_Modify 消息处理程序
void DLG_Corp_User_Modify::OnBnClickedCorpUsermodifyChangecm()
{
if (!m_pMainFrame)
{
MessageBox(_T("申请更改签名异常,请重新登录后再试"), _T("错误"), MB_ICONWARNING);
return;
}
if (GetTickCount() - m_pMainFrame->m_dwLastCMTime < 120000)
{
MessageBox(_T("请不要连续提交更改签名申请,请稍后再试!"), _T("错误"), MB_ICONWARNING);
return;
}
DLG_ChangeCM dlg(this);
m_pDlgChangeCM = &dlg;
#ifdef MANAGER_VER_YWY
long lAgentID = 0;
#else
long lAgentID = m_pMainFrame->m_lUserID;
#endif
dlg.SetParam(m_User.lCorpID, m_User.lUserID, lAgentID, m_pMainFrame, m_strCorpName, m_User.szLoginName, 1);
if (dlg.DoModal() == IDOK)
{
}
m_pDlgChangeCM = NULL;
}
void DLG_Corp_User_Modify::SetParam(CMainFrame* pFrame, CString strCorpName, ANS_Corp_UserData User, POSITION pos)
{
m_pMainFrame = pFrame;
m_strCorpName = strCorpName;
m_User = User;
m_Pos = pos;
}
ANS_Corp_UserData DLG_Corp_User_Modify::GetParam()
{
return m_User;
}
BOOL DLG_Corp_User_Modify::ProcessSocket(Socket_Head* pHead)
{
if (pHead->lFuncType == SMSFUNC_SIGNNAME_ADD ||
pHead->lFuncType == SMSFUNC_CORP_FILE)
{
if (m_pDlgChangeCM)
{
m_pDlgChangeCM->ProcessSocket(pHead);
}
return true;
}
return false;
}
BOOL DLG_Corp_User_Modify::ProcessSocket(Socket_Head_Add* pHead, BYTE* pFrame)
{
if (pHead->lFuncType == SMSFUNC_SIGNNAME_ADD ||
pHead->lFuncType == SMSFUNC_CORP_FILE)
{
if (m_pDlgChangeCM)
{
m_pDlgChangeCM->ProcessSocket(pHead, pFrame);
}
return true;
}
return false;
}
BOOL DLG_Corp_User_Modify::OnInitDialog()
{
CDialogEx::OnInitDialog();
if (_tcslen(m_User.szLoginName) <= 0) //没有姓名,是空用户。
return true;
m_strLoginName = m_User.szLoginName;
m_strName = m_User.szName;
m_strNickName = m_User.szNickName;
m_lSex = 0;
if (!_tcscmp(m_User.szSex, _T("")))
m_lSex = 1;
if (!_tcscmp(m_User.szSex, _T("")))
m_lSex = 2;
COleDateTime tTemp(m_User.tBirthday);
if (tTemp.GetStatus() != COleDateTime::valid) //无效时间
{
m_tBirthday.SetStatus(COleDateTime::null);
}
else
{
m_tBirthday = tTemp;
}
m_strJob = m_User.szJob;
m_strTel = m_User.szTel;
m_strFax = m_User.szFax;
m_strMobile = m_User.szMobile;
m_strEmail = m_User.szEmail;
m_strQQ = m_User.szQQ;
m_strBZ = m_User.szBZ;
m_strCM = m_User.szCM2;
TCHAR Buf[32];
if (m_User.lSMSUsed == -100)
m_strSMSUsed = _T("无限制");
else
m_strSMSUsed = _itot(m_User.lSMSUsed, Buf, 10);
m_strSMSSendAll = _itot(m_User.lSMSSendAll, Buf, 10);
m_strLoginCount = _itot(m_User.lLoginCount, Buf, 10);
m_strLoginTime.Format(_T("%04d.%02d.%02d %02d:%02d:%02d"), m_User.tLoginTime.wYear, m_User.tLoginTime.wMonth, m_User.tLoginTime.wDay, m_User.tLoginTime.wHour, m_User.tLoginTime.wMinute, m_User.tLoginTime.wSecond);
m_strCreateUser = m_User.szCreateUser;
m_strCreateTime.Format(_T("%04d.%02d.%02d %02d:%02d:%02d"), m_User.tCreateTime.wYear, m_User.tCreateTime.wMonth, m_User.tCreateTime.wDay, m_User.tCreateTime.wHour, m_User.tCreateTime.wMinute, m_User.tCreateTime.wSecond);
//GetDlgItem(IDC_CORP_USERMODIFY_CHANGECM)->ShowWindows(SW_HIDE);
this->UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}