Imports System.Data.SqlClient
Imports System
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Partial Public Class citem_ee
Inherits System.Web.UI.Page
Dim conn As New SqlConnection(GetConn)
Dim p As xPackage
Dim i As xItem
Dim c As xCustomer
Dim b As xBrand
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim lblMsg As New Label
Dim lblTitle As New Label
Dim lblTId As New Label
Dim lblTMake As New Label
Dim lblTItemId As New Label
Dim lblTModel As New Label
Dim lblTCondition As New Label
Dim lblTIMEI As New Label
Dim lblTCost As New Label
Dim lblTValued As New Label
Dim lblTStored As New Label
Dim lblTCredited As New Label
Dim lblTDeleted As New Label
Dim chr(160) As Char
lblMsg.Text = Chr(160)
Dim id As Integer = 0
Try
id = Request.QueryString("id")
Catch ex As Exception
id = 0
End Try
If id > 0 Then
i = New xItem(id)
If i.GetID > 0 Then
p = New xPackage(i.PackageID)
If p.GetID > 0 Then
If p.CustomerID = CustID(User) Then
c = New xCustomer(CustID(User))
b = New xBrand(c.BrandID)
If Not Page.IsPostBack Then
Dim lang As String = b.Lang
Bind()
lblTitle.Text = GetText("Item", lang)
lblTId.Text = GetText("RecyclingPackage id:", lang)
lblTItemId.Text = "ringluspaketi id" 'GetText("item id:", lang)
lblTMake.Text = GetText("make:", lang)
lblTModel.Text = GetText("model:", lang)
lblTCondition.Text = GetText("phone condition:", lang)
lblTIMEI.Text = "imei:"
lblTCost.Text = GetText("price:", lang)
'lblTDescription.Text = GetText("description:", lang)
lblTValued.Text = GetText("valued:", lang)
lblTStored.Text = "kätte saadud" 'GetText("stored:", lang)
lblTCredited.Text = GetText("credited:", lang)
lblTDeleted.Text = GetText("deleted:", lang)
End If
Else
cInsufficientRights(b.Lang)
End If
Else
cShowMessage("Database connection error.")
End If
Else
cShowMessage("Database connection error.")
End If
Else
cShowMessage("Database connection error.")
End If
End Sub
Protected Sub Bind()
BindPackage()
BindItem()
End Sub
Private Sub BindPackage()
hlId.Text = ToIDFormat(p.GetID)
hlId.NavigateUrl = RootLevel(True) & "/customers_ee/cpackage.aspx?id=" & p.GetID
End Sub
Private Sub BindItem()
lblItemId.Text = ToIDFormat(i.GetID)
If i.Valued Then
Dim cost As Double = i.Cost * i.Rate
Dim curr As String = b.Currency
lblCost.Text = curr & " " & FormatNumber(cost, 2, , , -1)
Dim model As New xModel(i.ModelID)
Dim make As New xMake(model.MakeID)
lblMake.Text = make.Name
lblModel.Text = model.Name
Dim conditionName As String = GetConditionName(i.ConditionBought)
If (conditionName = "Working") Then
conditionName = "Töötav"
ElseIf (conditionName = "NonWorking") Then
conditionName = "Vigane"
ElseIf (conditionName = "BER") Then
conditionName = "Parandamiskõlbmatu"
End If
lblCondition.Text = conditionName
lblIMEI.Text = i.UniqueCode
Else
lblCost.Text = "-"
End If
'If i.FreeText.Trim.Length > 0 Then
' lblDescription.Text = i.FreeText.Replace(vbCrLf, "<BR>")
'Else
' lblDescription.Text = "-"
'End If
If i.Valued Then
lblValued.Text = i.ValuedTime.ToShortDateString
Else
lblValued.Text = "-"
End If
If i.Stored Then
lblStored.Text = i.StoredTime.ToShortDateString
Else
lblStored.Text = "-"
End If
If i.Credited Then
lblCredited.Text = i.CreditedTime.ToShortDateString
Else
lblCredited.Text = "-"
End If
If i.Deleted Then
lblDeleted.Text = i.DeletedTime.ToShortDateString
Else
lblDeleted.Text = "-"
End If
End Sub
Protected Function xToIDFormat(ByVal str As String) As String
Return ToIDFormat(str)
End Function