| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | #include <xcontrol/xdatetimepick.hpp> |
| | | |
| | | unit trade |
| | | [ |
| | | class UserPassDlg : public xframe |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserPassDlg : public xframe |
| | | { |
| | | public: |
| | | //xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | static string MD5(string) native from "XUtil.dll" alias "?MD5@IXFUtil@XFrame@Hxsoft@@SAPA_WPA_W@Z"; |
| | | public: |
| | | UserPassDlg(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserPassDlg* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserPassDlg* pWin = new UserPassDlg(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | SetAgentNode (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if(comdid=="xmCancel") |
| | | if(comdid==L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmOk") |
| | | else if(comdid==L"xmOk") |
| | | { |
| | | if(GetControl("old_pass").GetText()=="") |
| | | if(xcontrol(GetControl(L"old_pass")).GetText()==L"") |
| | | { |
| | | alert("请输入旧口令!"); |
| | | win32::SetFocus(GetControl("old_pass").GetId()); |
| | | alert(L"请输入旧口令!"); |
| | | SetFocus(GetControl(L"old_pass")->GetHWND()); |
| | | return 1; |
| | | } |
| | | |
| | | string ostr = GetControl("old_pass").GetText(); |
| | | string str1 = GetControl("new_pass").GetText(); |
| | | string str2 = GetControl("new_pass1").GetText(); |
| | | xstring ostr = xcontrol(GetControl(L"old_pass")).GetText(); |
| | | xstring str1 = xcontrol(GetControl(L"new_pass")).GetText(); |
| | | xstring str2 = xcontrol(GetControl(L"new_pass1")).GetText(); |
| | | if(str1 != str2) |
| | | { |
| | | alert("两遍新口令不一致!"); |
| | | win32::SetFocus(GetControl("new_pass1").GetId()); |
| | | alert(L"两遍新口令不一致!"); |
| | | SetFocus(GetControl(L"new_pass1")->GetHWND()); |
| | | return 1; |
| | | } |
| | | |
| | | string oldpass = MD5(ostr); |
| | | string newpass = MD5(str1); |
| | | xstring oldpass = xutil::MD5(ostr); |
| | | xstring newpass = xutil::MD5(str1); |
| | | |
| | | xml x=new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("old_password",oldpass); |
| | | arg.AddArg("new_password",newpass); |
| | | xml x; |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"old_password",oldpass); |
| | | arg.AddArg(L"new_password",newpass); |
| | | |
| | | if(getUrl("/sale/data/SysUser/update/password",arg.GetString(),x)!=1) |
| | | if(getUrl(L"/sale/data/SysUser/update/password",arg.GetString(),x)!=1) |
| | | { |
| | | alert("修改失败"); |
| | | alert(L"修改失败"); |
| | | } |
| | | else{ |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | if(x.selectSingleNode(L"error")) |
| | | { |
| | | alert(x.GetXmlDoc().selectSingleNode("error").text); |
| | | alert(x.selectSingleNode(L"error").text()); |
| | | return 1; |
| | | } |
| | | win32::MessageBox(GetHWND(),"修改口令成功!","提示",0); |
| | | MessageBox(GetHWND(),L"修改口令成功!",L"提示",0); |
| | | CloseWindow(); |
| | | } |
| | | return 1; |
| | |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserPassDlg::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserPassDlg::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | //const int EM_SETPASSWORDCHAR =0x00CC; |
| | | //win32::SendMessage(GetControl("old_pass").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl("new_pass").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl("new_pass1").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl(L"old_pass").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl(L"new_pass").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl(L"new_pass1").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | | }; |