use "xcontrol.vframe.vbusiness.vd"
|
use "xbase.vframe.vbusiness.vd"
|
|
unit trade
|
[
|
class AccountUnitMaintWin : public xwin
|
{
|
xdwgrid dw_list;
|
xnode m_agentNode; //Agent Condition
|
|
int SetAgent()
|
{
|
string xfNodeAgentArea = "agentarea";
|
xnode anode = GetAgentNode(xfNodeAgentArea);
|
if(m_agentNode)
|
{
|
SetAgentNodeContent (anode,m_agentNode);
|
}
|
else
|
{
|
msxml::IXMLDOMElement xframeElement = GetElement();
|
msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
|
if(agent)
|
{
|
string s = agent.xml;
|
m_agentNode = SetAgentNodeContent (anode,s);
|
}
|
}
|
return 1;
|
}
|
|
//½¹µã¼¤»î´¦Àíº¯Êý
|
int OnSetFocus(ref TEvent evt,int param)
|
{
|
//ÖØÖù¤¾ßÌõ
|
SetAgent();
|
return 1;
|
}
|
|
//ÃüÁî·¢²¼º¯Êý
|
int OnCmdDispatch(string comdid)
|
{
|
if(comdid=="xmAddRow")
|
{
|
dw_list.InsertRow(0);
|
return 1;
|
}
|
else if(comdid=="xmDeleteRow")
|
{
|
dw_list.DeleteRow(0);
|
return 1;
|
}
|
else if(comdid=="xmSave")
|
return OnSave();
|
else if(comdid=="xmRefresh")
|
return OnRetrieve();
|
return 0;
|
}
|
|
//ÃüÁî´¦Àíʼþ
|
int OnXCommand(ref TXCommandEvent evt,int param)
|
{
|
return OnCmdDispatch(evt.pStrID);
|
}
|
|
int OnAttachEvent()
|
{
|
//°ó¶¨¹¤¾ßÌõµã»÷ʼþ
|
AttachEvent("WM_XCOMMAND",OnXCommand);
|
//»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
|
AttachEvent("WM_SETFOCUS",OnSetFocus);
|
}
|
|
int OnSave()
|
{
|
xml x=new xml;
|
x.setNativePointer(xml::CreateInstance());
|
dw_list.DwUpdateAllToEx(x.GetXmlDoc());
|
xaserverarg arg=new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
arg.AddArg("content",x.GetXml());
|
if (url::get("/sale/data/TradeFinance3/accountunit/update",arg.GetString(),x) != 1)
|
{
|
trace("error:"+x.GetXml());
|
alert("±£´æÊ§°Ü!");
|
return 0;
|
}
|
else
|
{
|
trace(x.GetXml());
|
if(x.GetXmlDoc().selectSingleNode("error"))
|
{
|
alert("±£´æ³ö´í2!");
|
return 0;
|
}
|
win32::MessageBox(GetHWND(),"±£´æ³É¹¦£¡","Ìáʾ",0);
|
dw_list.ResetUpdateStatus();
|
}
|
dw_list.Redraw();
|
return 1;
|
}
|
|
int OnRetrieve()
|
{
|
xml x = new xml;
|
x.setNativePointer(xml::CreateInstance());
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
if (url::get("/sale/data/TradeFinance3/accountunit/list",arg.GetString(),x)!=1)
|
{
|
trace(x.GetXmlDoc().text);
|
return -1;
|
}else
|
{
|
dw_list.Retrieve(x);
|
dw_list.Redraw();
|
}
|
return 1;
|
}
|
|
int onload()
|
{
|
dw_list = GetControl("dw_list");
|
dw_list.openUrl("/sale/view/FinancialCode/template/AccountUnit");
|
dw_list.SetColumnState("TAUID",false);
|
|
OnRetrieve();
|
|
OnAttachEvent();
|
return 1;
|
}
|
|
int onloaded()
|
{
|
SetAgent();
|
|
return 1;
|
}
|
};
|
]
|