| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "saleorder.view.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 XmShareQuotev3 : public xframe |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) XmShareQuotev3 : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwtable dw_paper; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | XmShareQuotev3(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static XmShareQuotev3* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | XmShareQuotev3* pWin = new XmShareQuotev3(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 OnSave() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xml x ; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | |
| | | string val = x.GetXml(); |
| | | xstring val = x.xml(); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",val); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content",val); |
| | | //trace(val); |
| | | if(url::get("/sale/data/UserGroup/update/entity", arg.GetString(),x)!=1) |
| | | if(xurl::get(L"/sale/data/UserGroup/update/entity", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | xstring error = x.text(); |
| | | //alert(error); |
| | | return 1; |
| | | }else |
| | | { |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if(str == "true") |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if(str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("保存成功!"); |
| | | alert(L"保存成功!"); |
| | | |
| | | CloseWindow(); |
| | | }else |
| | | { |
| | | alert("保存失败!"); |
| | | alert(L"保存失败!"); |
| | | } |
| | | //alert(x.GetXml()); |
| | | //alert(x.xml()); |
| | | } |
| | | return 1; |
| | | } |
| | |
| | | { |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = win32::MessageBox(GetHWND(),"确认删除?","提示",MB_OKCANCEL); |
| | | int ret = MessageBox(GetHWND(),L"确认删除?",L"提示",MB_OKCANCEL); |
| | | if(ret == IDOK) |
| | | { |
| | | msxml::IXMLDOMElement ele = dw_list.GetRowElement(dw_list.GetRow()); |
| | | string ID = ele.getAttribute("guid"); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(dw_list.GetRow()); |
| | | xstring ID = ele.getAttribute(L"guid"); |
| | | |
| | | xml x = ViewObject::RetrieveData("/sale/data/Quote3/DeleteXmShare","ID",ID); |
| | | string status = x.GetXml(); |
| | | if(status.find("ok") == 1) |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/Quote3/DeleteXmShare",L"ID",ID); |
| | | xstring status = x.xml(); |
| | | if(status.find(L"ok") == 1) |
| | | { |
| | | alert("删除成功"); |
| | | alert(L"删除成功"); |
| | | dw_list.DeleteRow(dw_list.GetRow()); |
| | | }else |
| | | { |
| | | alert("删除失败"); |
| | | alert(L"删除失败"); |
| | | } |
| | | |
| | | } |
| | | return 0; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | |
| | | if(comdid=="xmDelete") |
| | | if(comdid==L"xmDelete") |
| | | { |
| | | OnDelete(); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | else if(comdid==L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmClose") |
| | | else if(comdid==L"xmClose") |
| | | { |
| | | 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)&XmShareQuotev3::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&XmShareQuotev3::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = GetParam(); |
| | | xml x ; |
| | | |
| | | xaserverarg arg = GetArg(); |
| | | if(arg) |
| | | { |
| | | string UserID = arg.GetArgString("UserID"); |
| | | xstring UserID = arg.GetArgString(L"UserID"); |
| | | //alert(UserID); |
| | | x = ViewObject::RetrieveData("/sale/data/Quote3/XmShare","UserID",UserID); |
| | | x = ViewObject::RetrieveData(L"/sale/data/Quote3/XmShare",L"UserID",UserID); |
| | | if(x)dw_list.Retrieve(x); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/Quote3/template/XmShare"); |
| | | dw_list.SetColumnState("EntityUserGroupID",false); |
| | | SetArg(); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/Quote3/template/XmShare"); |
| | | dw_list.SetColumnState(L"EntityUserGroupID",false); |
| | | |
| | | OnRetrieve(); |
| | | |
| | |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | | }; |