#include <wobject/xstring.hpp> 
 | 
#include <xcontrol/xtreeview.hpp> 
 | 
#include <xcontrol/xdwgrid.hpp> 
 | 
#include <wobject/xdouble.hpp> 
 | 
#include <xcontrol/xlayersheet.hpp> 
 | 
#include <xcontrol/xdatetimepick.hpp> 
 | 
  
 | 
  
 | 
#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() 
 | 
        { 
 | 
            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; 
 | 
        } 
 | 
  
 | 
        //½¹µã¼¤»î´¦Àíº¯Êý 
 | 
        int OnSetFocus(TEvent* evt, LPARAM param) 
 | 
        { 
 | 
            //ÖØÖù¤¾ßÌõ 
 | 
            //SetAgent(); 
 | 
            return 1; 
 | 
        } 
 | 
        int OnSave() 
 | 
        { 
 | 
            xml x ; 
 | 
             
 | 
            dw_list.AcceptText(); 
 | 
            dw_list.DwUpdateAllToEx(x); 
 | 
             
 | 
            xstring val = x.xml(); 
 | 
             
 | 
            xaserverarg arg ; 
 | 
                 
 | 
            arg.AddArg(L"content",val); 
 | 
            //trace(val); 
 | 
            if(xurl::get(L"/sale/data/UserGroup/update/entity", arg.GetString(),x)!=1) 
 | 
            { 
 | 
                xstring error = x.text(); 
 | 
                //alert(error); 
 | 
                return 1; 
 | 
            }else 
 | 
            { 
 | 
                xstring str = x.documentElement().getAttribute(L"text"); 
 | 
                if(str == L"true") 
 | 
                { 
 | 
                    dw_list.ResetUpdateStatus(); 
 | 
                    alert(L"±£´æ³É¹¦!");  
 | 
                     
 | 
                    CloseWindow(); 
 | 
                }else  
 | 
                { 
 | 
                    alert(L"±£´æÊ§°Ü!"); 
 | 
                } 
 | 
                //alert(x.xml()); 
 | 
            } 
 | 
            return 1; 
 | 
        }         
 | 
         
 | 
        int OnDelete() 
 | 
        { 
 | 
            int MB_OKCANCEL = 1; 
 | 
            int IDOK  = 1; 
 | 
            int ret = MessageBox(GetHWND(),L"È·ÈÏɾ³ý?",L"Ìáʾ",MB_OKCANCEL); 
 | 
            if(ret == IDOK) 
 | 
            { 
 | 
                KXMLDOMElement ele = dw_list.GetRowElement(dw_list.GetRow()); 
 | 
                xstring ID = ele.getAttribute(L"guid"); 
 | 
                 
 | 
                xml x = ViewObject::RetrieveData(L"/sale/data/Quote3/DeleteXmShare",L"ID",ID); 
 | 
                xstring status = x.xml(); 
 | 
                if(status.find(L"ok") == 1) 
 | 
                { 
 | 
                    alert(L"ɾ³ý³É¹¦"); 
 | 
                    dw_list.DeleteRow(dw_list.GetRow()); 
 | 
                }else 
 | 
                { 
 | 
                    alert(L"ɾ³ýʧ°Ü"); 
 | 
                } 
 | 
                 
 | 
            } 
 | 
            return 0; 
 | 
        } 
 | 
        //ÃüÁî·¢²¼º¯Êý 
 | 
        int OnCmdDispatch(xstring comdid) 
 | 
        { 
 | 
                 
 | 
            if(comdid==L"xmDelete") 
 | 
            { 
 | 
                OnDelete(); 
 | 
                return 1; 
 | 
            } 
 | 
            else if(comdid==L"xmSave") 
 | 
            { 
 | 
                OnSave(); 
 | 
                return 1; 
 | 
            } 
 | 
            else if(comdid==L"xmClose") 
 | 
            { 
 | 
                CloseWindow(); 
 | 
                return 1; 
 | 
            } 
 | 
         
 | 
            return 0; 
 | 
        } 
 | 
         
 | 
        //ÃüÁî´¦Àíʼþ 
 | 
        int OnXCommand(TEvent* evt, LPARAM param) 
 | 
        { 
 | 
            return OnCmdDispatch(evt->xcommand.pStrID); 
 | 
        } 
 | 
         
 | 
        int OnAttachEvent() 
 | 
        { 
 | 
            //°ó¶¨¹¤¾ßÌõµã»÷ʼþ 
 | 
            AttachEvent(L"WM_XCOMMAND", (FEvent)&XmShareQuotev3::OnXCommand); 
 | 
            //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ 
 | 
            AttachEvent(L"WM_SETFOCUS", (FEvent)&XmShareQuotev3::OnSetFocus); 
 | 
            return 1; 
 | 
        } 
 | 
         
 | 
         
 | 
        int  OnRetrieve() 
 | 
        { 
 | 
            xml x ; 
 | 
             
 | 
            xaserverarg arg = GetArg(); 
 | 
            if(arg) 
 | 
            { 
 | 
                xstring UserID = arg.GetArgString(L"UserID"); 
 | 
                //alert(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(); 
 | 
            } 
 | 
            return 1; 
 | 
        } 
 | 
         
 | 
         
 | 
        int onload() 
 | 
        { 
 | 
            SetArg(); 
 | 
            dw_list = GetControl(L"dw_list"); 
 | 
            dw_list.openUrl(L"/sale/view/Quote3/template/XmShare"); 
 | 
            dw_list.SetColumnState(L"EntityUserGroupID",false); 
 | 
             
 | 
            OnRetrieve(); 
 | 
             
 | 
            OnAttachEvent();     
 | 
             
 | 
            return 1; 
 | 
        } 
 | 
         
 | 
        int onloaded() 
 | 
        { 
 | 
             
 | 
            //SetAgent(); 
 | 
            return 1; 
 | 
        }         
 | 
    }; 
 |