Foxtable(狐表)用户栏目专家坐堂 → [求助]窗口文本框权限


  共有1842人关注过本帖树形打印复制链接

主题:[求助]窗口文本框权限

帅哥哟,离线,有人找我吗?
湛江智
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:812 积分:6676 威望:0 精华:0 注册:2014/11/26 12:32:00
[求助]窗口文本框权限  发帖心情 Post By:2018/7/16 17:59:00 [只看该作者]

下面代码 只对 第一列 设置权限,如果有很多列,下列代码怎么修改呢?
If _UserGroup <> "经理" Or _UserGroup <> "总裁" Then
    If e.DataCol.Name = "第一列" Then
        If e.OldValue = "已完成" Then
            If e.NewValue <> "已完成" Then
                MessageBox.Show("经理已经确定此任务:已完成,如有问题请沟通经理", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                e.Cancel = True '则取消更改
                Return
            End If
        Else
            If e.OldValue <> "已完成" Then
                If e.NewValue = "已完成" Then
                    MessageBox.Show("经理才可以确定此任务:已完成,可以录入:已完成了或已完成+完成日期  最好再截图通知经理已完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    e.Cancel = True '则取消更改
                End If
                Return
            End If
        End If
    End If
End If

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/16 18:36:00 [只看该作者]

 If e.DataCol.Name = "第一列" Then

 

改成

 

 If e.DataCol.Name = "第一列" OrElse e.datacol.name = "第二列" OrElse e.DataCol.Name = "第三列" Then


 回到顶部
帅哥哟,离线,有人找我吗?
湛江智
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:812 积分:6676 威望:0 精华:0 注册:2014/11/26 12:32:00
回复:(有点甜) If e.DataCol.Name = "第一列"...  发帖心情 Post By:2018/7/16 23:46:00 [只看该作者]

 Select Case e.DataCol.name
    Case "第一列","第二列"
        If e.DataCol.Name= "第一列" Then
            
            If User.Group <> "经理" Then
                If e.DataCol.Name = "第一列" Then
                    If e.OldValue = "已完成" Then
                        If e.NewValue <> "已完成" Then
                            MessageBox.Show("经理已经确定此任务:已完成,如有问题请沟通经理", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                            e.Cancel = True '则取消更改
                            Return
                        End If
                    Else
                        If e.OldValue <> "已完成" Then
                            If e.NewValue = "已完成" Then
                                MessageBox.Show("经理才可以确定此任务:已完成,可以录入:已完成了或已完成+完成日期  最好再截图通知经理已完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                                e.Cancel = True '则取消更改
                            End If
                            Return
                        End If
                    End If
                End If
            End If
        End If
        
        If e.DataCol.Name= "第二列" Then
            
            If User.Group <> "经理" Then
                If e.DataCol.Name = "第二列" Then
                    If e.OldValue = "已完成" Then
                        If e.NewValue <> "已完成" Then
                            MessageBox.Show("经理已经确定此任务:已完成,如有问题请沟通经理", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                            e.Cancel = True '则取消更改
                            Return
                        End If
                    Else
                        If e.OldValue <> "已完成" Then
                            If e.NewValue = "已完成" Then
                                MessageBox.Show("经理才可以确定此任务:已完成,可以录入:已完成了或已完成+完成日期  最好再截图通知经理已完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                                e.Cancel = True '则取消更改
                            End If
                            Return
                        End If
                    End If
                End If
            End If
        End If
        
End Select


因为有十几列,可以怎么优化呢?
case 函数怎么简化呢?

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/17 8:56:00 [只看该作者]

Select Case e.DataCol.name
    Case "第一列","第二列"
        If User.Group <> "经理" Then
            If e.OldValue = "已完成" Then
                If e.NewValue <> "已完成" Then
                    MessageBox.Show("经理已经确定此任务:已完成,如有问题请沟通经理", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    e.Cancel = True '则取消更改
                    Return
                End If
            Else
                If e.OldValue <> "已完成" Then
                    If e.NewValue = "已完成" Then
                        MessageBox.Show("经理才可以确定此任务:已完成,可以录入:已完成了或已完成+完成日期  最好再截图通知经理已完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                        e.Cancel = True '则取消更改
                    End If
                    Return
                End If
            End If
        End If
End Select

 回到顶部