LiFan
2024-07-16 6a4764ee747fff45d89ef48f98873d6409e4f85e
jrj/project/business/BasicCode/BrandInforMaint.cpp
@@ -1,98 +1,100 @@
use "system.vl"
use "win.vl"
use "maint.vl"
use "file.vl"
use "dev:vm[xcell.vm]"
use "publiccode.vl"
use "dev:vm[pagecontrol.vm]"
unit vbusiness.entity
[
   BrandInforMaint is extend maint;
   about BrandInforMaint
   [
      field:
      [
         msxml::IXMLDOMDocument m_configDoc;
         string m_userid;
         string m_username;
         string ContactID;
         xdwtable__ dw_base;
         xcell__ dw_cell;
      ]
      method:
      [
         int alert(string str)
#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 "viewobject/view.base.hpp"
using xml = KXMLDOMDocument;
class __declspec(dllexport) BrandInforMaint : public xframe
{
public:
   KXMLDOMDocument m_configDoc;
   xstring m_userid;
   xstring m_username;
   xstring ContactID;
   xdwtable dw_base;
   xcell dw_cell;
public:
   BrandInforMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
   static BrandInforMaint* CreateInstance(void* implPtr, void* hWnd)
   {
      BrandInforMaint* pWin = new BrandInforMaint(implPtr, (HWND)hWnd);
      return pWin;
   }
   int alert(xstring str)
   {
      //win::MessageBox(GetHWND(),str,L"提示22:",0);
      TApp::alert(this, str);
      return 0;
   }
   int ViewUpdate(param pr, xstring updateItem, xaserverarg  arg)
   {
      if (updateItem == L"update")
      {
         dw_base.ResetUpdateStatus();
         return 1;
      }
   }
   xstring GetEntityData(param pr)
   {
      xml x;
      dw_base.DwUpdateAllTo(x);
      //trace(L"------x");
      trace(x.xml());
      return x.xml();
   }
   int onload()
   {
      maint::onload();
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      dw_base.SetColHeaderHeight(0);
      dw_base.SetRowSelectorWidth(0);
      dw_base.SetScrollState(false);
      /*if (!maint::m_EntityID)
      {
         //xstring suserid = TApp::GetUserInfo().id;
         xstring suserid = xaserver::GetUserId();
         xstring susername = TApp::GetUserInfo().name;
         xstring sdate = TApp::GetCurDate();
         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)
         {
            //win__::MessageBox(this.GetHWND(),str,"提示22:",0);
            TApp::alert(this,str);
            return 0;
            trace(x.xml());
            return nil;
         }
         int ViewUpdate(param pr,string updateItem,xaserverarg__  arg)
         //alert(x.xml());
         KXMLDOMElement e= x.documentElement();
         trace(e.xml);
         if(e.selectSingleNode(L"orgid"))
         {
            if(updateItem=="update")
            {
               dw_base.ResetUpdateStatus();
               return 1;
            }
         }
         string GetEntityData(param pr)
         {
            xml__ x = new xml__;
            x.setNativePointer(xml__::CreateInstance());
            dw_base.DwUpdateAllTo(x.GetXmlDoc());
            //trace("------x");
            trace(x.GetXml());
            return x.GetXml();
         }
         int onload()
         {
            maint::onload();
            dw_base = new xdwtable__;
            dw_base.setNativePointer(GetControl("dw_base"));
            dw_base.SetColHeaderHeight(0);
            dw_base.SetRowSelectorWidth(0);
            dw_base.SetScrollState(false);
            /*if (!maint::m_EntityID)
            {
               //string suserid = TApp::GetUserInfo().id;
               string suserid = xaserver__::GetUserId();
               string susername = TApp::GetUserInfo().name;
               string sdate = TApp::GetCurDate();
               dw_base.SetItemString(dw_base.GetRow(),"CreatorID",suserid);//Party
               dw_base.SetItemDisplayString(dw_base.GetRow(),"CreatorID",susername);
               dw_base.SetItemString(dw_base.GetRow(),"CreateDate",sdate);
               xml__ x=new xml__;
               x.setNativePointer(xml__::CreateInstance());
               xaserverarg__ arg=new xaserverarg__;
               arg.setNativePointer(arg.CreateInstance());
               arg.AddArg("id", suserid);
               if(xaserver__::ExecXQuery("","[OrgInfo.xq]",arg.GetString(),x)!=1)
               {
                  trace(x.GetXml());
                  return nil;
               }
               //alert(x.GetXml());
               msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement;
               trace(e.xml);
               if(e.selectSingleNode("orgid"))
               {
                  string orgid= e.selectSingleNode("orgid").text;
                  dw_base.SetItemString(1,"OrgID",orgid);
               }
               if(e.selectSingleNode("orgname"))
               {
                  string orgname = e.selectSingleNode("orgname").text;
                  dw_base.SetItemDisplayString(1,"OrgID",orgname);
               }
            }*/
            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);
         }
      }*/
   }
};