以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  登陆者不能在窗口中查找  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=118157)

--  作者:cxmxjwlmq
--  发布时间:2018/4/26 10:16:00
--  登陆者不能在窗口中查找

各位老师、大咖们:

    一个表,设定表事件中,只有登陆者才能修改自己的一行。这个没有出现问题。我绑定表作了录入窗口,窗口中有一个查找TextBox17,便登陆者登陆后,这个查找文件框不能输入,开发者可以输入。

窗口的Enter事件代码:

If e.Sender.Name.SubString(0,4) = "_cmb" Then \'如果名称符合
    Dim cmb As WinForm.ComboBox = e.Sender
     If cmb.Items.Count > 0 Then  \'如果已经设置了项目
        Return \'则返回
    End If
     Dim t  As  Table = cmb.BindTable \'获得绑定的Table
     Dim c As Col = cmb.BindCol \'获得绑定的Col
     Dim dr As  DataRow =  DataTables("组合框代码").Find("[表] = \'" & t.Name & "\' And [列] = \'" & c.Name &  "\'")
     If dr IsNot Nothing Then  \'如果在项目表找到对应的行
        cmb.Combolist = dr("列表项目") \'则设置列表项目
    End If
 End  If

Dim ctl As WinForm.Control = e.Sender
Dim r As Row = Tables("制造质量管理").Current
If r IsNot Nothing Then
  If User.Name = "开发者" Then
     ctl.ReadOnly = BooleanEnum.False \'允许编辑
   Else
     If User.Name = r("检验员") Then
         ctl.ReadOnly = BooleanEnum.False \'允许编辑
      Else
         ctl.ReadOnly = BooleanEnum.True \'禁止编辑
     End If
   End If
End If

 

TextBox17的Textchanged事件代码:

Dim txt  As  String = e.Form.Controls("TextBox17").Text
 Dim tbl As Table = Tables("制造质量记录_Table1")
 If txt = "" Then
     tbl.Filter = ""
 Else
     txt = "\'%" & txt & "%\'"
     tbl.Filter = "底盘号 Like " & txt & " Or 发动机号 Like " & txt &  " Or 序号 Like " & txt &  " Or 检验岗 Like " & txt
 End If

求助!


--  作者:有点甜
--  发布时间:2018/4/26 10:45:00
--  

If e.Sender.Name.SubString(0,4) = "_cmb" Then \'如果名称符合
    Dim cmb As WinForm.ComboBox = e.Sender
    If cmb.Items.Count > 0 Then  \'如果已经设置了项目
        Return \'则返回
    End If
    Dim t  As  Table = cmb.BindTable \'获得绑定的Table
    Dim c As Col = cmb.BindCol \'获得绑定的Col
    Dim dr As  DataRow =  DataTables("组合框代码").Find("[表] = \'" & t.Name & "\' And [列] = \'" & c.Name &  "\'")
    If dr IsNot Nothing Then  \'如果在项目表找到对应的行
        cmb.Combolist = dr("列表项目") \'则设置列表项目
    End If
End  If

Dim ctl As WinForm.Control = e.Sender
Dim r As Row = Tables("制造质量管理").Current
If r IsNot Nothing Then
    If User.Name = "开发者" Then
        ctl.ReadOnly = BooleanEnum.False \'允许编辑
    Else
        If User.Name = r("检验员") Then
            ctl.ReadOnly = BooleanEnum.False \'允许编辑
        Else
            ctl.ReadOnly = BooleanEnum.True \'禁止编辑
        End If
    End If
End If
If ctl.name = "TextBox17" Then
    If User.Name = "开发者" Then
        ctl.ReadOnly = BooleanEnum.False \'允许编辑
    Else
        ctl.ReadOnly = BooleanEnum.True
    End If
End If


--  作者:cxmxjwlmq
--  发布时间:2018/4/26 22:05:00
--  

甜老师:我把代码加到后面,但还是不行,别的登陆者登陆还是不能用查询

 


--  作者:有点甜
--  发布时间:2018/4/26 22:39:00
--  
以下是引用cxmxjwlmq在2018/4/26 22:05:00的发言:

甜老师:我把代码加到后面,但还是不行,别的登陆者登陆还是不能用查询

 

 

不明白你到底要实现什么。是允许使用还是不能使用?

 

If ctl.name = "TextBox17" Then
    If User.Name = "开发者" Then
        ctl.ReadOnly = BooleanEnum.False \'允许编辑
    Else
        ctl.ReadOnly = BooleanEnum.False \'允许编辑
    End If
End If


--  作者:cxmxjwlmq
--  发布时间:2018/4/26 22:43:00
--  

使登陆者都能使用,老师


--  作者:有点甜
--  发布时间:2018/4/26 22:45:00
--  
看4楼代码。
--  作者:cxmxjwlmq
--  发布时间:2018/4/26 22:56:00
--  

谢谢甜老师