LiFan
10 天以前 63eebabbfee1bc84850b36967ecac5116a28b73f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <wobject/xdouble.hpp>
#include <xcontrol/xlayersheet.hpp>
 
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
#include <xcontrol/xcell.hpp>>
 
using xml = KXMLDOMDocument;
class __declspec(dllexport) CustomerMarketMaint : public maint
{
public:
    KXMLDOMDocument m_configDoc;
    xstring m_userid;
    xstring m_username;
    xstring ContactID;
    xdwtable dw_base;
    xcell dw_cell;
    xstring m_EntityID = L"";
public:
    CustomerMarketMaint(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {}
public:
    static CustomerMarketMaint* CreateInstance(void* implPtr, void* hWnd)
    {
        CustomerMarketMaint* pWin = new CustomerMarketMaint(implPtr, (HWND)hWnd);
        return pWin;
    }
 
    int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg  arg)
    {
        if (updateItem == L"update")
        {
 
            dw_base.ResetUpdateStatus();
            return 1;
        }
    }
    xstring GetEntityData(LPARAM pr)
    {
        xml x;
 
        dw_base.DwUpdateAllTo(x);
        //trace(L"------x");
        trace(x.xml());
        return x.xml();
    }
    int onload()
    {
        SetArg();
        maint::onload();
        dw_base = GetControl(L"dw_base");
        if (!maint::m_EntityID)
        {
            //xstring suserid = publiccode::GetUser().id;
            xstring suserid = xaserver::GetUserId();
            xstring susername = publiccode::GetUser().name;
            xstring sdate = publiccode::GetCurrentDate();
            dw_base.SetItemString(dw_base.GetRow(), L"CreatorID", suserid);//Party
            dw_base.SetItemDisplayString(dw_base.GetRow(), L"CreatorID", susername);
            dw_base.SetItemString(dw_base.GetRow(), L"CreateDate", sdate);
            xml x;
 
            xaserverarg arg;
 
            arg.AddArg(L"id", suserid);
            if (xaserver::ExecXQuery(L"", L"[OrgInfo.xq]", arg.GetString(), x) != 1)
            {
                trace(x.xml());
                return 0;
            }
            //alert(x.xml());
            KXMLDOMElement e = x.documentElement();
            trace(e.xml());
            if (e.selectSingleNode(L"orgid"))
            {
                xstring orgid = e.selectSingleNode(L"orgid").text();
                dw_base.SetItemString(1, L"OrgID", orgid);
            }
 
            if (e.selectSingleNode(L"orgname"))
            {
                xstring orgname = e.selectSingleNode(L"orgname").text();
                dw_base.SetItemDisplayString(1, L"OrgID", orgname);
            }
        }
    }
 
    int onloaded()
    {
        return maint::onloaded();
    }
};