| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | use "treeview.vm" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrEmployeex is extend list; |
| | | about HrEmployeex |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwtable__ dw_1; |
| | | xnode__ m_agentNode; |
| | | string is_orgid |
| | | string is_orgname; |
| | | string is_inflag; |
| | | xdwtable__ dw_empmaint; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "/*[1]"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | } |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_1.AcceptText(); |
| | | dw_1.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | //return 1; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Employee", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | } |
| | | |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID", ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("OrganizationStruct/detail.Employee", arg.GetString(), x) == 1) |
| | | { |
| | | dw_1.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/detail"); |
| | | dw_1.Retrieve(x); |
| | | dw_1.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TXCommandEvent evt, int p) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string ls_orgid = ele.SelectSingleNode("@guid").text; |
| | | is_orgid = ls_orgid; |
| | | //trace(is_orgid); |
| | | OnRetrieve(ls_orgid); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.InsertRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int p) { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "PositionID") { |
| | | arg.AddArg("ResourceType", "HrPosition"); |
| | | } |
| | | else if (col == "PersonID") { |
| | | arg.AddArg("ResourceType", "HrPerson"); |
| | | } |
| | | else if (col == "OrgID") { |
| | | arg.AddArg("ResourceType", "HrOrg"); |
| | | } |
| | | else if (col == "JobID") { |
| | | arg.AddArg("ResourceType", "HrJob"); |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | int HCursor = xutil__::SetCursorWait(); |
| | | |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | trace(row); |
| | | if (col == "PositionID") |
| | | { |
| | | xdwtable__ dw_HrEmployee = new xdwtable__; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable("HrEmployee")); |
| | | string sPositionID = dw_HrEmployee.GetItemString(row, "PositionID"); |
| | | |
| | | if (sPositionID == "" || sPositionID == nil) |
| | | return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sPositionID); |
| | | arg.AddArg("type", "GetOrgIDJobID"); |
| | | //trace(arg.GetString()); |
| | | if (url::get("OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMDocument xdoc = x.GetXmlDoc(); |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName("OrgID"); |
| | | msxml::IXMLDOMElement e = xdoc.documentElement; |
| | | string sOrgID = e.SelectSingleNode("@OrgID").text; |
| | | string sOrgName = e.SelectSingleNode("@OrgName").text; |
| | | string sJobID = e.SelectSingleNode("@JobID").text; |
| | | string sJobName = e.SelectSingleNode("@JobName").text; |
| | | dw_HrEmployee.SetItemString(row, "OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemDisplayString(row, "OrgID", sOrgName); |
| | | dw_HrEmployee.SetItemString(row, "JobID", sJobID); |
| | | dw_HrEmployee.SetItemDisplayString(row, "JobID", sJobName); |
| | | } |
| | | } |
| | | xutil__::RestoreCursor(HCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int OnImportData() |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonSel", this); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "AddRow") return OnAddRow(); |
| | | else if (comdid == "InsertRow") return OnInsertRow(); |
| | | else if (comdid == "DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == "Save") return OnSave(); |
| | | else if (comdid == "ImportData") return OnImportData(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | //ä¸ææ¡ æä¾å
容 |
| | | AttachEvent("dw_1", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_1", "DWV_ITEMCHANGED", OnItemChanged); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_1 = new xdwtable__; |
| | | dw_1.setNativePointer(this.GetControl("dw_1")); |
| | | dw_1.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/detail"); |
| | | |
| | | OnInitial(); |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid, root); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |