?? viewmysaleitems.aspx.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 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 = "恭喜!你已經(jīng)成功接受報(bào)價(jià)"
End If
If Request.QueryString("msg") = "0" Then
lblStatus.Text = "失敗!你沒有接受報(bào)價(jià)"
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 Bid.Item = New Bid.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 Bid.Item = New Bid.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 Bid.Item = New Bid.Item()
myItems.DataSource = objItemList.ViewItems(intSellerID)
myItems.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('你確定接受此出價(jià)嗎?');")
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 "接受出價(jià)"
End If
End Function
Public Function FormatHighBid(ByVal dblHighBidAmount As Double) As String
If dblHighBidAmount > 0 Then
Return CStr(dblHighBidAmount)
Else
Return "還沒有人出價(jià)"
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 "還沒有人出價(jià)"
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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -