Code management (1)

xiaoxiao2021-03-06  61

1 -------------- From the database to get the data of all registered users, placed in DataSet1, then get online username from Application, filter out online users from DataSet1, Binds with DataGrid

'ApallUserId from all login people from Application

USERARRAY = CTYPE (Application ("AppAllUserid"), ArrayList

DIM I as integer

Private stronlineps as string

'Convert USERARRAY to string, with separate

For i = 0 to Usercount - 1

Stronlineps = Stronlineps "','" USERARRAY (i)

NEXT

'Filtering record

Me.dtview = dtuser.defaultView

Me.dtview.rowfilter = "User_id in ('" & stronlinePs & ")" me.dtgtask.datasource = me.dtview "data binding me.dtgtask.database ()

2 ---------------------- Accurate query and fuzzy query 'If checkbox is selected, you have to blur IF me.chksrc.checked = true dam .TEXT.TRIM <> "" THEN STR = "User_id Like '%" & me.txtuserid.text.trim & "%'" end if If me.txtusername.text.trim <> "" THEN IF STR <> " "THEN STR = STR " and c_name like '% " me.txtusername.text.trim "%' "Else Str =" c_name like '% " me.txtusername.text.trim "%' "end if End if else 'If checkbox is not selected, an accurate query if me.txtuserid.text.trim <> "" "" "User_ID ='" & me.txtuserid.text.trim & "end if if me.txtusername .Text.trim <> "" THEN IF STR "and c_name = ' me.txtusername.text.trim "' "Else Str = "c_name = '" me.txtusername.text.trim "" end if End if Endiff "If the Str is not empty, filter the if str <>" "" "User_id in ('"& stronlinePs &") and "& strs

3 --------------------- Time control usage 'When the time control query is required to be three TextBox, otherwise error if timefrom = "" " Return End if if. = "" "The return end if'2 time controls are empty if me.uctime1.get settime <> datetime.minvalue and me.uctime2.get settime <> datetime.minvalue the 'dtuser.defaultview table in the table, DTUSER.DEFAULTVIEW table Record filtration I = Me.dtview.count while i <> 0 login_dt = dtview.item (i - 1) .Item ("LST_Login_DT")

Temp = login_dt.substring (0, 10) TimeFrom = Temp TimeFrom TimeTo = Temp Timeto 'If the login time is between TIMEFROM and TIMETO if DateTime.Parse (TimeFrom) <= datetime.parse (login_dt) And DateTime.Parse Timeto> = datetime.parse (login_dt) THEN ELSE 'If not, delete this line Dtview.Item (i - 1) .delete () end if timefrom = timefrom.substring (10) TimeTo = TimeEto.substring (10) i = i - 1 End while endiff

'UcTime2 is empty, the If Me.UCTime1.GetSetTime <> DateTime.MinValue And Me.UCTime2.GetSetTime = DateTime.MinValue Then' dtUser.DefaultView filter table records i = Me.dtView.Count While i <> 0 login_dt = dtView .Item (i - 1) .Item ("LST_Login_DT")

Temp = login_dt.substring (0, 10) TimeFrom = Temp TimeFrom

'If the login time is greater than TimeFrom if DateTime.Parse (TimeFrom) <= DATETIME.PARSE (login_dt) THEN ELSE' If it is not greater, delete this line DTView.Item (I - 1) .delete () end if timefrom = timefrom. Substring (10) i = i - 1 End while end if'uctime1 is empty if me.uctime1.get settime = datetime.minvalue and me.uctime2.get settime <> datetime.minvalue the 'dtuser.defaultview table Record filter' for i = 0 to dtuser.defaultview.count - 1 i = me.dtview.count while i <> 0 login_dt = me.dtview.item (i - 1) .Item ("LST_Login_dt")

Temp = login_dt.substring (0, 10) TIMETO = TEMP TIMETO

'If the login time is less than Timeto if DateTime.Parse (Timeto)> = DATETIME.PARSE (login_dt) THEN ELSE' If it is not less than, delete this line Me.dtview.Item (i - 1) .delete () end if Timeto = TimeEto.substring (10) i = i - 1 End while endiff

'Me.dtgtask.datasource = me.dtview me.dtgtask.database ()' me.lblpernum.text = me.dtview.count end if4 ----------------- Give DataGrid Add automatic growth column <% # Container.itemindex 1%> < / ItemTemplate> < % # Container.ItemIndex 1%>

<% # Container.itemindex 1%>

<% @ Register tagprefix = "uc1" tagname = "uctimeControl" src = "../ Controls / Uctime.ascx"%>

转载请注明原文地址:https://www.9cbs.com/read-113062.html

New Post(0)