|  |  | 
 |  |  | use "xcontrol.vframe.vbusiness.vd" | 
 |  |  | use "xbase.vframe.vbusiness.vd" | 
 |  |  | use "base.view.vd" | 
 |  |  | #include <wobject/xstring.hpp> | 
 |  |  | #include <xcontrol/xtreeview.hpp> | 
 |  |  | #include <xcontrol/xdwgrid.hpp> | 
 |  |  | #include <xcontrol/xcell.hpp> | 
 |  |  |  | 
 |  |  | unit trade  | 
 |  |  | [ | 
 |  |  |    class MessageBusinessWin :  public xframe | 
 |  |  |  | 
 |  |  | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  | #include "xcontrol/xhtml.hpp" | 
 |  |  |  | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  |    class  __declspec(dllexport) MessageBusinessWin :  public xframe | 
 |  |  |    { | 
 |  |  |    public: | 
 |  |  |       //xdwgrid   dw_list; | 
 |  |  |       xdwtable dw_base; | 
 |  |  |       xnode   m_agentNode;   //Agent Condition | 
 |  |  |       xwin      sheet; | 
 |  |  |       bool      readonly; | 
 |  |  |       string     MessageID; | 
 |  |  |       string    bill; | 
 |  |  |       xstring     MessageID; | 
 |  |  |       xstring    bill; | 
 |  |  |     | 
 |  |  |    public: | 
 |  |  |       MessageBusinessWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd),sheet(0) {} | 
 |  |  |    public: | 
 |  |  |       static MessageBusinessWin* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |       { | 
 |  |  |          MessageBusinessWin* pWin = new MessageBusinessWin(implPtr, (HWND)hWnd); | 
 |  |  |          return pWin; | 
 |  |  |       } | 
 |  |  |       int SetAgent() | 
 |  |  |       { | 
 |  |  |          return 1; | 
 |  |  |     | 
 |  |  |          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(); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int OnItemChanged(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnItemChanged(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |          ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |          string colname=hdr.colname; | 
 |  |  |          string value = hdr.data; | 
 |  |  |          DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |          xstring colname=hdr.colname; | 
 |  |  |          xstring value = hdr.data; | 
 |  |  |          int row = hdr.row; | 
 |  |  |           | 
 |  |  |          if(colname=="Category") | 
 |  |  |          if(colname==L"Category") | 
 |  |  |          { | 
 |  |  |             if(value=="供应商申请") | 
 |  |  |             if(value==L"供应商申请") | 
 |  |  |             { | 
 |  |  |                dw_base.SetItemString(1,"Receiver","fdp-011"); | 
 |  |  |                dw_base.SetItemString(1,"Subject","请添加"); | 
 |  |  |                dw_base.SetItemString(1,L"Receiver",L"fdp-011"); | 
 |  |  |                dw_base.SetItemString(1,L"Subject",L"请添加"); | 
 |  |  |             } | 
 |  |  |             return 1; | 
 |  |  |           | 
 |  |  |             bool changed = false; | 
 |  |  |             xml x = ViewObject::RetrieveData("/sale/data/business/message/maint","typ",value); | 
 |  |  |             xml x = ViewObject::RetrieveData(L"/sale/data/business/message/maint",L"typ",value); | 
 |  |  |             if(x) | 
 |  |  |             { | 
 |  |  |                string xpage_ = x.GetXmlDoc().documentElement.getAttribute("xpage"); | 
 |  |  |                string templaterpt = x.GetXmlDoc().documentElement.getAttribute("template"); | 
 |  |  |                if(xpage_ !="") | 
 |  |  |                xstring xpage_ = x.documentElement().getAttribute(L"xpage"); | 
 |  |  |                xstring templaterpt = x.documentElement().getAttribute(L"template"); | 
 |  |  |                if(xpage_ !=L"") | 
 |  |  |                { | 
 |  |  |                   string s = "<hbox name='agent'>"; | 
 |  |  |                   s += "<xpage  url='" + xpage_ + "'   name='contentex'/>"; | 
 |  |  |                   s += "</hbox>"; | 
 |  |  |                   SetAgentNodeContent (GetAgentNode("agent"),s); | 
 |  |  |                   SwitchLayer("sheet2","frame"); | 
 |  |  |                   sheet = GetChildWin("contentex"); | 
 |  |  |                   xstring s = L"<hbox name='agent'>"; | 
 |  |  |                   s += L"<xpage  url='" + xpage_ + L"'   name='contentex'/>"; | 
 |  |  |                   s += L"</hbox>"; | 
 |  |  |                   SetAgentNode (GetAgentNode(L"agent"),s); | 
 |  |  |                   SwitchLayer(L"sheet2",L"frame"); | 
 |  |  |                   sheet = GetChildWin(L"contentex"); | 
 |  |  |                   changed = true; | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  |             if(!changed) | 
 |  |  |             { | 
 |  |  |                sheet  = 0; | 
 |  |  |                SwitchLayer("sheet1","frame"); | 
 |  |  |                SwitchLayer(L"sheet1",L"frame"); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |              | 
 |  |  | 
 |  |  |       } | 
 |  |  |              | 
 |  |  |       //命令发布函数 | 
 |  |  |       int OnCmdDispatch(string comdid) | 
 |  |  |       int OnCmdDispatch(xstring comdid) | 
 |  |  |       { | 
 |  |  |          if(comdid=="xmSend") | 
 |  |  |          if(comdid==L"xmSend") | 
 |  |  |          { | 
 |  |  |             if(!readonly) OnSend(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          else if(comdid=="xmSave") | 
 |  |  |          else if(comdid==L"xmSave") | 
 |  |  |          { | 
 |  |  |             if(!readonly) OnSave(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          else if(comdid=="xmCancel") | 
 |  |  |          else if(comdid==L"xmCancel") | 
 |  |  |          { | 
 |  |  |             CloseWindow(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(sheet && comdid !="") | 
 |  |  |          if(sheet && comdid !=L"") | 
 |  |  |          { | 
 |  |  |             int ret = win32::SendMessage(sheet.GetHWND(),0x401,comdid,0); | 
 |  |  |             int ret =SendMessage(GetHWND(),0x401,(LPARAM)comdid,0); | 
 |  |  |             if(ret) return ret; | 
 |  |  |          } | 
 |  |  |                 | 
 |  |  | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       //命令处理事件 | 
 |  |  |       int OnXCommand(ref TXCommandEvent evt,int param) | 
 |  |  |       int OnXCommand(TEvent* evt, LPARAM param) | 
 |  |  |       { | 
 |  |  |          return OnCmdDispatch(evt.pStrID); | 
 |  |  |          return OnCmdDispatch(evt->xcommand.pStrID); | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |           | 
 |  |  |       int OnDWClick(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnDWClick(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |          ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |          string value = hdr.data; | 
 |  |  |          string colname = hdr.colname; | 
 |  |  |          if (value == "收件人:") | 
 |  |  |          DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |          xstring value = hdr.data; | 
 |  |  |          xstring colname = hdr.colname; | 
 |  |  |          if (value == L"收件人:") | 
 |  |  |          { | 
 |  |  |           | 
 |  |  |             xaserverarg arg2 = new xaserverarg; | 
 |  |  |             arg2.setNativePointer(arg2.CreateInstance());	 | 
 |  |  |             xaserverarg parg2 = GetParam(); | 
 |  |  |             OpenWindow("dev:xpage[UserGroupPersonSelect.vx]",cast(arg2 as int)); | 
 |  |  |             xaserverarg arg2 ; | 
 |  |  |             xaserverarg parg2 = GetArg(); | 
 |  |  |             OpenWindow(L"dev:xpage[UserGroupPersonSelect.vx]",arg2); | 
 |  |  |              | 
 |  |  |             if(arg2.GetArgString("comdid")=="xmOk") | 
 |  |  |             if(arg2.GetArgString(L"comdid")==L"xmOk") | 
 |  |  |             { | 
 |  |  |                string data = arg2.GetArgString("data"); | 
 |  |  |                xml x2 = new xml; | 
 |  |  |                x2.setNativePointer(xml::CreateInstance()); | 
 |  |  |                x2.LoadXml(data); | 
 |  |  |                msxml::IXMLDOMNodeList nodes = x2.GetXmlDoc().selectNodes("/root/item"); | 
 |  |  |                trace(x2.GetXml()); | 
 |  |  |                xstring data = arg2.GetArgString(L"data"); | 
 |  |  |                xml x2; | 
 |  |  |                 | 
 |  |  |                int len = nodes.length; | 
 |  |  |                x2.loadXML(data); | 
 |  |  |                KXMLDOMNodeList nodes = x2.selectNodes(L"/root/item"); | 
 |  |  |                trace(x2.xml()); | 
 |  |  | 					 | 
 |  |  |                int len = nodes.length(); | 
 |  |  |              | 
 |  |  |                string Names = ""; | 
 |  |  |                xstring Names = L""; | 
 |  |  |                for(int i=0;i<len; i++) | 
 |  |  |                { | 
 |  |  |                   msxml::IXMLDOMElement t= nodes.item(i); | 
 |  |  |                   KXMLDOMElement t= nodes.item(i); | 
 |  |  |                    | 
 |  |  |                   if(t.getAttribute("Name")) | 
 |  |  |                   if(t.getAttribute(L"Name")) | 
 |  |  |                   { | 
 |  |  |                      string Name = t.getAttribute("Name"); | 
 |  |  |                      if(Names=="")  | 
 |  |  |                      xstring Name = t.getAttribute(L"Name"); | 
 |  |  |                      if(Names==L"")  | 
 |  |  |                         Names = Name; | 
 |  |  |                      else if(Names.find(Name) < 0) Names+=";"+Name; | 
 |  |  |                      else if(Names.find(Name) < 0) Names+=L";"+Name; | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  |                dw_base.SetItemString(1,"Receiver",Names);		 | 
 |  |  |                dw_base.SetItemString(1,L"Receiver",Names);		 | 
 |  |  |             } | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  | 
 |  |  |       int OnAttachEvent() | 
 |  |  |       { | 
 |  |  |          //绑定工具条点击事件 | 
 |  |  |          AttachEvent("WM_XCOMMAND",OnXCommand); | 
 |  |  |          AttachEvent(L"WM_XCOMMAND", (FEvent)&MessageBusinessWin::OnXCommand); | 
 |  |  |          //获取焦点事件,用于重置工具条 | 
 |  |  |          AttachEvent("WM_SETFOCUS",OnSetFocus); | 
 |  |  |          AttachEvent(L"WM_SETFOCUS", (FEvent)&MessageBusinessWin::OnSetFocus); | 
 |  |  |           | 
 |  |  |          AttachEvent("dw_base","DWV_ITEMCHANGED",OnItemChanged); | 
 |  |  |          AttachEvent("dw_base","DWV_CLICKED",OnDWClick); | 
 |  |  |          AttachEvent(L"dw_base",L"DWV_ITEMCHANGED", (FEvent)&MessageBusinessWin::OnItemChanged); | 
 |  |  |          AttachEvent(L"dw_base",L"DWV_CLICKED", (FEvent)&MessageBusinessWin::OnDWClick); | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       int OnSave() | 
 |  |  |       { | 
 |  |  |          xml x = new xml; | 
 |  |  |          x.setNativePointer(xml::CreateInstance()); | 
 |  |  |          xaserverarg arg1 = MakeArg("scriptbox"); | 
 |  |  |          string murl = "/sale/data/Business/message/update";  | 
 |  |  |          if(MessageID=="") murl = "/sale/data/Business/message/add2";  | 
 |  |  |          if(url::get(murl, arg1.GetString(),x)!=1) | 
 |  |  |          xml x ; | 
 |  |  | 			 | 
 |  |  |          xaserverarg arg1 = MakeArg(L"scriptbox"); | 
 |  |  |          xstring murl = L"/sale/data/Business/message/update";  | 
 |  |  |          if(MessageID==L"") murl = L"/sale/data/Business/message/add2";  | 
 |  |  |          if(xurl::get(murl, arg1.GetString(),x)!=1) | 
 |  |  |          { | 
 |  |  |             alert("error1:\r\n"+x.GetXmlDoc().text); | 
 |  |  |             alert((xstring)L"error1:\r\n"+x.text()); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(MessageID=="") MessageID= dw_base.GetGuid(1); | 
 |  |  |          alert("已保存到草稿箱"); | 
 |  |  |          if(MessageID==L"") MessageID= dw_base.GetGuid(1); | 
 |  |  |          alert(L"已保存到草稿箱"); | 
 |  |  |          return 1; | 
 |  |  |           | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |          xaserverarg arg; | 
 |  |  | 			 | 
 |  |  |          if(sheet) | 
 |  |  |          { | 
 |  |  |             int val = cast(arg as int); | 
 |  |  |             win32::SendMessage(sheet.GetHWND(),0x401,"GetEntityData:"+val.toString(),0); | 
 |  |  |             string data = arg.GetArgString("EntityData"); | 
 |  |  |             murl = "/sale/data/Business/message/attach/update"; | 
 |  |  |             arg1.AddArg("url","message/attach"); | 
 |  |  |             arg1.AddArg("content",data); | 
 |  |  |             arg1.AddArg("param",MessageID); | 
 |  |  |             if(url::get(murl, arg1.GetString(),x)!=1) | 
 |  |  | 				 | 
 |  |  |             SendMessage(sheet.GetHWND(),0x401,(LPARAM)(L"GetEntityData:"+xstring((__int64) & arg)).c_str(true), 0); | 
 |  |  |             xstring data = arg.GetArgString(L"EntityData"); | 
 |  |  |             murl = L"/sale/data/Business/message/attach/update"; | 
 |  |  |             arg1.AddArg(L"url",L"message/attach"); | 
 |  |  |             arg1.AddArg(L"content",data); | 
 |  |  |             arg1.AddArg(L"param",MessageID); | 
 |  |  |             if(xurl::get(murl, arg1.GetString(),x)!=1) | 
 |  |  |             { | 
 |  |  |                alert("error2:\r\n"+x.GetXmlDoc().text); | 
 |  |  |                alert((xstring)L"error2:\r\n"+x.text()); | 
 |  |  |                return 1; | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  | 
 |  |  |        | 
 |  |  |       int OnSend() | 
 |  |  |       { | 
 |  |  |          xml x = new xml; | 
 |  |  |          x.setNativePointer(xml::CreateInstance()); | 
 |  |  |          //xaserverarg arg1 = MakeArg("outbox"); | 
 |  |  |          xaserverarg arg1 = MakeArg("inbox"); | 
 |  |  |          string murl = "/sale/data/Business/message/update";  | 
 |  |  |          if(MessageID=="") murl = "/sale/data/Business/message/add2";  | 
 |  |  |          xml x ; | 
 |  |  |          //xaserverarg arg1 = MakeArg(L"outbox"); | 
 |  |  |          xaserverarg arg1 = MakeArg(L"inbox"); | 
 |  |  |          xstring murl = L"/sale/data/Business/message/update";  | 
 |  |  |          if(MessageID==L"") murl = L"/sale/data/Business/message/add2";  | 
 |  |  |              | 
 |  |  |          trace(arg1.GetString()); | 
 |  |  |              | 
 |  |  |          if(url::get(murl, arg1.GetString(),x)!=1) | 
 |  |  |          if(xurl::get(murl, arg1.GetString(),x)!=1) | 
 |  |  |          { | 
 |  |  |             alert("error1:\r\n"+x.GetXmlDoc().text); | 
 |  |  |             alert((xstring)L"error1:\r\n"+x.text()); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(MessageID=="") MessageID= dw_base.GetGuid(1); | 
 |  |  |          alert("发送完成"); | 
 |  |  |          if(MessageID==L"") MessageID= dw_base.GetGuid(1); | 
 |  |  |          alert(L"发送完成"); | 
 |  |  |          CloseWindow(); | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  |           | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |          xaserverarg arg; | 
 |  |  | 			 | 
 |  |  |          if(sheet) | 
 |  |  |          { | 
 |  |  |             int val = cast(arg as int); | 
 |  |  |             win32::SendMessage(sheet.GetHWND(),0x401,"GetEntityData:"+val.toString(),0); | 
 |  |  |             string data = arg.GetArgString("EntityData"); | 
 |  |  |             murl = "/sale/data/Business/message/attach/update"; | 
 |  |  |             arg1.AddArg("url","message/attach"); | 
 |  |  |             arg1.AddArg("content",data); | 
 |  |  |             arg1.AddArg("param",MessageID); | 
 |  |  |             if(url::get(murl, arg1.GetString(),x)!=1) | 
 |  |  | 				 | 
 |  |  |             SendMessage(sheet.GetHWND(),0x401, (LPARAM)(L"GetEntityData:" + xstring((__int64)&arg)).c_str(true),0); | 
 |  |  |             xstring data = arg.GetArgString(L"EntityData"); | 
 |  |  |             murl = L"/sale/data/Business/message/attach/update"; | 
 |  |  |             arg1.AddArg(L"url",L"message/attach"); | 
 |  |  |             arg1.AddArg(L"content",data); | 
 |  |  |             arg1.AddArg(L"param",MessageID); | 
 |  |  |             if(xurl::get(murl, arg1.GetString(),x)!=1) | 
 |  |  |             { | 
 |  |  |                alert("error2:\r\n"+x.GetXmlDoc().text); | 
 |  |  |                alert((xstring)L"error2:\r\n"+x.text()); | 
 |  |  |                return 1; | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |              | 
 |  |  |       xaserverarg MakeArg(string folder) | 
 |  |  |       xaserverarg MakeArg(xstring folder) | 
 |  |  |       { | 
 |  |  |          //ThingImpl:AddMessage($MessageID,$Folder,$EntityNo, $EntityID, $Subject, $Category, $Reciever, $Content) | 
 |  |  |          //ThingImpl:UpdateMessage($MessageID,$Folder,$EntityNo, $EntityID, $Subject, $Category, $Reciever, $Content) | 
 |  |  |              | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |          xaserverarg arg; | 
 |  |  |           | 
 |  |  |          if(MessageID=="") | 
 |  |  | 			 | 
 |  |  |          if(MessageID==L"") | 
 |  |  |          { | 
 |  |  |             dw_base.SetGuid(1,ViewObject::GetGuid()); | 
 |  |  |             arg.AddArg("MessageID", dw_base.GetGuid(1)); | 
 |  |  |             arg.AddArg("EntityID", dw_base.GetGuid(1)); | 
 |  |  |             arg.AddArg(L"MessageID", dw_base.GetGuid(1)); | 
 |  |  |             arg.AddArg(L"EntityID", dw_base.GetGuid(1)); | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |          { | 
 |  |  |             arg.AddArg("MessageID", MessageID); | 
 |  |  |             arg.AddArg("EntityID", MessageID); | 
 |  |  |             arg.AddArg(L"MessageID", MessageID); | 
 |  |  |             arg.AddArg(L"EntityID", MessageID); | 
 |  |  |          } | 
 |  |  |           | 
 |  |  |          arg.AddArg("Folder", folder); | 
 |  |  |          arg.AddArg("EntityNo", dw_base.GetItemString(1,"EntityNo")); | 
 |  |  |          arg.AddArg("Subject", dw_base.GetItemString(1,"Subject")); | 
 |  |  |          arg.AddArg("Category", dw_base.GetItemString(1,"Category")); | 
 |  |  |          arg.AddArg("Reciever", dw_base.GetItemString(1,"Receiver")); | 
 |  |  |          arg.AddArg("Note", dw_base.GetItemString(1,"Note")); | 
 |  |  |          //arg.AddArg("Content", dw_base.GetItemString(1,"Content")); | 
 |  |  |          arg.AddArg("Content",GetControl("content").GetText()); | 
 |  |  |          arg.AddArg("Content2",bill); | 
 |  |  |          arg.AddArg(L"Folder", folder); | 
 |  |  |          arg.AddArg(L"EntityNo", dw_base.GetItemString(1,L"EntityNo")); | 
 |  |  |          arg.AddArg(L"Subject", dw_base.GetItemString(1,L"Subject")); | 
 |  |  |          arg.AddArg(L"Category", dw_base.GetItemString(1,L"Category")); | 
 |  |  |          arg.AddArg(L"Reciever", dw_base.GetItemString(1,L"Receiver")); | 
 |  |  |          arg.AddArg(L"Note", dw_base.GetItemString(1,L"Note")); | 
 |  |  |          //arg.AddArg(L"Content", dw_base.GetItemString(1,L"Content")); | 
 |  |  |          arg.AddArg(L"Content",xcontrol(GetControl(L"sle_search")).GetText()); | 
 |  |  |          arg.AddArg(L"Content2",bill); | 
 |  |  |          return arg; | 
 |  |  |       } | 
 |  |  |           | 
 |  |  |       int  OnRetrieve() | 
 |  |  |       { | 
 |  |  |          xml x = new xml; | 
 |  |  |          x.setNativePointer(xml::CreateInstance()); | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance());	 | 
 |  |  |          arg.AddArg("id",MessageID); | 
 |  |  |          if (getUrl("/sale/data/business/list/fetch",arg.GetString(),x)!=1) | 
 |  |  |          xml x; | 
 |  |  | 			 | 
 |  |  |          xaserverarg arg; | 
 |  |  | 				 | 
 |  |  |          arg.AddArg(L"id",MessageID); | 
 |  |  |          if (getUrl(L"/sale/data/business/list/fetch",arg.GetString(),x)!=1) | 
 |  |  |          { | 
 |  |  |             trace(x.GetXmlDoc().text); | 
 |  |  |             trace(x.text()); | 
 |  |  |             return -1; | 
 |  |  |          }else    | 
 |  |  |          { | 
 |  |  | 
 |  |  |             dw_base.Redraw(); | 
 |  |  |             if(readonly) dw_base.SetReadOnly(true); | 
 |  |  |           | 
 |  |  |             if(x.GetXmlDoc().selectSingleNode("root/Content")) | 
 |  |  |             if(x.selectSingleNode(L"root/Content")) | 
 |  |  |             { | 
 |  |  |                string str = x.GetXmlDoc().selectSingleNode("root/Content").text; | 
 |  |  |                str = str.replace("\n","\r\n"); | 
 |  |  |                GetControl("content").SetText(str); | 
 |  |  |                xstring str = x.selectSingleNode(L"root/Content").text(); | 
 |  |  |                str = str.replace(L"\n",L"\r\n"); | 
 |  |  |                SetWindowText(GetControl(L"content")->GetHWND(),str.c_str()); | 
 |  |  |             } | 
 |  |  |             //alert(x.GetXml()); | 
 |  |  |             if(x.GetXmlDoc().selectSingleNode("root/Content2")) | 
 |  |  |             //alert(x.xml()); | 
 |  |  |             if(x.selectSingleNode(L"root/Content2")) | 
 |  |  |             { | 
 |  |  |                 | 
 |  |  |                string str2 = x.GetXmlDoc().selectSingleNode("root/Content2").text; | 
 |  |  |                string tm=""; | 
 |  |  |                string EntityID=""; | 
 |  |  |                string Category=""; | 
 |  |  |                int pos = str2.find("EntityID="); | 
 |  |  |                xstring str2 = x.selectSingleNode(L"root/Content2").text(); | 
 |  |  |                xstring tm=L""; | 
 |  |  |                xstring EntityID=L""; | 
 |  |  |                xstring Category=L""; | 
 |  |  |                int pos = str2.find(L"EntityID=L"); | 
 |  |  |                if(pos >= 0) | 
 |  |  |                { | 
 |  |  |                   tm = str2.mid(pos+"EntityID=".length(),64); | 
 |  |  |                   if(tm.find(" ")>0) tm = tm.left(tm.find(" ")); | 
 |  |  |                   tm = str2.mid(pos + ((xstring)L"EntityID=").length(),64); | 
 |  |  |                   if(tm.find(L" ")>0) tm = tm.left(tm.find(L" ")); | 
 |  |  |                   EntityID=tm; | 
 |  |  |                } | 
 |  |  |                pos = str2.find("Category="); | 
 |  |  |                pos = str2.find(L"Category=L"); | 
 |  |  |                if(pos >= 0) | 
 |  |  |                { | 
 |  |  |                   tm = str2.mid(pos+"Category=".length(),64); | 
 |  |  |                   if(tm.find(" ")>0) tm = tm.left(tm.find(" ")); | 
 |  |  |                   tm = str2.mid(pos+((xstring)L"Category=").length(),64); | 
 |  |  |                   if(tm.find(L" ")>0) tm = tm.left(tm.find(L" ")); | 
 |  |  |                   Category=tm; | 
 |  |  |                } | 
 |  |  |                trace("EntityID:"+EntityID); | 
 |  |  |                trace("Category:"+Category); | 
 |  |  |                if(EntityID != "" && Category != "") | 
 |  |  |                trace(L"EntityID:"+EntityID); | 
 |  |  |                trace(L"Category:"+Category); | 
 |  |  |                if(EntityID != L"" && Category != L"") | 
 |  |  |                { | 
 |  |  |                   string eleStr = "<row EntityID='"+EntityID+"'"; | 
 |  |  |                   eleStr += " category='" + Category + "'/>"; | 
 |  |  |                   bill = "EntityID="+EntityID+" Category=" + Category; | 
 |  |  |                   xstring eleStr = L"<row EntityID='"+EntityID+L"'"; | 
 |  |  |                   eleStr += L" category='" + Category + L"'/>"; | 
 |  |  |                   bill = L"EntityID=L"+EntityID+L" Category=L" + Category; | 
 |  |  |                   ShowDetail(eleStr); | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int ShowDetail(string eleStr) | 
 |  |  |       int ShowDetail(xstring eleStr) | 
 |  |  |       { | 
 |  |  |          xaserverarg arg=new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance());	 | 
 |  |  |          arg.AddArg("content",eleStr); | 
 |  |  |          xml doc=new xml; | 
 |  |  |          doc.setNativePointer(xml::CreateInstance());				 | 
 |  |  |          if(getUrl("/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1) | 
 |  |  |          xaserverarg arg; | 
 |  |  | 				 | 
 |  |  |          arg.AddArg(L"content",eleStr); | 
 |  |  |          xml doc; | 
 |  |  | 						 | 
 |  |  |          if(getUrl(L"/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1) | 
 |  |  |          { | 
 |  |  |             trace("error->:"+doc.GetXml()); | 
 |  |  |             trace((xstring)L"error->:"+doc.xml()); | 
 |  |  |             return 0; | 
 |  |  |          } | 
 |  |  |          if(doc.GetXml() == "") | 
 |  |  |          if(doc.xml() == L"") | 
 |  |  |             return -1; | 
 |  |  |           | 
 |  |  |          htmlctrl ht = GetControl("taskinfo"); | 
 |  |  |          ht.SetContent(doc.GetXml()); | 
 |  |  |          xhtml ht = GetControl(L"taskinfo"); | 
 |  |  |          ht.LoadHtml(doc.xml()); | 
 |  |  |          ht.Redraw(); | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |           | 
 |  |  |       int onload() | 
 |  |  |       { | 
 |  |  |          dw_base = GetControl("dw_base"); | 
 |  |  |          dw_base.openUrl("/sale/view/business3/template/message/maint"); | 
 |  |  |          SetArg(); | 
 |  |  |          dw_base = GetControl(L"dw_base"); | 
 |  |  |          dw_base.openUrl(L"/sale/view/business3/template/message/maint"); | 
 |  |  |          dw_base.SetColHeaderHeight(0); | 
 |  |  |          dw_base.SetRowSelectorWidth(0); | 
 |  |  |          dw_base.SetHScrollState(false); | 
 |  |  |          dw_base.SetVScrollState(false); | 
 |  |  |           | 
 |  |  |          dw_base.SetItemString(1,"Category","普通"); | 
 |  |  |          dw_base.SetItemString(1,L"Category",L"普通"); | 
 |  |  |        | 
 |  |  |          OnAttachEvent();    | 
 |  |  |           | 
 |  |  |          readonly = false; | 
 |  |  |          MessageID = ""; | 
 |  |  |          bill = ""; | 
 |  |  |          MessageID = L""; | 
 |  |  |          bill = L""; | 
 |  |  |           | 
 |  |  |          SetAgent();          | 
 |  |  |          if(GetParam()) | 
 |  |  |          if(GetWinParam()) | 
 |  |  |          { | 
 |  |  |             xaserverarg arg = GetParam(); | 
 |  |  |             MessageID = arg.GetArgString("id"); | 
 |  |  |             if(arg.GetArgString("readonly")=="1") readonly=true; | 
 |  |  |             xaserverarg arg = GetArg(); | 
 |  |  |             MessageID = arg.GetArgString(L"id"); | 
 |  |  |             if(arg.GetArgString(L"readonly")==L"1") readonly=true; | 
 |  |  |             OnRetrieve(); | 
 |  |  |           | 
 |  |  |             if(arg.GetArgString("EntityID")!="") | 
 |  |  |             if(arg.GetArgString(L"EntityID")!=L"") | 
 |  |  |             { | 
 |  |  |                string str = "<row EntityID='"+arg.GetArgString("EntityID")+"'"; | 
 |  |  |                str += " category='" + arg.GetArgString("EntityName")+"'/>"; | 
 |  |  |                bill = "EntityID="+arg.GetArgString("EntityID")+" Category=" + arg.GetArgString("EntityName"); | 
 |  |  |                xstring str = L"<row EntityID='"+arg.GetArgString(L"EntityID")+L"'"; | 
 |  |  |                str += L" category='" + arg.GetArgString(L"EntityName")+L"'/>"; | 
 |  |  |                bill = L"EntityID=L"+arg.GetArgString(L"EntityID")+L" Category=L" + arg.GetArgString(L"EntityName"); | 
 |  |  |                ShowDetail(str); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  |       }       | 
 |  |  |    }; | 
 |  |  | ] | 
 |  |  |    }; |