📄 newworkrep.aspx.vb
字号:
status = "workrepdraft"
Else
status = "send"
End If
scheduledFinishingTimestr = ctrl.GetText(TextBox_FinishTime)
End Sub
Protected Sub Button_addFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_addFile.Click
fileAdd()
End Sub
Protected Sub DropDownList_Receiver_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList_Receiver.SelectedIndexChanged
If DropDownList_Receiver.SelectedIndex = 1 Then
Table_inputInfo.Visible = False
Table_AddReceiver.Visible = True
'绑定用户表
'ctrl.BindListBox(ListBox_UserSource, sqldb.GetDv("select * from T_user"), "username", "userid")
Dim dt As DataTable = New DataTable
dt = sqldb.TSelect("V_userrole", "distinct userId,username", "RoleName!='系统管理员' and RoleName!='普通用户'")
ctrl.BindListBox(ListBox_UserSource, dt.DefaultView, "username", "userid")
End If
End Sub
Private Sub fileAdd()
If FileUpload_file.HasFile Then
If FileUpload_file.PostedFile.ContentLength > 52420000 Then
ClientScript.RegisterStartupScript(Me.GetType(), "Error", "<script>window.alert('附件大小超过限制!');</script>")
Return
End If
If ifile = 10 Then
ClientScript.RegisterStartupScript(Me.GetType(), "Error", "<script>window.alert('附件数目已最大!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Else
If ListBox_FileList.Visible = False Then
ListBox_FileList.Visible = True
Button_delFile.Visible = True
End If
For i = 0 To ifile - 1
If Request.QueryString("status") = "workrepdraft" Then
If FileUpload_file.FileName = ListBox_FileList.Items.Item(i).Text Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('已添加!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Return
End If
Else
If FileUpload_file.FileName = upfile(i).FileName Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('已添加!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Return
End If
End If
Next
upfile(ifile) = FileUpload_file
ListBox_FileList.Items.Add(FileUpload_file.FileName.ToString)
ifile = ifile + 1
End If
End If
End Sub
Private Sub fileDel()
If Session.Item("FileStatus") = "workrepdraft" Then
If Session.Item("WorkRepID") <> Nothing Then
idurl = Session.Item("WorkRepID")
Dim dtfile As DataTable = sqldb.GetTable("select * from T_workRepFile where WorkRepID ='" & idurl & "' and FileName = '" & ListBox_FileList.SelectedItem.Text & "'")
If ListBox_FileList.Items.Count = 1 Then
If ListBox_FileList.SelectedIndex = 0 Then
ListBox_FileList.Items.Remove(ListBox_FileList.Items(0).Text.ToString)
upfile(0) = Nothing
ListBox_FileList.Visible = False
Button_delFile.Visible = False
ifile = 0
Kill(Server.MapPath(dtfile.Rows.Item(0).Item("FilePath").ToString))
sqldb.RunSql("delete from T_workRepFile where WorkRepID = '" & idurl & "' and FileName = '" & ListBox_FileList.SelectedItem.Text & "'")
End If
Else
i = ListBox_FileList.SelectedIndex
Dim delstr As String = ListBox_FileList.SelectedItem.Text
dtfile = sqldb.GetTable("select * from T_workRepFile where WorkRepID ='" & idurl & "' and FileName = '" & ListBox_FileList.SelectedItem.Text & "'")
If i > -1 Then
ListBox_FileList.Items.Remove(ListBox_FileList.Items(i).Text.ToString)
upfile(i) = Nothing
For i = i To ifile - 2
upfile(i) = upfile(i + 1)
Next
upfile(ifile - 1) = Nothing
ifile = ifile - 1
Kill(Server.MapPath(dtfile.Rows.Item(0).Item("FilePath").ToString))
sqldb.RunSql("delete from T_workRepFile where WorkRepID = '" & idurl & "' and FileName = '" & ListBox_FileList.SelectedItem.Text & "'")
End If
End If
End If
Else
If ListBox_FileList.Items.Count = 1 Then
If ListBox_FileList.SelectedIndex = 0 Then
ListBox_FileList.Items.Remove(upfile(0).FileName.ToString)
upfile(0) = Nothing
ListBox_FileList.Visible = False
Button_delFile.Visible = False
ifile = 0
End If
Else
i = ListBox_FileList.SelectedIndex
If i > -1 Then
ListBox_FileList.Items.Remove(upfile(i).FileName.ToString)
upfile(i) = Nothing
For i = i To ifile - 2
upfile(i) = upfile(i + 1)
Next
upfile(ifile - 1) = Nothing
ifile = ifile - 1
End If
End If
End If
End Sub
Protected Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_delFile.Click
fileDel()
End Sub
Protected Sub Button_addUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_addUser.Click
If ListBox_UserSource.SelectedIndex = -1 Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('请选择用户后添加!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Return
End If
If ListBox_UserSource.SelectedItem.Value = Profile.user.id Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('不能添加自己为发布对象!');</script>")
'MsgBox("", MsgBoxStyle.Exclamation, "错误!")
Return
End If
For i = 0 To ListBox_UserSelect.Items.Count - 1
If ListBox_UserSource.SelectedItem.Text = ListBox_UserSelect.Items.Item(i).Text Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('该用户已添加!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Return
End If
Next
If ListBox_UserSelect.Items.Count = 49 Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('已达最大添加数目!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
End If
ListBox_UserSelect.Items.Add(ListBox_UserSource.SelectedItem.Text)
ListBox_UserSelect.Items.Item(ListBox_UserSelect.Items.Count - 1).Value = ListBox_UserSource.SelectedItem.Value
End Sub
Protected Sub Button_delUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_delUser.Click
If ListBox_UserSelect.Items.Count = 0 Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('表已空,不能删除!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Return
End If
If ListBox_UserSelect.SelectedIndex = -1 Then
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('请选择删除对象!');</script>")
'MsgBox("!", MsgBoxStyle.Exclamation, "错误!")
Return
End If
ListBox_UserSelect.Items.Remove(ListBox_UserSelect.SelectedItem)
End Sub
Protected Sub Button_ReceiverOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_Confirm.Click
If ListBox_UserSelect.Items.Count = 0 Then
Dim Confirm_Click As String = "<script>if(window.confirm('没有选择任何用户,确定退出?'))__doPostBack('" + LinkButton1.UniqueID + "', '');</script>"
ClientScript.RegisterStartupScript(Me.GetType, "Confirm_Click", Confirm_Click)
Return
End If
reciverID = ","
ireciver = ListBox_UserSelect.Items.Count
For i = 0 To ireciver - 1
reciver(i) = ListBox_UserSelect.Items.Item(i).Value
reciverID = reciverID & reciver(i) & ","
Next
Table_AddReceiver.Visible = False
Table_inputInfo.Visible = True
End Sub
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
DropDownList_Receiver.SelectedItem.Selected = False
DropDownList_Receiver.Items.FindByText("请选择汇报对象....").Selected = True
Table_AddReceiver.Visible = False
Table_inputInfo.Visible = True
End Sub
Private Sub taskProc()
Dim task As TTask = Nothing
Dim s2h As New CStringToHTML
Dim taskClass As New CTask
taskClass.init("T_workRepTasks")
With task
.title = s2h.str2html(mtitle)
.description = s2h.str2html("由用户" & users.GetUserName(Profile.user.id) & "发送给您的工作汇报。要查看本汇报,请单击这个链接。")
.processingURL = s2h.str2html("~/GZHB/ViewWorkRep.aspx?WorkRepID=" & idurl)
.receiverID = reciver(i)
.releaseTime = SendTime
.scheduledFinishingTime = scheduledFinishingTime
.senderID = Profile.user.id
.subModID = subModuleEnums.workrep_unread
.taskType = itaskType.commonTask
.recordID = idurl
End With
taskClass.newTask(task, -1)
End Sub
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If reciverID <> "" Then
Table_inputInfo.Visible = False
Table_AddReceiver.Visible = True
Else
ClientScript.RegisterStartupScript(Me.GetType(), "NoContents", "<script>window.alert('未选择任何用户,请先选择!');</script>")
End If
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
'Dim dt As DataTable = New DataTable
'If DropDownList1.SelectedItem.Text <> "所有用户" Then
' dt = sqldb.TSelect("V_userrole", "userId,username", "RoleID=" & DropDownList1.SelectedValue)
'ElseIf DropDownList1.SelectedItem.Text = "所有用户" Then
' dt = sqldb.TSelect("V_userrole", "distinct userId,username", "RoleName!='系统管理员' and RoleName!='普通用户'")
'End If
'ctrl.BindListBox(ListBox_UserSource, dt.DefaultView, "username", "userid")
ddd()
End Sub
Public Sub ddd()
Dim dt As DataTable = New DataTable
If DropDownList1.SelectedItem.Text <> "所有用户" Then
dt = sqldb.TSelect("V_userrole", "userId,username", "RoleID=" & DropDownList1.SelectedValue)
ElseIf DropDownList1.SelectedItem.Text = "所有用户" Then
dt = sqldb.TSelect("V_userrole", "distinct userId,username", "RoleName!='系统管理员' and RoleName!='普通用户'")
End If
ctrl.BindListBox(ListBox_UserSource, dt.DefaultView, "username", "userid")
End Sub
Public Function delWorkRep(ByVal WorkRepID As Integer) As Boolean
Dim dt As DataTable = sqldb.GetTable("select * from T_workRep where WorkRepID ='" & WorkRepID & "'")
If dt.Rows.Count > 0 Then
If dt.Rows.Item(0).Item("mFile") = True Then
Dim i, j As Integer
dt = sqldb.GetTable("select * from T_workRepFile where WorkRepID ='" & WorkRepID & "'")
i = dt.Rows.Count
For j = 0 To i - 1
Kill(Server.MapPath(dt.Rows.Item(0).Item("FilePath").ToString))
Next
sqldb.RunSql("delete from T_workRepFile where WorkRepID ='" & WorkRepID & "'")
End If
End If
sqldb.RunSql("delete from T_workRepReturn where WorkRepID = '" & WorkRepID & "'")
sqldb.RunSql("delete from T_workRep where WorkRepID = '" & WorkRepID & "'")
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -