Imports System.Data
Imports System.Data.SqlClient
Partial Class ProductInformationData
    Inherits System.Web.UI.Page
    Dim ProdCode As String
    Dim btnValue As String
    Dim dr As SqlDataReader
    Dim con As New SqlConnection
    Dim cmd As New SqlCommand
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim str123 As String = Request.QueryString("Id").ToString   'This value come from every button control of UserControl/ProductDetails.ascx page , using onClientClick " 
        con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
        pnlappl.Visible = False
        pnlfeat.Visible = False
        pnltecgspec.Visible = False
        pnlspecialnote.Visible = False
        pnlprodmsds.Visible = False
        pnlconsumables.Visible = False
        pnloptaccessories.Visible = False
        pnlaccincluded.Visible = False
        pnlwearntear.Visible = False
        pnlcatalogue.Visible = False
        pnlstandards.Visible = False
        pnlusermanual.Visible = False
        pnlguaranty.Visible = False
        pnlpackaging.Visible = False
        pnlinstallncomm.Visible = False
        pnltestimonial.Visible = False
        ProdCode = Session("ProductCode")
        btnValue = Session("BtnInformation")

        If str123 = "btnApplicatin" Then
            pnlappl.Visible = True
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select prodApp_Application from ProductApplication where prodApp_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            ' If dr1.Read Then
            lblappl.Text = "<b>" & "Applications :" & "</b>" & "<Br>"
            While dr.Read
                lblappl.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            ' lblappl.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnfeature" Then
            pnlappl.Visible = False
            pnlfeat.Visible = True
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select prodfeatures_features from ProductFeatures where prodfeatures_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            '  If dr.Read Then
            lblfeat.Text = "<b>" & "Features :" & "</b>" & "<Br>"
            While dr.Read
                lblfeat.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lblfeat.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()
            Exit Sub

        ElseIf str123 = "btntechspec" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = True
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select TechSpec_parameter from ProductTechnicalSpecification where TechSpec_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lbltechspec.Text = "<b>" & "Technical Specification :" & "</b>" & "<Br>"
            While dr.Read
                lbltechspec.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lbltechspec.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnwearntear" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = True
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select WearAndTearPart_PartName from WearAndTearParts where WearAndTearPart_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lblwearntear.Text = "<b>" & "Wear & Tear :" & "</b>" & "<Br>"
            While dr.Read
                lblwearntear.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lblwearntear.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnstandards" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = True
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select ProdStdApproval_StandardName from ProductStandardApproval where ProdStdApproval_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lblstandards.Text = "<b>" & "Product Standards :" & "</b>" & "<Br>"
            While dr.Read
                lblstandards.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lblstandards.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()


        ElseIf str123 = "btnpckdetails" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = True
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select ProdPackaging_PackingType,ProdPackaging_Material,ProdPackaging_IsFragile,ProdPackaging_IsWoodContain from ProductPackaging where ProdPackaging_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'lblpackaging.Text = "<b>" & "Product Packaging Details :" & "</b>" & "<Br>"
            While dr.Read
                lblpackaging.Text &= "<li>" & dr(0) & "<br>"
                lblpackaging1.Text &= "<li>" & dr(1) & "<br>"
                lblpackaging2.Text &= "<li>" & dr(2) & "<br>"
                lblpackaging3.Text &= "<li>" & dr(3) & "<br>"
            End While
            con.Close()

        ElseIf str123 = "btnGuaranty" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = True
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select Product_MarketPrice,product_image,Product_Code,Product_ModelNo,Product_weight,Product_Dimension,Product_MinOrderQty,Product_ShippingQty,Product_DeliveryPeriod,Product_DeliveryPeriodType,Product_GuarantyPeriod,Product_GuarantyPeriodType,Product_WarrantyPeriod,Product_WarrantyPeriodType,Product_SpecialPrice from product_master where product_kid='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            lblguaranty.Text = "<b>" & "Product Packaging Details :" & "</b>" & "<Br>"
            While dr.Read

                lblguaranty.Text = dr(10).ToString()
                lblguaranty1.Text = dr(11).ToString()
                lblguaranty2.Text = dr(12).ToString()
                lblguaranty3.Text = dr(13).ToString()

            End While
            con.Close()


        ElseIf str123 = "btnInsttComm" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = True
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select InstallationComm_IsChargeable,InstallationComm_Amount,InstallationComm_IsMaintenanceTraining,InstallationComm_IsAMCAvailable from ProductInstallationCommissioning where InstallationComm_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'lblinstallncomm1.Text = "<b>" & "Product Installation And Commissioning :" & "</b>" & "<Br>"
            While dr.Read
                lblinstallncomm1.Text &= "<li>" & dr(0) & "<br>"
                lblinstallncomm2.Text &= "<li>" & dr(1) & "<br>"
                lblinstallncomm3.Text &= "<li>" & dr(2) & "<br>"
                lblinstallncomm4.Text &= "<li>" & dr(3) & "<br>"
            End While
            con.Close()

        ElseIf str123 = "btnspecialnote" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = True
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select ProdSpecInstr_Instruction from ProductSpecialNotesInstruction where ProdSpecInstr_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lblspecialnote.Text = "<b>" & "Special Notes :" & "</b>" & "<Br>"
            While dr.Read
                lblspecialnote.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lblspecialnote.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnproductmsds" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = True
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select MSDS_UploadedDataSheetName from MaterialSafetyDataSheet where MSDS_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            Hypprodmsds.Text = "<b>" & "Product Material Safety Data Sheet :" & "</b>" & "<Br>"
            While dr.Read
                Hypprodmsds.Text &= "<li>" & dr(0) & "<br>"
                Hypprodmsds.NavigateUrl = "~\SupplierImage\MSDS\" & dr(0).ToString
            End While
            'Else
            'lblprodmsds.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnconsumable" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = True
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False


            cmd = New SqlCommand("SELECT Consumables.c_cname, Consumables.c_cquantity, Unit_Master.Unit_Name FROM Consumables INNER JOIN Unit_Master ON Consumables.c_cunit = Unit_Master.Unit_Kid WHERE Consumables.c_kid ='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lblconsumables.Text = "<b>" & "Consumables :" & "</b>" & "<Br>"
            While dr.Read
                lblspecialnote.Text &= "<li>" & dr(0) & "-" & dr(1) & "-" & dr(2) & "<br>"
            End While
            'Else
            'lblspecialnote.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()



        ElseIf str123 = "btnaccoptional" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = True
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select AccessoriesOptional_Name from AccessoriesOptional_Master where AccessoriesOptional_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lbloptaccessories.Text = "<b>" & "Product Optional Accessories :" & "</b>" & "<Br>"
            While dr.Read
                lbloptaccessories.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lbloptaccessories.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnaccincluded" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = True
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("select AccessoriesIncluded_Name from AccessoriesIncluded_Master where AccessoriesIncluded_ProductId='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            lblaccincluded.Text = "<b>" & "Product Accessories Included :" & "</b>" & "<Br>"
            While dr.Read
                lblaccincluded.Text &= "<li>" & dr(0) & "<br>"
            End While
            'Else
            'lblaccincluded.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btncatalogue" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = True
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("SELECT Catalog_upload FROM Catalog WHERE Catalog_productid ='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            Hypcatalogue.Text = "<b>" & " Catalog :" & "</b>" & "<Br>"
            While dr.Read
                Hypcatalogue.Text &= "<li>" & dr(0) & "<br>"
                Hypcatalogue.NavigateUrl = "~\Upload Image\Product Image\UploadImages\" & dr(0).ToString
            End While
            'Else
            'lblspecialnote.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnusrman" Then

            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = True
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = False

            cmd = New SqlCommand("SELECT InstCommManual_UploadedManualFileName FROM InstallationManual WHERE InstCommManual_ProductId ='" & ProdCode & "'", con)
            con.Open()
            dr = cmd.ExecuteReader
            'If dr.Read Then
            Hypusermanual.Text = "<b>" & " User Manual :" & "</b>" & "<Br>"
            While dr.Read
                Hypusermanual.Text &= "<li>" & dr(0) & "<br>"
                Hypusermanual.NavigateUrl = "~\Upload Image\Product Image\UploadImages\" & dr(0).ToString
            End While
            'Else
            'lblspecialnote.Text = "<b>" & "There is currently no data for this product" & "</b>" & "<Br>"
            'End If
            con.Close()

        ElseIf str123 = "btnproduserlist" Then
            pnlappl.Visible = False
            pnlfeat.Visible = False
            pnltecgspec.Visible = False
            pnlspecialnote.Visible = False
            pnlprodmsds.Visible = False
            pnlconsumables.Visible = False
            pnloptaccessories.Visible = False
            pnlaccincluded.Visible = False
            pnlwearntear.Visible = False
            pnlcatalogue.Visible = False
            pnlstandards.Visible = False
            pnlusermanual.Visible = False
            pnlguaranty.Visible = False
            pnlpackaging.Visible = False
            pnlinstallncomm.Visible = False
            pnltestimonial.Visible = True



        End If

    End Sub

End Class
