Imports System.Data.Sql Client
Imports System
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Partial Public Class citem_ee
Inherits System.Web.UI.P age
Dim conn As New SqlConnection(G etConn)
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.EventArg s) 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.QuerySt ring("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.Pack ageID)
If p.GetID > 0 Then
If p.CustomerID = CustID(User) Then
c = New xCustomer(CustI D(User))
b = New xBrand(c.BrandI D)
If Not Page.IsPostBack Then
Dim lang As String = b.Lang
Bind()
lblTitle.Text = GetText("Item", lang)
lblTId.Text = GetText("Recycl ingPackage id:", lang)
lblTItemId.Text = "ringluspak eti id" 'GetText("item id:", lang)
lblTMake.Text = GetText("make:" , lang)
lblTModel.Text = GetText("model: ", lang)
lblTCondition.T ext = GetText("phone condition:", lang)
lblTIMEI.Text = "imei:"
lblTCost.Text = GetText("price: ", lang)
'lblTDescriptio n.Text = GetText("descri ption:", lang)
lblTValued.Text = GetText("valued :", lang)
lblTStored.Text = "kätte saadud" 'GetText("store d:", lang)
lblTCredited.Te xt = GetText("credit ed:", lang)
lblTDeleted.Tex t = GetText("delete d:", lang)
End If
Else
cInsufficientRi ghts(b.Lang)
End If
Else
cShowMessage("D atabase connection error.")
End If
Else
cShowMessage("D atabase connection error.")
End If
Else
cShowMessage("D atabase connection error.")
End If
End Sub
Protected Sub Bind()
BindPackage()
BindItem()
End Sub
Private Sub BindPackage()
hlId.Text = ToIDFormat(p.Ge tID)
hlId.NavigateUr l = RootLevel(True) & "/customers_ee/cpackage.aspx?i d=" & p.GetID
End Sub
Private Sub BindItem()
lblItemId.Text = ToIDFormat(i.Ge tID)
If i.Valued Then
Dim cost As Double = i.Cost * i.Rate
Dim curr As String = b.Currency
lblCost.Text = curr & " " & FormatNumber(co st, 2, , , -1)
Dim model As New xModel(i.ModelI D)
Dim make As New xMake(model.Mak eID)
lblMake.Text = make.Name
lblModel.Text = model.Name
Dim conditionName As String = GetConditionNam e(i.ConditionBo ught)
If (conditionName = "Working") Then
conditionName = "Töötav"
ElseIf (conditionName = "NonWorking ") Then
conditionName = "Vigane"
ElseIf (conditionName = "BER") Then
conditionName = "Parandamiskõlb matu"
End If
lblCondition.Te xt = conditionName
lblIMEI.Text = i.UniqueCode
Else
lblCost.Text = "-"
End If
'If i.FreeText.Trim .Length > 0 Then
' lblDescription. Text = i.FreeText.Repl ace(vbCrLf, "<BR>")
'Else
' lblDescription. Text = "-"
'End If
If i.Valued Then
lblValued.Text = i.ValuedTime.To ShortDateString
Else
lblValued.Text = "-"
End If
If i.Stored Then
lblStored.Text = i.StoredTime.To ShortDateString
Else
lblStored.Text = "-"
End If
If i.Credited Then
lblCredited.Tex t = i.CreditedTime. ToShortDateStri ng
Else
lblCredited.Tex t = "-"
End If
If i.Deleted Then
lblDeleted.Text = i.DeletedTime.T oShortDateStrin g
Else
lblDeleted.Text = "-"
End If
End Sub
Protected Function xToIDFormat(ByV al str As String) As String
Return ToIDFormat(str)
End Function
Imports System
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Partial Public Class citem_ee
Inherits System.Web.UI.P age
Dim conn As New SqlConnection(G etConn)
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.EventArg s) 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.QuerySt ring("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.Pack ageID)
If p.GetID > 0 Then
If p.CustomerID = CustID(User) Then
c = New xCustomer(CustI D(User))
b = New xBrand(c.BrandI D)
If Not Page.IsPostBack Then
Dim lang As String = b.Lang
Bind()
lblTitle.Text = GetText("Item", lang)
lblTId.Text = GetText("Recycl ingPackage id:", lang)
lblTItemId.Text = "ringluspak eti id" 'GetText("item id:", lang)
lblTMake.Text = GetText("make:" , lang)
lblTModel.Text = GetText("model: ", lang)
lblTCondition.T ext = GetText("phone condition:", lang)
lblTIMEI.Text = "imei:"
lblTCost.Text = GetText("price: ", lang)
'lblTDescriptio n.Text = GetText("descri ption:", lang)
lblTValued.Text = GetText("valued :", lang)
lblTStored.Text = "kätte saadud" 'GetText("store d:", lang)
lblTCredited.Te xt = GetText("credit ed:", lang)
lblTDeleted.Tex t = GetText("delete d:", lang)
End If
Else
cInsufficientRi ghts(b.Lang)
End If
Else
cShowMessage("D atabase connection error.")
End If
Else
cShowMessage("D atabase connection error.")
End If
Else
cShowMessage("D atabase connection error.")
End If
End Sub
Protected Sub Bind()
BindPackage()
BindItem()
End Sub
Private Sub BindPackage()
hlId.Text = ToIDFormat(p.Ge tID)
hlId.NavigateUr l = RootLevel(True) & "/customers_ee/cpackage.aspx?i d=" & p.GetID
End Sub
Private Sub BindItem()
lblItemId.Text = ToIDFormat(i.Ge tID)
If i.Valued Then
Dim cost As Double = i.Cost * i.Rate
Dim curr As String = b.Currency
lblCost.Text = curr & " " & FormatNumber(co st, 2, , , -1)
Dim model As New xModel(i.ModelI D)
Dim make As New xMake(model.Mak eID)
lblMake.Text = make.Name
lblModel.Text = model.Name
Dim conditionName As String = GetConditionNam e(i.ConditionBo ught)
If (conditionName = "Working") Then
conditionName = "Töötav"
ElseIf (conditionName = "NonWorking ") Then
conditionName = "Vigane"
ElseIf (conditionName = "BER") Then
conditionName = "Parandamiskõlb matu"
End If
lblCondition.Te xt = conditionName
lblIMEI.Text = i.UniqueCode
Else
lblCost.Text = "-"
End If
'If i.FreeText.Trim .Length > 0 Then
' lblDescription. Text = i.FreeText.Repl ace(vbCrLf, "<BR>")
'Else
' lblDescription. Text = "-"
'End If
If i.Valued Then
lblValued.Text = i.ValuedTime.To ShortDateString
Else
lblValued.Text = "-"
End If
If i.Stored Then
lblStored.Text = i.StoredTime.To ShortDateString
Else
lblStored.Text = "-"
End If
If i.Credited Then
lblCredited.Tex t = i.CreditedTime. ToShortDateStri ng
Else
lblCredited.Tex t = "-"
End If
If i.Deleted Then
lblDeleted.Text = i.DeletedTime.T oShortDateStrin g
Else
lblDeleted.Text = "-"
End If
End Sub
Protected Function xToIDFormat(ByV al str As String) As String
Return ToIDFormat(str)
End Function