Business Requirements: Batch Select Enterprise Personnel, fill in the grid parts, and implement the check effect of the People list, automatically synchronize the selected People list item.
First we need to build a list of selected people and an enterprise personnel selection list,
650) this.width=650; "id=" aimg_1488 "src=" http://bbs.delit.cn/data/attachment/forum/201605/15/ 153725c3znrhhpzrzreccl.png.thumb.jpg "width=" 399 "height=" 118 "alt=" 153725c3znrhhpzrzreccl.png.thumb.jpg "/>
This form is fairly simple to build, and we don't explain it in detail, here is a detailed description of how to implement the check-in effect of the people selection list and the sync person.
check the effect to achieve the idea: get the grid parts of the DataTable, the DataTable into the people select form, loop judgment DataTable and select list, (Personnel ID) to determine the condition of the set-up check mark.
synchronized people realize the idea: get the identification of the selection list of people, and then return to the Display form, loop show the form staff, according to the DataTable Select Query method to determine the returned list If the collection already exists, delete the row without using the Delete method of the DataTable .
650) this.width=650; "id=" aimg_1489 "src=" http://bbs.delit.cn/data/attachment/forum/201605/15/ 153731kk7vj8okvztckzq9.png.thumb.jpg "width=" 155 "height=" alt= "153731kk7vj8okvztckzq9.png.thumb.jpg"/>
' Open smart form, form location: Project form \ Team building \ Education Training \* Learner selection list *dim form1 = Create form (" 8f03a0cb-db62-4965-81e4-b995e4e4b1d5 ") ' if me.input1= ' EDIT ' then ' Get the selected people list dim dt_yxry= grid Part 1. Datatable form1. input1= "Modify" "Incoming selection list form1. Input2=dt_yxry form1. input3= "Other" ' End ifform1. ShowDialog () ' Determines whether to get "Y" If form1. output1= "Y" thendim index = grid Part 1. datatable.rows.countdim dt= Mesh Part 1. Datatabledim drxdim rows=form1. Output2 ' Determine if the person checked is an empty dim dt_drif rows. Count <> 0 then for each dr in rows ' judgmentWhether the selected person is cstr drx = dt in the grid. Select ("Peixunrenyuanid= '" +cstr (dr["ID") + " " and QUERENRENGANGWEIID = "" +cstr (dr[") Job ID "]) +" ' ") ' not in grid. Drx. Length>0 indicates the presence of &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;IF&NBSP;DRX. length < 1 then ' MsgBox (dr["ID"]& " " &dr["name"]) dt_dr=dt. NewRow () dt_dr["ID"]=guid () dt_dr["Peixunrenyuanid"]=dr["ID"] dt_dr[" Peixunrenmingcheng "]=dr[" name "] dt_dr["Shifoucanjiaxuexi"]=true dt_dr["Querenrengangweiid"]=dr["Job ID"] dt_dr["GANGWEI "]=dr[" POST "] dt. Rows.Add (DT_DR) index=index+1 end if nextend The If ' definition variable gets the returned list collection Dim dtt=form1. Output4 ' defines the variable to get the mesh part of the dtdim dtt1= grid Part 1. Datatabledim dtt_drif dtt. Rows.count>0 and dtt1. Rows.count>0 then ' Cycle dt for each dr1 in dtt1. Copy (). rows ' Determine if the row status is marked deleted if dr1. rowstate<>8 then ' Use Select method to determine whether there is rows=dtt. Select ("Personnel id=" "+cstr (dr1[" Peixunrenyuanid "]) +" ' ") if rows. length = 0 then ' MsgBox (dr1[") Peixunrenyuanid "]&" not Found, remove ") dtt1. Select ("peixunrenyuanid=" "+cstr (dr1[" Peixunrenyuanid "]) +" ' ") [0]. Delete () end if end if next end ifend if
person selection List code:
Dim dt_rydim xmdim jsy ' Set the security personnel selection state, cycle to set the selected person dim adim bdim dt_a= grid Part 1. Datatable for each dr1 in ry. Rows if dr1. rowstate<>8 then ' Staff id a=dr1["Peixunrenyuanid"] ' Post id b=dr1["Querenrengangweiid"] for each dr4 in dt_a.rows &Nbsp; if cstr (dr4["ID"]) =Cstr (a) And cstr (dr4["Job ID"]) =cstr (b) then Grid Parts 1. Markrowsbyfilter ("id=" &cstr (dr4["id"]) & " and post id= '" &cstr (dr4["Job ID"]) & "' ", True) end if next end if next
Original address: http://bbs.delit.cn/thread-975-1-1.html
Reprint please specify the source:
Author: metric Technology http://www.delit.cn
About the selection of grid parts check and automatic synchronization options feature construction