þÿ#include <wobject/xstring.hpp> #include <xcontrol/xtreeview.hpp> #include <xcontrol/xdwgrid.hpp> #include <xcontrol/xcell.hpp> #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" using xml = KXMLDOMDocument; class __declspec(dllexport) GDNDelay : public xframe { xdwtable dw_base; xnode m_agentNode; //Agent Condition int hObject; bool updated; public: GDNDelay(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} public: static GDNDelay* CreateInstance(void* implPtr, void* hWnd) { GDNDelay* pWin = new GDNDelay(implPtr, (HWND)hWnd); return pWin; } int SetAgent() { xstring xfNodeAgentArea = L"agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); if (m_agentNode) { SetAgentNode(anode, m_agentNode); } else { KXMLDOMElement xframeElement = GetElement(); KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); if (agent) { xstring s = agent.xml(); m_agentNode = SetAgentNode(anode, s); } } return 1; } //q&p¹oÀm;YtQýep int OnSetFocus(TEvent* evt, LPARAM param) { //‘Ín]åQwga SetAgent(); return 1; } int OnSave() { dw_base.AcceptText(); xstring GDNType = dw_base.GetItemString(1, L"GDNType"); if (GDNType == L"3") { xstring GDNRemarks = dw_base.GetItemString(1, L"GDNRemarks"); if (GDNRemarks == L"") { alert(L"^ög—‰XkQ™^ögSŸVàÿ"); return -1; } } xml x; xaserverarg arg ; dw_base.AcceptText(); dw_base.DwUpdateAllTo(x); xstring error = L""; arg.AddArg(L"content", x.xml()); trace(x.xml()); if (xurl::get(L"/sale/data/GDN/update/GDNDelay", arg.GetString(), x) != 1) { error = x.text(); alert(L"err:" + error); return 1; } xstring str = x.documentElement().getAttribute(L"text"); if (str == L"true") { dw_base.ResetUpdateStatus(); dw_base.Redraw(); alert(L"OÝ[XbRŸ!"); } else { alert(L"OÝ[XY1%!"); } return 1; } //T}NäSÑ^Qýep int OnCmdDispatch(xstring comdid) { if (comdid == L"xmClose") { CloseWindow(); return 1; } else if (comdid == L"xmSave") { OnSave(); return 1; } return 0; } //T}NäYtN‹Nö int OnXCommand(TEvent* evt, LPARAM p) { return OnCmdDispatch(evt->xcommand.pStrID); } int OnAttachEvent() { //~Ñ[š]åQwgap¹QûN‹Nö AttachEvent(L"WM_XCOMMAND", (FEvent)&GDNDelay::OnXCommand); //ƒ·SÖq&p¹N‹Nöÿ u(NŽ‘Ín]åQwga AttachEvent(L"WM_SETFOCUS", (FEvent)&GDNDelay::OnSetFocus); return 1; } int OnRetrieve(xstring GDNID) { xml x; xaserverarg arg ; arg.AddArg(L"GDNID", GDNID); if (getUrl(L"/sale/data/GDN/GetGDNDelayBase", arg.GetString(), x) != 1) { trace(x.xml()); return -1; } else { dw_base.Retrieve(x); dw_base.Redraw(); } return 1; } int onload() { SetAgent(); dw_base = GetControl(L"dw_base"); dw_base.openUrl(L"/sale/view/GDN/template/GDNDelayBase"); dw_base.SetColHeaderHeight(0); dw_base.SetRowSelectorWidth(0); dw_base.SetHScrollState(false); dw_base.SetVScrollState(false); xstring GDNID = L""; if (GetWinParam()) { xaserverarg arg = GetArg(); alert(arg.GetString()); GDNID = arg.GetArgString(L"GDNID"); alert(GDNID); } OnRetrieve(GDNID); xstring GDNDelayID = dw_base.GetItemString(1, L"GDNDelayID"); if (GDNDelayID == L"") { dw_base.SetItemString(1, L"GDNID", GDNID); } OnAttachEvent(); return 1; } int onloaded() { SetAgent(); return 1; } };