⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productlist.ascx.vb

📁 这是一个订单管理系统
💻 VB
字号:
Imports OrderDll

Partial Class ProductList
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        TableInit()
    End Sub

    Protected Sub Btn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim id As String
        Dim cp As New ClassProduct

        id = DirectCast(sender, Button).ID.Substring(3)
        If cp.Delete(id) = False Then
            TableClear(TableProduct)
            TableInit()
        Else

        End If

    End Sub

    Private Sub TableInit()
        Dim dsProduct As Data.DataSet
        Dim cp As New ClassProduct
        Dim count As Integer
        dsProduct = New Data.DataSet
        If cp.List(dsProduct) = False Then
            With dsProduct.Tables(0)
                For count = 0 To .Rows.Count - 1
                    TableProduct.Controls.Add(GenrateRow( _
                        .Rows(count).Item(0).ToString(), _
                        .Rows(count).Item(1).ToString(), _
                        .Rows(count).Item(2).ToString(), _
                        .Rows(count).Item(3), _
                        .Rows(count).Item(4), _
                        .Rows(count).Item(5), _
                        .Rows(count).Item(6)) _
                   )
                Next
            End With
        Else

        End If

    End Sub

    Private Function GenrateRow(ByVal id As String, ByVal name As String, ByVal unit As String, ByVal storage As Integer, ByVal sellrate As Double, ByVal cost As Double, ByVal total As Integer) As TableRow
        Dim tr As New TableRow
        Dim tc As TableCell
        Dim btnDel As Button
        Dim btn As HtmlInputButton
        tc = New TableCell
        tc.Text = id
        tr.Controls.Add(tc)
        tc = New TableCell
        tc.Text = name
        tr.Controls.Add(tc)
        tc = New TableCell
        tc.Text = unit
        tr.Controls.Add(tc)
        tc = New TableCell
        tc.Text = storage.ToString()
        tr.Controls.Add(tc)
        tc = New TableCell
        tc.Text = sellrate.ToString()
        tr.Controls.Add(tc)
        tc = New TableCell
        tc.Text = cost.ToString()
        tr.Controls.Add(tc)
        tc = New TableCell
        tc.Text = total.ToString()
        tr.Controls.Add(tc)

        tc = New TableCell
        btn = New HtmlInputButton
        btn.Attributes("value") = "修改"
        btn.Attributes("OnClick") = "javascript:self.location='ProductEdit.aspx?PID=" & id & "';"
        tc.Controls.Add(btn)
        btnDel = New Button
        btnDel.Text = "删除"
        btnDel.ID = "Del" & id
        AddHandler btnDel.Click, AddressOf Me.Btn_Click
        tc.Controls.Add(btnDel)
        tr.Controls.Add(tc)

        tc = New TableCell
        btn = New HtmlInputButton
        btn.Attributes("value") = "添加"
        btn.Attributes("OnClick") = "javascript:self.location='Producing.aspx?PID=" & id & "';"
        tc.Controls.Add(btn)
        btn = New HtmlInputButton
        btn.Attributes("value") = "察看"
        btn.Attributes("OnClick") = "javascript:self.location='ProducingView.aspx?PID=" & id & "';"
        tc.Controls.Add(btn)
        tr.Controls.Add(tc)

        Return tr
    End Function

    Protected Sub TableClear(ByVal tbl As Table)
        Dim temp As TableRow
        temp = tbl.Controls(0)
        tbl.Controls.Clear()
        tbl.Controls.Add(temp)
    End Sub

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -