use "system.vl"
|
use "win.vl"
|
use "list.vl"
|
use "file.vl"
|
unit vbusiness.entity
|
[
|
CartermList is extend list;
|
about CartermList
|
[
|
field:
|
[
|
xdwpages__ dw_pages;
|
xstring m_QueryTxt;
|
msxml::IXMLDOMDocument m_configDoc;
|
static int dw_hWnd;
|
]
|
|
method:
|
[
|
|
int alert(xstring str)
|
{
|
//win__::MessageBox(this.GetHWND(),str,L"Ìáʾ22:",0);
|
TApp::alert(this,str);
|
return 0;
|
}
|
|
|
xstring GetGuid(){
|
return TApp::GetGuid();
|
}
|
int OnAddrow()
|
{
|
this.dw_list.InsertRow(0);
|
int rows = this.dw_list.GetRowCount();
|
this.dw_list.SetRow(rows);
|
this.dw_list.SetItemString(rows,L"PartyID",GetGuid());
|
this.dw_list.SetItemString(rows,L"ContactID",GetGuid());
|
this.dw_list.SetItemString(rows,L"PAStatus",L"1");
|
this.dw_list.SetItemString(rows,L"PStatus",L"1");
|
this.dw_list.SetItemString(rows,L"PCStatus",L"1");
|
this.dw_list.SetItemString(rows,L"Type",L"7");
|
}
|
int OnInsertRow()
|
{
|
int row = this.dw_list.GetRow();
|
if(row<1 || row>this.dw_list.GetRowCount()) return 0;
|
this.dw_list.InsertRow(row);
|
this.dw_list.SetItemString(row,L"PartyID",GetGuid());
|
this.dw_list.SetItemString(row,L"ContactID",GetGuid());
|
this.dw_list.SetItemString(row,L"PAStatus",L"1");
|
this.dw_list.SetItemString(row,L"PStatus",L"1");
|
this.dw_list.SetItemString(row,L"PCStatus",L"1");
|
this.dw_list.SetItemString(row,L"Type",L"7");
|
}
|
|
int ViewUpdate(param pr,xstring updateItem,xaserverarg__ arg)
|
{
|
if( updateItem==L"del")
|
{
|
int DelRow = this.dw_list.GetRow();
|
this.dw_list.DeleteRow(DelRow);
|
|
}
|
|
return 1;
|
}
|
|
int OnDeleteRow()
|
{
|
int rows = this.dw_list.GetRowCount();
|
int row2 = this.dw_list.GetPrevSelectRow(rows);
|
while(row2 > 0){
|
this.dw_list.DeleteRow(row2);
|
row2 = this.dw_list.GetPrevSelectRow(row2 - 1);
|
}
|
this.dw_list.SelectRow(0, false);
|
}
|
|
int OnSave()
|
{
|
/*xstring no = this.dw_list.GetItemString(1,L"CarTermNo");
|
if(no==L""){
|
alert(L"ÇëÊäÈë³µ¶Ó±àÂ룡");
|
return -1;
|
}
|
xstring SName = this.dw_list.GetItemString(1,L"Name");
|
if(SName==L""){
|
alert(L"ÇëÊäÈë³µ¶ÓÃû³Æ£¡");
|
return -1;
|
}
|
xstring ContacterName = this.dw_list.GetItemString(1,L"ContacterName");
|
if(ContacterName==L""){
|
alert(L"ÇëÊäÈëÁªÏµÈËÃû³Æ£¡");
|
return -1;
|
} */
|
xml__ x=new xml__;
|
x.setNativePointer(xml__::CreateInstance());
|
this.dw_list.AcceptText();
|
this.dw_list.DwUpdateAllToEx(x.GetXmlDoc());
|
trace(x.GetXml());
|
xaserverarg__ arg=new xaserverarg__;
|
arg.setNativePointer(arg.CreateInstance());
|
arg.AddArg(L"content",x.GetXml());
|
arg.AddArg(L"dbmap",L"CarTerm.dbmap");
|
if (getUrl(L"/sale/data/CarTerm/entity/carterm/save",arg.GetString(),x) != 1)
|
{
|
trace(L"error:"+x.GetXml());
|
alert(L"±£´æÊ§°Ü!");
|
return 0;
|
}
|
else
|
{
|
trace(x.GetXml());
|
if(x.GetXmlDoc().selectSingleNode(L"error"))
|
{
|
alert(L"±£´æ³ö´í2!");
|
return 0;
|
}
|
alert(L"±£´æ³É¹¦£¡");
|
this.dw_list.ResetUpdateStatus();
|
}
|
this.dw_list.Redraw();
|
return 0;
|
}
|
int OnCmdDispatch(xstring comdid)
|
{
|
if(comdid.find(L"action:bill.row.add",0)>=0) {
|
OnAddrow();
|
}
|
else if(comdid.find(L"bill.row.insert",0)>=0) {
|
OnInsertRow();
|
}
|
else if(comdid.find(L"bill.row.delete",0)>=0) {
|
OnDeleteRow();
|
}
|
else if(comdid.find(L"bill.save",0)>=0) {
|
trace(1);
|
OnSave();
|
}
|
return 0;
|
}
|
|
int OnXCommand(ref TXCommandEvent evt,int p)
|
{
|
return OnCmdDispatch(evt.pStrID);
|
}
|
|
int OnAttachEvent()
|
{
|
AttachEvent(L"WM_XCOMMAND",OnXCommand);
|
return 0;
|
}
|
|
int onload()
|
{
|
OnAttachEvent();
|
list::onload();
|
this.dw_list.SetReadOnly(false);
|
return -1;
|
}
|
|
]
|
]
|
]
|