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

📄 viewmysaleitems.aspx.vb

📁 该系统是关于c2c电子商务系统 用asp.net技术 开发环境是vs2003+sqlserver2000
💻 VB
字号:
Public Class ViewMySaleItems
    Inherits System.Web.UI.Page
    Protected WithEvents lblItemID As System.Web.UI.WebControls.Label
    Protected WithEvents lblUserName As System.Web.UI.WebControls.Label
    Protected WithEvents Table1 As System.Web.UI.WebControls.Table
    Protected WithEvents lblMsg As System.Web.UI.WebControls.Label
    Protected WithEvents lblStatus As System.Web.UI.WebControls.Label
    Protected WithEvents myItems As System.Web.UI.WebControls.DataGrid
    Protected WithEvents hypAcceptBID As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lblNote1 As System.Web.UI.WebControls.Label
    Protected WithEvents MyBuyItems As System.Web.UI.WebControls.DataGrid
    Protected WithEvents lblNote2 As System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If Not Page.IsPostBack Then
            BindGrid()
            lblUserName.Text = "欢迎您 <b>" & Request.Cookies("email").Value & "</b><br><br>"

            If Request.QueryString("msg") = "1" Then
                lblStatus.Text = "恭喜!你已经成功接受报价"
            End If

            If Request.QueryString("msg") = "0" Then
                lblStatus.Text = "失败!你没有接受报价"
            End If

        End If
    End Sub

    Sub myItems_Edit(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
        myItems.EditItemIndex = CInt(E.Item.ItemIndex)
        BindGrid()
    End Sub

    Sub myItems_Cancel(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
        myItems.EditItemIndex = -1
        BindGrid()
    End Sub

    Sub myItems_Update(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)

        Dim strItemID As String = myItems.DataKeys(CInt(E.Item.ItemIndex))
        Dim strItemName As String = CType(E.Item.FindControl("txtItemName"), TextBox).Text
        Dim strItemDesc As String = CType(E.Item.FindControl("txtDescription"), TextBox).Text
        Dim strAskingPrice As String = CType(E.Item.FindControl("txtAskPrice"), TextBox).Text
        Dim strNotifyPrice As String = CType(E.Item.FindControl("txtNotifyPrice"), TextBox).Text

        Dim myItem As C2CSystem.Item = New C2CSystem.Item()
        Dim strResult As String

        strResult = myItem.UpdateItem(strItemID, strItemName, strItemDesc, _
                                      strAskingPrice, strNotifyPrice)

        If strResult = "1" Then
            lblStatus.Text = "更新成功! "
        ElseIf Len(strResult) > 1 Then
            lblStatus.Text = "更新失败!" & strResult
        End If

        myItems.EditItemIndex = -1
        BindGrid()
    End Sub

    Sub myItems_Delete(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)

        Dim strItemID As String = myItems.DataKeys(CInt(e.Item.ItemIndex))
        Dim myItem As C2CSystem.Item = New C2CSystem.Item()
        Dim strResult As String

        strResult = myItem.DeleteItem(strItemID)

        If strResult = "1" Then
            lblStatus.Text = "更新成功!"
        ElseIf Len(strResult) > 1 Then
            lblStatus.Text = "更新失败!" & strResult
        End If

        myItems.EditItemIndex = -1
        BindGrid()
    End Sub

    Private Sub BindGrid()
        Dim intSellerID As Int32 = CInt(Request.Cookies("personid").Value)
        Dim objItemList As C2CSystem.Item = New C2CSystem.Item()

        myItems.DataSource = objItemList.ViewItems(intSellerID)
        myItems.DataBind()

        MyBuyItems.DataSource = objItemList.ViewBuyItems(intSellerID)
        MyBuyItems.DataBind()

    End Sub

    Sub myItems_ItemCreated(ByVal Sender As Object, ByVal e As DataGridItemEventArgs)
        If e.Item.ItemType = ListItemType.Item Or _
           e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim temphypAcceptBid As HyperLink
            temphypAcceptBid = e.Item.FindControl("hypAcceptBid")
            temphypAcceptBid.Attributes.Add("onclick", "return confirm('你确定接受此出价吗?');")
        End If

    End Sub


    Public Function FormatURL(ByVal dblHighestBid As Double, _
                              ByVal intItemID As Int32, _
                              ByVal intBidID As Int32) As String
        If dblHighestBid = 0 Then
            Return ""
        Else
            Return "AcceptBid.aspx?itemid=" & intItemID & "&bidid=" & intBidID
        End If
    End Function

    Public Function ShowText(ByVal dblHighestBid As Double) As String
        If dblHighestBid = 0 Then
            Return ""
        Else
            Return "接受出价"
        End If
    End Function

    Public Function FormatHighBid(ByVal dblHighBidAmount As Double) As String
        If dblHighBidAmount > 0 Then
            Return CStr(dblHighBidAmount)
        Else
            Return "还没有人出价"
        End If
    End Function

    Public Function FormatBidderID(ByVal intBidderID As Int32) As String
        If intBidderID > 0 Then
            Return "<a href=ShowPersonDetails.aspx?bidid=" & intBidderID & ">" & intBidderID & "</a>"
        Else
            Return "还没有人出价"
        End If
    End Function

    Public Function IsPending(ByVal strItemStatus As String) As String
        If UCase(Trim(strItemStatus)) = "PENDING" Then
            lblNote1.Visible = True
            lblNote2.Visible = True
            Return "*"
        Else
            Return ""
        End If
    End Function

End Class

⌨️ 快捷键说明

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