Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Drawing
Imports QueryString
Imports System
Imports System.Decimal


Partial Class UserControl_ProductDetails
    Inherits System.Web.UI.UserControl
    Dim cmd As New SqlCommand
    Dim dr As SqlDataReader
    Dim dr1 As SqlDataReader
    Dim con As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
    Dim prodcode As String
    Dim SpecialPrice As Decimal = 0.0
    '    Dim dcodestr As New QueryString
    Dim dtCategoryDistinct As DataTable
    Dim enc_prodid As String


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        prodcode = DecodeURL((RemoveLiterals(Request.QueryString("ProductCode"))))

        '   enc_prodid = EncodeURL((RemoveLiterals(Request.QueryString("ProductCode"))))

        If Not IsPostBack Then


            'If TextBox1.Text = "Yes" Then
            '    Response.Write("Javascripts is Enable")
            'Else
            '    Response.Write("Javascripts is disable")
            'End If

            'If Session("JSChecked") Is Nothing Then
            '    'JSChecked -indicates if it tried to run the javascript version
            '    Session("JSChecked") = "Checked"
            '    ' prevent infinite loop
            '    Dim path As String = Request.Url.AbsoluteUri & "?JScript=1"
            '    Page.ClientScript.RegisterStartupScript(Me.[GetType](), "redirect", "window.location.href='default.aspx?JScript=1';", True)
            'End If
            'If Request.QueryString("JScript") Is Nothing Then
            '    Response.Write("JavaScript is not enabled.")
            'Else
            '    Response.Write("JavaScript is enabled.")
            'End If


            If IsNothing(CatDistinct) Then
                GetCatDistinct()
            End If
            dtCategoryDistinct = CatDistinct

            Session("BtnInformation") = Nothing

            Try
                lnkprice.Attributes.Add("onclick", "return openform('" & (RemoveLiterals(Request.QueryString("ProductCode"))) & "');")
                lnktax.Attributes.Add("onclick", "return openformtax();")

                lnkButton.Attributes.Add("onclick", "return OpenFrm();")
                Img1.Attributes.Add("onclick", "return OpenFrm();")
                'lnkseevideo.Attributes.Add("onclick", "return OpenVedio();")
                lnkInquiry.Attributes.Add("onclick", "return OpenQuery('" & (RemoveLiterals(Request.QueryString("ProductCode"))) & "');")

                Session("ProductCode") = (RemoveLiterals(Request.QueryString("ProductCode")))
                lnkproductAlert.Attributes.Add("onclick", "return OpenProductAlert('" & prodcode & "');")
                lnkTellAFriend.Attributes.Add("onclick", "return OpenTellFriend();")

                Dim con As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
                Dim str As String = "SELECT Product_Name,Product_Description,Product_CategoryId FROM Product_Information WHERE Product_Kid = '" & prodcode & "'"
                Dim sda1 As New SqlDataAdapter(str, con)
                Dim ds1 As New DataSet
                sda1.Fill(ds1)
                'fillURL(ReturnValue("Select Product_CategoryId from Product_Master where Product_KId='" & RemoveLiterals(DecodeURL(Session("ProductCode").ToString)) & "'"))
                fillURL(ds1.Tables(0).Rows(0)(2).ToString())
                tdProductName.InnerHtml = "<a style='color:#155799' href ='" & Request.RawUrl & "'>" & ds1.Tables(0).Rows(0)(0).ToString() & "</a>"

                'lblProductName.Text = "Product Name : " & ds1.Tables(0).Rows(0)(0).ToString()
                If ds1.Tables(0).Rows(0)(1).ToString().Trim = "" Then

                    trproduct.Visible = False
                Else
                    trproduct.Visible = True

                    tdproduct.InnerHtml = ds1.Tables(0).Rows(0)(1).ToString().Trim
                    tdproduct.NoWrap = False
                End If

                'str = "SELECT Category_Master.Category_Kid,Category_Master.Category_Name FROM Product_Information INNER JOIN Category_Master ON Product_Information.Product_CategoryId = Category_Master.Category_Kid WHERE Product_Information.Product_Kid = '" & prodcode & "' AND (Category_Master.Category_IsDeleted = N'0')"
                'Dim ds As New DataSet
                'Dim sda As New SqlDataAdapter(str, con)
                'sda.Fill(ds)
                'Dim lblhead As String

                'If Session("Hlabel") = Nothing Then
                '    Dim parent As String = ds.Tables(0).Rows(0)(1).ToString()
                '    Session("backcatid") = ds.Tables(0).Rows(0)(0).ToString       '' Session For ProductDisplay Control by Kalpesh Patel
                '    str = "SELECT Category_Master.Category_Kid,Category_Master.Category_Name FROM Product_Information INNER JOIN Category_Master ON Product_Information.Product_CategoryId = Category_Master.Category_Kid WHERE Product_Information.Product_Kid = '" & prodcode & "' AND (Category_Master.Category_IsDeleted = N'0')"


                '    lblhead = parent & ">"
                '    While parent <> "Root Category"
                '        parent = ReturnValue("SELECT     Category_Master.Category_Name AS Expr2 FROM         Category_Master INNER JOIN                    Category_Master AS Category_Master_1 ON Category_Master.Category_Kid = Category_Master_1.Category_ParentId WHERE     (Category_Master.Category_IsDeleted = N'0') AND (Category_Master.Category_IsDeleted = N'0') AND Category_Master_1.Category_Name = '" & parent & "'")
                '        If parent = "" Then
                '            Exit While
                '        End If
                '        lblhead = parent & " > " & lblhead
                '    End While
                '    Session("HLabel") = lblhead
                '    lblcatlist.Text = "<b>Product Category:</b><br/> " & Session("HLabel").ToString()
                'Else
                '    Session("backcatid") = ds.Tables(0).Rows(0)(0).ToString       '' Session For ProductDisplay Control by Kalpesh Patel
                '    lblcatlist.Text = "<b>Product Category:</b> <br/>" & Session("Hlabel").ToString()
                'End If
                prodetails()
                ' System.Threading.Thread.Sleep(5000)

                TechnicalSpecification()

                GiveImageURL()
                displaynone()

                imgMouseOver()
                ds1.Clear()
            Catch ex As Exception
                showmessage(ex.Message.ToString, lblerror)
            End Try
        End If



    End Sub
    Public Sub imgMouseOver()
        ImgApplication.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgCatalog.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgConsumables.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgFeatures.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgGuarantyWarranty.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgIncludedAccess.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgInstallationCommissioning.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgMSDS.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgOptionalAccess.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgPackagingDetails.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgProductStandardApproval.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgSpareParts.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgSpecialNotes.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgTechSpecification.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgUserManual.Attributes.Add("onmouseover", "return mousehand(this);")
        ImgWearAndTear.Attributes.Add("onmouseover", "return mousehand(this);")


        ImgApplication.Attributes.Add("onclick", "return imgmouseover(this,'" & tblApplication.ClientID.ToString & "');")
        ImgCatalog.Attributes.Add("onclick", "return imgmouseover(this,'" & tblCatalog.ClientID.ToString & "');")
        ImgConsumables.Attributes.Add("onclick", "return imgmouseover(this,'" & tblConsumables.ClientID.ToString & "');")
        ImgFeatures.Attributes.Add("onclick", "return imgmouseover(this,'" & tblFeature.ClientID.ToString & "');")
        ImgGuarantyWarranty.Attributes.Add("onclick", "return imgmouseover(this,'" & tblGarantyWaranty.ClientID.ToString & "');")
        ImgIncludedAccess.Attributes.Add("onclick", "return imgmouseover(this,'" & tblIncludedAccess.ClientID.ToString & "');")
        ImgInstallationCommissioning.Attributes.Add("onclick", "return imgmouseover(this,'" & tblInstComm.ClientID.ToString & "');")
        ImgMSDS.Attributes.Add("onclick", "return imgmouseover(this,'" & tblMSDS.ClientID.ToString & "');")
        ImgOptionalAccess.Attributes.Add("onclick", "return imgmouseover(this,'" & tblOptionalAccess.ClientID.ToString & "');")
        ImgPackagingDetails.Attributes.Add("onclick", "return imgmouseover(this,'" & tblPackaging.ClientID.ToString & "');")
        ImgProductStandardApproval.Attributes.Add("onclick", "return imgmouseover(this,'" & tblStandardApproval.ClientID.ToString & "');")
        ImgSpareParts.Attributes.Add("onclick", "return imgmouseover(this,'" & tblSpareParts.ClientID.ToString & "');")
        ImgSpecialNotes.Attributes.Add("onclick", "return imgmouseover(this,'" & tblSpecialNotes.ClientID.ToString & "');")
        ImgTechSpecification.Attributes.Add("onclick", "return imgmouseover(this,'" & tblTechSpeci.ClientID.ToString & "');")
        ImgUserManual.Attributes.Add("onclick", "return imgmouseover(this,'" & tblUserManual.ClientID.ToString & "');")
        ImgWearAndTear.Attributes.Add("onclick", "return imgmouseover(this,'" & tblWearAndTear.ClientID.ToString & "');")

        ImgApplication.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblApplication.ClientID.ToString & "');")
        ImgCatalog.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblCatalog.ClientID.ToString & "');")
        ImgConsumables.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblConsumables.ClientID.ToString & "');")
        ImgFeatures.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblFeature.ClientID.ToString & "');")
        ImgGuarantyWarranty.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblGarantyWaranty.ClientID.ToString & "');")
        ImgIncludedAccess.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblIncludedAccess.ClientID.ToString & "');")
        ImgInstallationCommissioning.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblInstComm.ClientID.ToString & "');")
        ImgMSDS.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblMSDS.ClientID.ToString & "');")
        ImgOptionalAccess.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblOptionalAccess.ClientID.ToString & "');")
        ImgPackagingDetails.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblPackaging.ClientID.ToString & "');")
        ImgProductStandardApproval.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblStandardApproval.ClientID.ToString & "');")
        ImgSpareParts.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblSpareParts.ClientID.ToString & "');")
        ImgSpecialNotes.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblSpecialNotes.ClientID.ToString & "');")
        ImgTechSpecification.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblTechSpeci.ClientID.ToString & "');")
        ImgUserManual.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblUserManual.ClientID.ToString & "');")
        ImgWearAndTear.Attributes.Add("onmouseout", "return imgmouseout(this,'" & tblWearAndTear.ClientID.ToString & "');")


    End Sub
    Public Sub displaynone()
        tblApplication.Style.Add("display", "none")
        tblCatalog.Style.Add("display", "none")
        tblConsumables.Style.Add("display", "none")
        tblFeature.Style.Add("display", "none")
        tblGarantyWaranty.Style.Add("display", "none")
        tblInstallationManual.Style.Add("display", "none")
        tblInstComm.Style.Add("display", "none")
        tblMSDS.Style.Add("display", "none")
        tblPackaging.Style.Add("display", "none")
        tblSpecialNotes.Style.Add("display", "none")
        tblStandardApproval.Style.Add("display", "none")
        tblTechSpeci.Style.Add("display", "none")

        tblOptionalAccess.Style.Add("display", "none")
        tblIncludedAccess.Style.Add("display", "none")
        tblUserManual.Style.Add("display", "none")
        tblWearAndTear.Style.Add("display", "none")
        tblSpareParts.Style.Add("display", "none")

    End Sub
    Public Sub GiveImageURL()
        'ImgApplication.ImageUrl = Page.ResolveUrl("~/images/buttons/B04-Applications.gif")
        'ImgCatalog.ImageUrl = Page.ResolveUrl("~/images/buttons/B21-Catalog.gif")
        'ImgConsumables.ImageUrl = Page.ResolveUrl("~/images/buttons/B23-Consum.gif")
        'ImgFeatures.ImageUrl = Page.ResolveUrl("~/images/buttons/B03-Features.gif")
        'ImgGuarantyWarranty.ImageUrl = Page.ResolveUrl("~/images/buttons/B16-GuaWarranty.gif")
        'ImgIncludedAccess.ImageUrl = Page.ResolveUrl("~/images/buttons/B07-Acce-Inclu.gif")
        'ImgInstallationCommissioning.ImageUrl = Page.ResolveUrl("~/images/buttons/B12-Insta-Comm.gif")
        'ImgMSDS.ImageUrl = Page.ResolveUrl("~/images/buttons/B06-Product-MSDS.gif")
        'ImgOptionalAccess.ImageUrl = Page.ResolveUrl("~/images/buttons/B08-Opt-Acces.gif")
        'ImgPackagingDetails.ImageUrl = Page.ResolveUrl("~/images/buttons/B17-Pack-Details.gif")
        'ImgProductStandardApproval.ImageUrl = Page.ResolveUrl("~/images/buttons/B14-Prod-Stand.gif")
        'ImgSpareParts.ImageUrl = Page.ResolveUrl("~/images/buttons/B24-Spares.gif")
        'ImgSpecialNotes.ImageUrl = Page.ResolveUrl("~/images/buttons/B05-Spe-Instru.gif")
        'ImgTechSpecification.ImageUrl = Page.ResolveUrl("~/images/buttons/B02-TechSpec.gif")
        'ImgUserManual.ImageUrl = Page.ResolveUrl("~/images/buttons/B04-Applications.gif")
        'ImgWearAndTear.ImageUrl = Page.ResolveUrl("~/images/buttons/B10-ListWear.gif")

    End Sub
    Public Sub fillURL(ByVal Cat_KID As String)

        Dim dr() As DataRow
        dr = dtCategoryDistinct.Select("Category_KId='" & Cat_KID & "'")
        Dim url As String
        url = ""
        If dr.Length = 0 Then
            tdURL.InnerHtml += "<a style='color:#155799' href='" & ResolveUrl("~/main/" & EncodeURL(RemoveLiterals(Cat_KID.ToString)) & "/" & ReturnValue("Select CategoryName from Category_Distinct where Category_Kid='" & RemoveLiterals(Cat_KID.ToString) & "'") & ".aspx") & "' >" & ReturnValue("Select Category_Name from Category_Distinct where Category_KId ='" & RemoveLiterals(Cat_KID.ToString) & "'") & "</a> > "
            Session("MainCat") = RemoveLiterals(Cat_KID.ToString)
            Exit Sub
        Else
            Dim dr1() As DataRow
            dr1 = dr
            While dr1.Length <> 0
                url += "<a style='color:#155799' href='" & ResolveUrl("~/JJJ/" & EncodeURL(dr(0).Item("Category_Kid").ToString) & "/" & dr(0).Item("ParentName").ToString & "/" & dr(0).Item("CategoryName").ToString & ".aspx") & "' > " & dr(0).Item("Category_Name").ToString & "</a> > | "
                dr = dtCategoryDistinct.Select("Category_KId='" & dr1(0).Item("Category_ParentId") & "'")
                If dr.Length = 0 Then
                    url += "<a style='color:#155799' href='" & ResolveUrl("~/main/" & EncodeURL(RemoveLiterals(dr1(0).Item("Category_ParentId"))) & "/" & dr1(0).Item("ParentName").ToString & ".aspx") & "' >" & dr1(0).Item("Category_ParentName").ToString & "</a> > "
                End If
                dr1 = dr
            End While
        End If

        tdURL.InnerHtml = "<b>You are here > </b><span style='color:#155799'>"
        Dim url1() As String
        url1 = url.Split("|")
        Array.Reverse(url1)

        Dim i As Integer
        For i = 0 To url1.Length - 1
            If i = 0 Then
                tdURL.InnerHtml += url1(0).ToString
                Continue For
            Else

                If i = url1.Length - 1 Then
                    tdURL.InnerHtml += url1(i).Replace("JJJ", "category")
                Else
                    tdURL.InnerHtml += url1(i).Replace("JJJ", "s" & i + 1)
                End If
            End If
        Next
        tdURL.InnerHtml += "</span>"

        Dim str As String
        str = "Hello"


    


    End Sub
    Private Sub prodetails()
        '------------------For Product Image,Code,Price,Model No----------------
        Try
          
            Dim imgpath As String = ""

            'cmd = New SqlCommand("select isnull(Product_AtcoPrice,'0') as [Product_AtcoPrice] ,product_image,Product_Code,Product_ModelNo,Product_weight,Product_Dimension,Product_MinOrderQty,Product_ShippingQty,Product_DeliveryPeriod,Product_DeliveryPeriodType,Product_SpecialPrice,Product_DimensionUnitId,Product_MinOrderQtyType,Product_ShippingQtyType,Product_PcsPerKg,Product_weightunitid from product_master where product_kid='" & prodcode & "'", con)

            cmd = New SqlCommand("SELECT     Product_Code, Product_Name, Product_MarketPrice as [Product_MarketPrice], Product_Image, Product_BrandId, Product_ModelNo, Product_MinOrderQty, Product_ShippingQty, Product_Weight, Product_Dimension, Product_PcsPerKg, Product_DeliveryPeriod FROM Compare_product where product_kid='" & prodcode & "'", con)
            If con.State = ConnectionState.Open Then
                con.Close()
            End If
            con.Open()
            dr = cmd.ExecuteReader
            While dr.Read
                If dr(2).ToString = "" Or dr(2).ToString.Contains(" 0.00") Then
                    lblprice.Visible = False
                    lnkprice.Visible = True

                Else
                    lblprice.Visible = True
                    lnkprice.Visible = False

                End If
                lblprice.Text = dr(2).ToString
                If dr(2).ToString = "" Or dr(2).ToString.Contains(" 0.00") Then
                    lnktax.Visible = False
                Else
                    lnktax.Visible = True
                End If

                Img1.ImageUrl = ResolveUrl("~/Upload Image/Product Image/UploadImages/") & dr(3)
                imgpath = ResolveUrl(Server.MapPath("~/Upload Image/Product Image/UploadImages/" & dr(3)))

                Dim str As String
                'str = Request.RawUrl.Substring(Request.RawUrl.LastIndexOf("/"), Request.RawUrl.LastIndexOf("."))
                str = Path.GetFileName(Request.RawUrl)
                Img1.ToolTip = dr(1).ToString
                Img1.AlternateText = dr(1).ToString


                Dim f As New IO.FileInfo(imgpath)
                If f.Exists = False Then
                    lnkButton.Visible = False
                End If

                KeepAspectRatioNew(Img1, imgpath, 225, 200)
            
                If dr(0).ToString = "" Then
                    lblprodcode.Text = NoDataAvail
                Else
                    lblprodcode.Text = dr(0).ToString
                End If
                If dr(5).ToString = "" Then
                    lblmfrmodel.Text = NoDataAvail
                Else
                    lblmfrmodel.Text = dr(5).ToString
                End If

                If dr(8).ToString = "" Or dr(8).ToString.StartsWith("0.00") Then
                    lblshipwght.Text = NoDataAvail
                    lblwght.Text = ""
                Else
                    lblshipwght.Text = dr(8).ToString
                    lblwght.Text = ""
                    'lblwght.Text = ReturnValue("select Unit_Name from unit_master where Unit_kid='" & Wunitid & "'")     'shipwght Unit Name
                End If

                If dr(9).ToString = "" Or dr(9).ToString.Contains("0 X 0 X 0") Or dr(9).ToString.Contains("0X0X0") Then
                    lblshipdime.Text = NoDataAvail
                    lbldid.Text = ""
                Else
                    lblshipdime.Text = dr(9).ToString
                    lbldid.Text = ""
                    'lbldid.Text = ReturnValue("select Unit_Name from unit_master where Unit_kid='" & dimId & "'")  'Dimension Unit Name
                End If

                If dr(6).ToString = "" Or dr(6).ToString.StartsWith("0.00") Then
                    lblsellqty.Text = NoDataAvail
                Else
                    lblsellqty.Text = dr(6).ToString()
                    'lblselltype.Text = ReturnValue("select Unit_Name from unit_master where Unit_kid='" & selltype & "'")    'Sell Qty Unit Name
                End If
                If dr(7).ToString = "" Or dr(7).ToString.StartsWith("0.00") Then
                    lblshipqty.Text = NoDataAvail
                Else
                    lblshipqty.Text = dr(7).ToString()
                    ' lblshiptype.Text = ReturnValue("select Unit_Name from unit_master where Unit_kid='" & Shiptype & "'")  'Ship Qty Unit Name
                End If
                If dr(11).ToString = "" Then
                    lbldespatch.Text = NoDataAvail
                Else
                    lbldespatch.Text = dr(11).ToString()
                    'lbldesu.Text = ReturnValue("select Unit_Name from unit_master where Unit_kid='" & unitid & "'") 'delivery Period Unit Name
                End If
                If dr(10).ToString = "" Or dr(10).ToString = "0" Then
                    lblpcs.Text = NoDataAvail
                Else
                    lblpcs.Text = dr(10).ToString()
                End If

                If dr.Item("Product_MarketPrice").ToString = "" Or dr.Item("Product_MarketPrice").ToString.Contains("0.00") Then
                    SpecialPrice = 0.0
                Else
                    SpecialPrice = dr.Item("Product_MarketPrice").ToString.Replace("Rs. ", "")
                End If

            End While
            con.Close()
            Dim isostr As String
            isostr = ReturnValue("SELECT     Supplier_Master.Supplier_IsISO FROM Product_Master INNER JOIN Supplier_Master ON Product_Master.Product_SupplierId = Supplier_Master.Supplier_Kid WHERE   Product_Master.Product_Kid = '" & prodcode & "'")
            If isostr = "Y" Then
                lbliso1.Visible = True
                lbliso1.ImageUrl = Page.ResolveUrl("~/Images/iso_logo.gif")
            Else
                lbliso1.Visible = False
            End If
            '------------------For Product Brand Name----------------
            'con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
            cmd = New SqlCommand("select Brand_Name from ProductDisplay where product_kid='" & prodcode & "'", con)
            If con.State = ConnectionState.Open Then
                con.Close()
            End If
            con.Open()
            dr = cmd.ExecuteReader
            While dr.Read
                'lblwght.Text = dr(0).ToString
                lblbrand.Text = dr(0).ToString
            End While
            con.Close()
            dr.Close()
            Session("ProductCode") = prodcode     'The Session("ProductCode") value is going to the ProductInformationData.aspx page to show the Product Information Data.
        Catch ex As Exception

        End Try
    End Sub
    'Private Sub Unit_Name(ByVal str As String, ByRef label As Label)
    '    Try
    '        'con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
    '        ' Dim dr2 As SqlDataReader
    '        cmd = New SqlCommand("select Unit_Name from unit_master where Unit_kid='" & str & "'", con)
    '        If con.State = ConnectionState.Open Then
    '            con.Close()
    '        End If
    '        con.Open()
    '        dr = cmd.ExecuteReader
    '        While dr.Read
    '            label.Text = dr(0).ToString
    '        End While
    '        con.Close()
    '        ' dr2.Close()
    '    Catch ex As Exception
    '    End Try
    'End Sub
    Protected Sub ShopCartProcedure(ByVal StrMode As String)
        Try
            Dim shopid As String = NewPrimaryKey(Me.Page)
            Dim shopCode As String = Generate_Code("select count(*) from ShopCart where ShopCart_Code='", "SC")
            Dim con As New SqlConnection                        'Define connection variable for connecting to SQL-Server
            con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")    'Read the ConnectionString from web.config File
            Dim cmd As New SqlCommand
            con.Open()
            Dim sqlcol As Data.SqlClient.SqlParameterCollection = cmd.Parameters
            sqlcol.Add("@ShopCart_Kid", SqlDbType.NVarChar, 10).Value = shopid.Trim
            sqlcol.Add("@ShopCart_Code", SqlDbType.NVarChar, 25).Value = shopCode.Trim
            sqlcol.Add("@ShopCart_ProductId", SqlDbType.NVarChar, 10).Value = Request.QueryString("ProductCode")
            sqlcol.Add("@ShopCart_BuyerUserId", SqlDbType.NVarChar, 25).Value = Session("BuyerId")
            sqlcol.Add("@ShopCart_Quantity", SqlDbType.Int).Value = 1
            sqlcol.Add("@ShopCart_MarketPrice", SqlDbType.Decimal, 18).Value = SpecialPrice
            sqlcol.Add("@ShopCart_FinancialYearId", SqlDbType.NVarChar, 10).Value = Session("Financial")
            sqlcol.Add("@ShopCart_CompanyId", SqlDbType.NVarChar, 10).Value = g_Company
            sqlcol.Add("@ShopCart_UserId", SqlDbType.NVarChar, 10).Value = g_User
            sqlcol.Add("@FormName", SqlDbType.NVarChar, 50).Value = Me.Page.ToString
            sqlcol.Add("@Mode", SqlDbType.VarChar, 10).Value = StrMode.Trim
            ExecQuery("ShopCart_Proc", sqlcol).StartsWith("True")
            sqlcol = Nothing
            cmd = Nothing
        Catch ex As Exception
            ex.Message.ToString()
        End Try

    End Sub
    Protected Sub lnkCompareProducts_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkCompareProducts.Click
        Response.Redirect("compare.aspx")
    End Sub
    'Protected Sub lnkBuynow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkBuynow.Click

    '    If Session("BuyId") = Nothing Then

    '        Dim shoptabel As New DataTable
    '        shoptabel.Columns.Add("ProductId")

    '        Dim shrow As DataRow = shoptabel.NewRow

    '        shrow("ProductId") = prodcode
    '        shoptabel.Rows.Add(shrow)

    '        Session("Checkstatus") = "ShopCart"
    '        Session("ShopTabel") = shoptabel
    '        'ShopCartProcedure("Insert")
    '        Response.Redirect("~/Buyer/BuyerLogin.aspx")


    '    Else
    '        Response.Redirect("~/Buyer/ShopCart.aspx")
    '    End If

    'End Sub
    Protected Sub lnkAddtoWishList_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkAddtoWishList.Click

        Dim Wishtabel As New DataTable
        Wishtabel.Columns.Add("ProductId")

        If Session("BuyId") = Nothing Then


            Session("Checkstatus") = "WishLsit"
            Dim wsrow As DataRow = Wishtabel.NewRow
            wsrow("ProductId") = prodcode
            Wishtabel.Rows.Add(wsrow)
            Session("WishTabel") = Wishtabel
            Response.Redirect("~/Buyer/BuyerLogin.aspx")

        Else


            Response.Redirect("~/Buyer/WishList.aspx")

        End If

    End Sub
    Public Sub TechnicalSpecification()
        getApplication()
        getUserManual()
        ' System.Threading.Thread.Sleep(5000)
        getFeature()
        ' System.Threading.Thread.Sleep(5000)
        getTechSpeci()
        getIncAcc()
        GetSpecialNotes()
        getMSDS()
        getConsumables()
        getCatalog()
        getStandardApproval()
        getInstallationManual()
        getGarantyWaranty()
        getPackaging()
        getInstCommission()
        getAccOptional()
        getSpareParts()
        getWearAndTear()
    End Sub
    Public Sub getWearAndTear()
        Dim wtdt As DataTable
        wtdt = ReturnDataTable("SELECT     OtherDetail_SpareParts.ODTSP_kid, ProductDisplay.ProdName, ProductDisplay.CatName, ProductDisplay.Product_Name,         ProductDisplay.Product_ModelNo, ProductDisplay.Product_AtcoPrice, ProductDisplay.Brand_Name , ProductDisplay.Product_KId, ProductDisplay.Product_Image, ProductDisplay.Product_Code FROM         OtherDetail_SpareParts INNER JOIN                       ProductDisplay ON OtherDetail_SpareParts.ODTSP_SparePartId = ProductDisplay.Product_Kid WHERE     (OtherDetail_SpareParts.ODTSP_ProductId = '" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_SpareParts.ODTSP_IsDeleted = N'0') and ProductDisplay.Product_IsWear_Tear='y'")
        'optdt = ReturnDataTable("SELECT     OtherDetail_OptionalAccessories.ODTOA_kid, Product_Master.Product_Name, Product_Master.Product_Image,Product_Master.Product_AtcoPrice, Product_Master.Product_Code, Product_Master.Product_ModelNo FROM         OtherDetail_OptionalAccessories INNER JOIN                       Product_Master ON OtherDetail_OptionalAccessories.ODTOA_OAccessId = Product_Master.Product_Kid WHERE     (OtherDetail_OptionalAccessories.ODTOA_ProductId = N'" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_OptionalAccessories.ODTOA_IsDeleted = N'0') AND                        (Product_Master.Product_IsDeleted = N'0')")
        gvWearAndTear.DataSource = wtdt
        gvWearAndTear.DataBind()

    End Sub
    Public Sub getSpareParts()
        Dim spdt As DataTable
        spdt = ReturnDataTable("SELECT     OtherDetail_SpareParts.ODTSP_kid, ProductDisplay.ProdName, ProductDisplay.CatName, ProductDisplay.Product_Name,         ProductDisplay.Product_ModelNo, ProductDisplay.Product_AtcoPrice, ProductDisplay.Brand_Name , ProductDisplay.Product_KId, ProductDisplay.Product_Image, ProductDisplay.Product_Code FROM         OtherDetail_SpareParts INNER JOIN                       ProductDisplay ON OtherDetail_SpareParts.ODTSP_SparePartId = ProductDisplay.Product_Kid WHERE     (OtherDetail_SpareParts.ODTSP_ProductId = '" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_SpareParts.ODTSP_IsDeleted = N'0')")
        'optdt = ReturnDataTable("SELECT     OtherDetail_OptionalAccessories.ODTOA_kid, Product_Master.Product_Name, Product_Master.Product_Image,Product_Master.Product_AtcoPrice, Product_Master.Product_Code, Product_Master.Product_ModelNo FROM         OtherDetail_OptionalAccessories INNER JOIN                       Product_Master ON OtherDetail_OptionalAccessories.ODTOA_OAccessId = Product_Master.Product_Kid WHERE     (OtherDetail_OptionalAccessories.ODTOA_ProductId = N'" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_OptionalAccessories.ODTOA_IsDeleted = N'0') AND                        (Product_Master.Product_IsDeleted = N'0')")
        gvSpareParts.DataSource = spdt
        gvSpareParts.DataBind()
    End Sub
    Public Sub getIncAcc()
        Dim incdt As DataTable
        incdt = ReturnDataTable("SELECT     OtherDetail_IncludedAccessories.ODTIA_kid, ProductDisplay.ProdName, ProductDisplay.CatName, ProductDisplay.Product_Name,         ProductDisplay.Product_ModelNo, ProductDisplay.Product_AtcoPrice, ProductDisplay.Brand_Name , ProductDisplay.Product_KId, ProductDisplay.Product_Image, ProductDisplay.Product_Code FROM         OtherDetail_IncludedAccessories INNER JOIN                       ProductDisplay ON OtherDetail_IncludedAccessories.ODTIA_InAccessId = ProductDisplay.Product_Kid WHERE     (OtherDetail_IncludedAccessories.ODTIA_ProductId = '" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_IncludedAccessories.ODTIA_IsDeleted = N'0')")
        'optdt = ReturnDataTable("SELECT     OtherDetail_OptionalAccessories.ODTOA_kid, Product_Master.Product_Name, Product_Master.Product_Image,Product_Master.Product_AtcoPrice, Product_Master.Product_Code, Product_Master.Product_ModelNo FROM         OtherDetail_OptionalAccessories INNER JOIN                       Product_Master ON OtherDetail_OptionalAccessories.ODTOA_OAccessId = Product_Master.Product_Kid WHERE     (OtherDetail_OptionalAccessories.ODTOA_ProductId = N'" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_OptionalAccessories.ODTOA_IsDeleted = N'0') AND                        (Product_Master.Product_IsDeleted = N'0')")
        gvIncAcc.DataSource = incdt
        gvIncAcc.DataBind()
    End Sub
    Public Sub getAccOptional()
        Dim optdt As DataTable
        optdt = ReturnDataTable("SELECT     OtherDetail_OptionalAccessories.ODTOA_kid, ProductDisplay.ProdName, ProductDisplay.CatName, ProductDisplay.Product_Name,         ProductDisplay.Product_ModelNo, ProductDisplay.Product_AtcoPrice, ProductDisplay.Brand_Name , ProductDisplay.Product_KId, ProductDisplay.Product_Image, ProductDisplay.Product_Code FROM         OtherDetail_OptionalAccessories INNER JOIN                       ProductDisplay ON OtherDetail_OptionalAccessories.ODTOA_OAccessId = ProductDisplay.Product_Kid WHERE     (OtherDetail_OptionalAccessories.ODTOA_ProductId = '" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_OptionalAccessories.ODTOA_IsDeleted = N'0')")
        'optdt = ReturnDataTable("SELECT     OtherDetail_OptionalAccessories.ODTOA_kid, Product_Master.Product_Name, Product_Master.Product_Image,Product_Master.Product_AtcoPrice, Product_Master.Product_Code, Product_Master.Product_ModelNo FROM         OtherDetail_OptionalAccessories INNER JOIN                       Product_Master ON OtherDetail_OptionalAccessories.ODTOA_OAccessId = Product_Master.Product_Kid WHERE     (OtherDetail_OptionalAccessories.ODTOA_ProductId = N'" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (OtherDetail_OptionalAccessories.ODTOA_IsDeleted = N'0') AND                        (Product_Master.Product_IsDeleted = N'0')")
        gvAccOpt.DataSource = optdt
        gvAccOpt.DataBind()
        'optdt.Clear()
        'optdt.Dispose()
    End Sub
    Public Sub getUserManual()
        Dim UserManual As String
        UserManual = ReturnValue("Select InstCommManual_UploadedManualFileName from InstallationManual where InstCommManual_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and InstCommManual_IsDeleted='0'")
        If UserManual <> "" Then
            'tblMSDS.Visible = True
            TdUserManual1.InnerText = "View User Manual:"
            TdUserManual2.InnerHtml = "<ul>"

            TdUserManual2.InnerHtml += "<a href='" & Page.ResolveUrl("~/Upload Image/Product Image/UploadImages/" & UserManual.ToString.Trim) & "' target='_blank'><img alt='' style='border:none;' src='" & Page.ResolveUrl("~/Images/pdf.jpg") & "' title='" & UserManual.ToString & "'/>  </a>"
            '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
            '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
            '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
            TdUserManual2.InnerHtml += "</ul>"

            'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
        Else
            'tblMSDS.Visible = True
            TdUserManual1.InnerText = "View User Manual:"
            TdUserManual2.InnerHtml += "<ul>"
            TdUserManual2.InnerHtml += "<li> This Product does not have any User Manual File.</li>"
            TdUserManual2.InnerHtml += "</ul>"
        End If
    End Sub
    Public Sub getApplication()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("Select ProdApp_Application from ProductApplication where ProdApp_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and ProdApp_Isdeleted='0'")
            If dt.Rows.Count > 0 Then
                tblApplication.Visible = True
                tdApplication1.InnerText = "Product Applications:"
                tdApplication2.InnerHtml = "<ul>"
                Dim i As Integer
                For i = 0 To dt.Rows.Count - 1
                    tdApplication2.InnerHtml += "<li>" & dt.Rows(i).Item("ProdApp_Application").ToString() & "</li>"
                    '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
                    '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
                    '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
                Next
                tdApplication2.InnerHtml += "</ul>"

                'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
            Else
                tblApplication.Visible = True
                tdApplication1.InnerText = "Product Applications:"
                tdApplication2.InnerHtml = "<ul>"
                tdApplication2.InnerHtml += "<li> Application of This Product does not have any data.</li>"
                tdApplication2.InnerHtml += "</ul>"
            End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getFeature()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("Select ProdFeatures_Features from ProductFeatures where ProdFeatures_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and ProdFeatures_Isdeleted='0'")
            If dt.Rows.Count > 0 Then
                tblFeature.Visible = True
                tdFeature1.InnerText = "Product Features:"
                tdFeature2.InnerHtml = "<ul>"
                Dim i As Integer
                For i = 0 To dt.Rows.Count - 1
                    tdFeature2.InnerHtml += "<li>" & dt.Rows(i).Item("ProdFeatures_Features").ToString() & "</li>"
                    '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
                    '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
                    '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
                Next
                tdFeature2.InnerHtml += "</ul>"

                'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
            Else
                tblFeature.Visible = True
                tdFeature1.InnerText = "Product Features:"
                tdFeature2.InnerHtml = "<ul>"
                tdFeature2.InnerHtml += "<li> Features of This Product does not have any data.</li>"
                tdFeature2.InnerHtml += "</ul>"
            End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getTechSpeci()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("SELECT     ProductTechnicalSpecification_Master.TechSpec_Parameter, ProductTechnicalSpecification.TechSpec_value FROM ProductTechnicalSpecification INNER JOIN  ProductTechnicalSpecification_Master ON ProductTechnicalSpecification.TechSpec_ParameterId = ProductTechnicalSpecification_Master.TechSpec_KID WHERE  (ProductTechnicalSpecification.TechSpec_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' ) AND (ProductTechnicalSpecification.TechSpec_IsDeleted = N'0') AND (ProductTechnicalSpecification_Master.TechSpec_IsDeleted = N'0')")
            'dt = ReturnDataTable("Select TechSpec_Parameter, TechSpec_Value from ProductTechnicalSpecification where TechSpec_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and TechSpec_IsDeleted='0'")
            If dt.Rows.Count > 0 Then
                tblTechSpeci.Visible = True
                tdTechSpeci1.InnerText = "Technical Specification :"
                gvtechspec.DataSource = dt
                gvtechspec.DataBind()
                'tdTechSpeci2.InnerHtml = "<ul>"
                'Dim i As Integer
                'For i = 0 To dt.Rows.Count - 1
                '    tdTechSpeci2.InnerHtml += "<li>" & dt.Rows(i).Item("TechSpec_Parameter").ToString() & "&nbsp;&nbsp;-&nbsp;&nbsp;" & dt.Rows(i).Item("TechSpec_Value") & "  </li>"
                '    '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
                '    '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
                '    '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
                'Next
                'tdTechSpeci2.InnerHtml += "</ul>"

                'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
            Else
                tblTechSpeci.Visible = True
                tdTechSpeci1.InnerText = "Technical Specification :"
                tdTechSpeci2.InnerHtml = "<ul>"
                tdTechSpeci2.InnerHtml += "<li> Technical Specification of This Product does not have any data.</li>"
                tdTechSpeci2.InnerHtml += "</ul>"
            End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub GetSpecialNotes()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("Select ProdSpecInstr_Instruction from ProductSpecialNotesInstruction where ProdSpecInstr_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and ProdSpecInstr_IsDeleted='0'")
            If dt.Rows.Count > 0 Then
                tblSpecialNotes.Visible = True
                tdSpecialNotes1.InnerText = "Special Notes :"
                tdSpecialNotes2.InnerHtml = "<ul>"
                Dim i As Integer
                For i = 0 To dt.Rows.Count - 1
                    tdSpecialNotes2.InnerHtml += "<li>" & dt.Rows(i).Item("ProdSpecInstr_Instruction").ToString() & "</li>"
                    '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
                    '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
                    '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
                Next
                tdSpecialNotes2.InnerHtml += "</ul>"

                'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
            Else
                tblSpecialNotes.Visible = True
                tdSpecialNotes1.InnerText = "Special Notes :"
                tdSpecialNotes2.InnerHtml = "<ul>"
                tdSpecialNotes2.InnerHtml += "<li> This Product does not have any Special Notes and Instuction.</li>"
                tdSpecialNotes2.InnerHtml += "</ul>"
            End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getMSDS()
        Dim MSDS As String
        MSDS = ReturnValue("Select MSDS_UploadedDataSheetName from MaterialSafetyDataSheet where MSDS_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and MSDS_IsDeleted='0'")
        If MSDS <> "" Then
            tblMSDS.Visible = True
            tdMSDS1.InnerText = "Material Safty DataSheet :"
            tdMSDS2.InnerHtml = "<ul>"

            tdMSDS2.InnerHtml += " <a href='" & Page.ResolveUrl("~/Upload Image/Product Image/UploadImages/" & MSDS) & "' target='_blank'> <img alt='' style='border:none;' src='" & Page.ResolveUrl("~/Images/pdf.jpg") & "' title='" & MSDS.ToString & "'/>  </a>"
            '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
            '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
            '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
            tdMSDS2.InnerHtml += "</ul>"

            'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
        Else
            tblMSDS.Visible = True
            tdMSDS1.InnerText = "Material Safty DataSheet :"
            tdMSDS2.InnerHtml += "<ul>"
            tdMSDS2.InnerHtml += "<li> This Product does not have any Material Safty DataSheet.</li>"
            tdMSDS2.InnerHtml += "</ul>"
        End If

    End Sub
    Public Sub getConsumables()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("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_productid = N'" & RemoveLiterals(Session("ProductCode")) & "') and Consumables.c_isdeleted='0'")
            If dt.Rows.Count > 0 Then
                tblConsumables.Visible = True
                tdConsumables1.InnerText = "Consumables List(Name  -  Value) :"
                tdConsumables2.InnerHtml = "<ul>"
                Dim i As Integer
                For i = 0 To dt.Rows.Count - 1
                    tdConsumables2.InnerHtml += "<li>" & dt.Rows(i).Item("c_cname").ToString() & "&nbsp;&nbsp;-&nbsp;&nbsp;" & dt.Rows(i).Item("c_cquantity").ToString() & "&nbsp;" & dt.Rows(i).Item("Unit_Name").ToString() & "  </li>"
                    '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
                    '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
                    '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
                Next
                tdConsumables2.InnerHtml += "</ul>"

                'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
            Else
                tblConsumables.Visible = True
                tdConsumables1.InnerText = "Consumables List :"
                tdConsumables2.InnerHtml += "<ul>"
                tdConsumables2.InnerHtml += "<li> This Product does not have any Consumables Information.</li>"
                tdConsumables2.InnerHtml += "</ul>"
            End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getCatalog()
        Dim Catalog As String
        Catalog = ReturnValue("Select Catalog_Upload from Catalog where Catalog_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "'and Catalog_IsDeleted='0'")
        If Catalog <> "" Then
            tblCatalog.Visible = True
            tdCatalog1.InnerText = "View User Catalog: "
            tdCatalog2.InnerHtml = "<ul>"

            tdCatalog2.InnerHtml += " <a href='" & Page.ResolveUrl("~/Upload Image/Product Image/UploadImages/" & Catalog) & "' target='_blank'>  <img alt='' src='" & Page.ResolveUrl("~/images/pdf.jpg") & "' style='border:none;' title'" & Catalog & "'/></a>   "
            '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
            '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
            '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
            tdCatalog2.InnerHtml += "</ul>"

            'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
        Else
            tblCatalog.Visible = True
            tdCatalog1.InnerText = "View User Catalog: "
            tdCatalog2.InnerHtml += "<ul>"
            tdCatalog2.InnerHtml += "<li> Catalog for This Product does not Available.</li>"
            tdCatalog2.InnerHtml += "</ul>"
        End If
    End Sub
    Public Sub getStandardApproval()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("SELECT     ProductStandardsMaster.PSM_Name, ProductStandardsMaster.PSM_Logo, ProductStandardsMaster.PSM_Desc,             ProductStandardApproval.ProdStdApproval_FileName FROM         ProductStandardApproval INNER JOIN                       ProductStandardsMaster ON ProductStandardApproval.ProdStdApproval_StandardId = ProductStandardsMaster.PSM_Kid WHERE     (ProductStandardApproval.ProdStdApproval_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' ) AND (ProductStandardsMaster.PSM_IsDeleted = N'0') AND                        (ProductStandardApproval.ProdStdApproval_IsDeleted = N'0')")
            'dt = ReturnDataTable("Select ProdStdApproval_StandardName, ProdStdApproval_AgencyApproved, ProdStdApproval_FileName from ProductStandardApproval where ProdStdApproval_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and ProdStdApproval_IsDeleted='0'")
            If dt.Rows.Count > 0 Then
                tblStandardApproval.Visible = True
                tdStandardApproval1.InnerText = "Product Certificate:"
                tdStandardApproval2.InnerHtml = "<ul>"
                tdStandardApproval2.InnerHtml += "<li> <a href='" & Page.ResolveUrl("~/Upload Image/Product Image/UploadImages/" & dt.Rows(0).Item("ProdStdApproval_FileName").ToString()) & "' target='_blank'> <img style='border:none;'  src='" & Page.ResolveUrl("~/Upload Image/Product Standard Logo/" & dt.Rows(0).Item("PSM_Logo").ToString()) & "' alt='' title='" & dt.Rows(0).Item("PSM_Desc").ToString() & "' /> </a>"
                'tdStandardApproval2.InnerHtml += "<li> Standart Certificate Name :- <span style='font-weight:bold;font-size:larger'> " & dt.Rows(0).Item("PSM_Name").ToString() & " </span>   </li>"
                'tdStandardApproval2.InnerHtml += "<li> Standart Certificate Logo :-  " & dt.Rows(0).Item("PSM_Logo").ToString() & "  </li>"
                'tdStandardApproval2.InnerHtml += "<li> Standart Certificate Discription :- " & dt.Rows(0).Item("PSM_Desc").ToString() & " </b> </li>"
                ''tdStandardApproval2.InnerHtml += "<li> Standart Certificate File :- " & dt.Rows(0).Item("ProdStdApproval_FileName").ToString() & " </li>"

                'If dt.Rows(0).Item("ProdStdApproval_FileName").ToString() <> "" Then
                '    tdStandardApproval2.InnerHtml += "<li> Standart Certificate File :-  <a href='" & Page.ResolveUrl("~/Upload Image/Product Image/UploadImages/" & dt.Rows(0).Item("ProdStdApproval_FileName").ToString()) & "' target='_blank'>" & dt.Rows(0).Item("ProdStdApproval_FileName").ToString() & "</a>   </li>"
                'End If
                'tdStandardApproval2.InnerHtml += "</ul>"

                'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
            Else
                tblStandardApproval.Visible = True
                tdStandardApproval1.InnerText = "Product Standard Approval:"
                tdStandardApproval2.InnerHtml += "<ul>"
                tdStandardApproval2.InnerHtml += "<li> This Product does not have any Product Standard Approval.</li>"
                tdStandardApproval2.InnerHtml += "</ul>"
            End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getInstallationManual()
        Dim InstManual As String
        InstManual = ReturnValue("Select InstCommManual_UploadedManualFileName from InstallationManual where InstCommManual_ProductId ='" & RemoveLiterals(Session("ProductCode")) & "' and InstCommManual_IsDeleted='0'")
        If InstManual <> "" Then
            tblInstallationManual.Visible = True
            tdInstallationManual1.InnerText = "View User Manual:"
            tdInstallationManual2.InnerHtml = "<ul>"

            tdInstallationManual2.InnerHtml += "<li> <a href='" & Page.ResolveUrl("~/Upload Image/Product Image/UploadImages/" & InstManual) & "' target='_blank'>" & InstManual & "</a>   </li>"
            '    tblApplication.Rows.Add(New HtmlControls.HtmlTableRow)
            '    tblApplication.Rows(i + 1).Cells.Add(New HtmlControls.HtmlTableCell)
            '    tblApplication.Rows(i + 1).Cells(0).InnerHtml = "<ul><li>" & dt.Rows(i).Item("ProdApp_Application") & "</li>"
            tdInstallationManual2.InnerHtml += "</ul>"

            'tblApplication.Rows(i + 1).Cells(0).InnerHtml += "</ul>"
        Else
            tblInstallationManual.Visible = True
            tdInstallationManual1.InnerText = "View User Manual:"
            tdInstallationManual2.InnerHtml += "<ul>"
            tdInstallationManual2.InnerHtml += "<li> This Product does not have any User Manual.</li>"
            tdInstallationManual2.InnerHtml += "</ul>"
        End If
    End Sub
    Public Sub getGarantyWaranty()
        Try
            Dim dt As DataTable
            Dim i As Integer
            dt = ReturnDataTable("SELECT     Product_GuarantyWarrantydetails.*  FROM Product_GuarantyWarrantydetails WHERE  gwd_ProductId = '" & RemoveLiterals(Session("ProductCode").ToString) & "' AND gwd_IsDeleted = '0'")


            If dt.Rows.Count > 0 Then
                TdGarantyWaranty2.InnerHtml = "<br/>"
                If (dt.Rows(0).Item("gwd_Type").ToString = "Guaranty") Then
                    TdGarantyWaranty2.InnerHtml += "<span style='font-weight:bold;font-size:10pt;color:maroon;'>Guaranty</span>"
                    TdGarantyWaranty2.InnerHtml += "<ul>"
                    TdGarantyWaranty2.InnerHtml += "<li>Guaranty Period :&nbsp; <span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_pguarentee1").ToString & "  " & ReturnValue("Select Unit_Name from Unit_Master where Unit_Kid='" & dt.Rows(0).Item("gwd_pguarentee2").ToString & "'") & "</span>"
                    TdGarantyWaranty2.InnerHtml += "<li>Guaranty Description :&nbsp; <span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_Gdesc").ToString & " </span>"
                    TdGarantyWaranty2.InnerHtml += "</ul>"
                    'rblGW.SelectedValue = "Guaranty"
                    'trGuaranty.Style.Add("display", "auto")
                    'txtGPeriod.Text = dt.Rows(0).Item("gwd_pguarentee1").ToString
                    'ddlGPeriodType.Items.FindByValue(RemoveLiterals(dt.Rows(0).Item("gwd_pguarentee2").ToString)).Selected = True
                    'txtGDescription.Text = dt.Rows(0).Item("gwd_Gdesc").ToString
                Else
                    TdGarantyWaranty2.InnerHtml += "<span style='font-weight:bold;font-size:10pt;color:maroon;'>Warranty</span>"
                    TdGarantyWaranty2.InnerHtml += "<ul>"
                    'rblGW.SelectedValue = "Warranty"
                    'TrWarranty.Style.Add("display", "auto")
                    If dt.Rows(0).Item("gwd_wtype").ToString = "On Site" Then
                        TdGarantyWaranty2.InnerHtml += "<li>&nbsp; <span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_wtype").ToString & " </span>&nbsp; Warranty"
                    Else
                        TdGarantyWaranty2.InnerHtml += "<li>Warranty Type :&nbsp; <span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_wtype").ToString & "  " & dt.Rows(0).Item("gwd_CarryIn").ToString & "</span>"
                        '  TdGarantyWaranty2.InnerHtml += "<li>Carry In :&nbsp; <span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_CarryIn").ToString & " </span>"
                    End If
                    If (dt.Rows(0).Item("gwd_wfor").ToString = "Complete Unit") Then
                        TdGarantyWaranty2.InnerHtml += "<li>Warranty For <span style='font-weight:bold;'>Complete Unit</span>"
                        TdGarantyWaranty2.InnerHtml += "<li>Warranty Period : &nbsp;<span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_pwarranty1").ToString & "  " & ReturnValue("Select Unit_Name from Unit_Master where Unit_Kid='" & dt.Rows(0).Item("gwd_pwarranty2").ToString & "'") & "</span>"
                        TdGarantyWaranty2.InnerHtml += "<li>Warranty Description : &nbsp;<span style='font-weight:bold;'>" & dt.Rows(0).Item("gwd_Wdesc").ToString & " </span>"
                        TdGarantyWaranty2.InnerHtml += "</ul>"
                    Else
                        TdGarantyWaranty2.InnerHtml += "<li>Warranty For Below <span style='font-weight:bold;'>Specific Parts</span>"
                        TdGarantyWaranty2.InnerHtml += "</ul>"
                        Dim dt1 As DataTable
                        dt1 = ReturnDataTable("SELECT     Product_GuarantyWarrantydetails.gwd_Wdesc AS Description,                       Product_GuarantyWarrantydetails.gwd_pwarranty1 + '  ' + Unit_Master.Unit_Name AS Period, Product_Master.Product_Name AS Name FROM         Product_GuarantyWarrantydetails LEFT OUTER JOIN                       Unit_Master ON Product_GuarantyWarrantydetails.gwd_pwarranty2 = Unit_Master.Unit_Kid INNER JOIN                       Product_Master ON Product_GuarantyWarrantydetails.gwd_PartNo = Product_Master.Product_Kid WHERE     (Product_GuarantyWarrantydetails.gwd_ProductId = '" & RemoveLiterals(Session("ProductCode").ToString) & "') AND (Product_GuarantyWarrantydetails.gwd_IsDeleted = N'0') AND                        (Unit_Master.Unit_Flag = N'Days')")
                        gvGW.DataSource = dt1
                        gvGW.DataBind()

                    End If

                End If

            Else
                TdGarantyWaranty2.InnerHtml = "This product does not have any Guarranty / Warranty Information.!"
            End If


            Dim str As String
            str = ""

            'gvWarranty.DataSource = dt
            'gvWarranty.DataBind()
            'Dim i As Integer
            'If dt.Rows.Count > 0 Then
            '    tblGarantyWaranty.Visible = True
            '    TdGarantyWaranty1.InnerText = "Product Guaranty Warranty Details :-"
            '    gvWarranty.Visible = True
            '    gvWarranty.Columns(0).Visible = True
            '    'gvWarranty.DataSource = dt
            '    'gvWarranty.DataBind()
            '    gvWarranty.Columns(0).Visible = False
            '    For i = 0 To dt.Rows.Count - 1
            '        Dim lbl1 As Label = CType(gvWarranty.Rows(i).Cells(1).FindControl("lblGuaranteee"), Label)
            '        lbl1.Text = dt.Rows(i).Item("gwd_pguarentee1").ToString
            '        lbl1.Text &= " " & ReturnValue("SELECT Unit_Name FROM Unit_Master WHERE Unit_Kid='" & dt.Rows(i).Item("gwd_pguarentee2").ToString & "' and  Unit_IsDeleted = N'0'")

            '        Dim lbl2 As Label = CType(gvWarranty.Rows(i).Cells(1).FindControl("lblWarranty"), Label)
            '        lbl2.Text = dt.Rows(i).Item("gwd_pwarranty1").ToString
            '        lbl2.Text &= " " & ReturnValue("SELECT Unit_Name FROM Unit_Master WHERE Unit_Kid='" & dt.Rows(i).Item("gwd_pwarranty2").ToString & "' and  Unit_IsDeleted = N'0'")

            '        Dim lbl3 As Label = CType(gvWarranty.Rows(i).Cells(1).FindControl("lblWarrantyType"), Label)
            '        If dt.Rows(i).Item("gwd_wtype").ToString = "On Site" Then
            '            lbl3.Text = "On Site"
            '        Else
            '            lbl3.Text = "Carry In"
            '        End If

            '        Dim lbl4 As Label = CType(gvWarranty.Rows(i).Cells(1).FindControl("lblCarryIn"), Label)
            '        lbl4.Text = dt.Rows(i).Item("gwd_CarryIn").ToString

            '        Dim lbl5 As Label = CType(gvWarranty.Rows(i).Cells(1).FindControl("lblWarrantyFor"), Label)
            '        If dt.Rows(i).Item("gwd_wfor").ToString = "Complete Unit" Then
            '            lbl5.Text = "Complete Unit"
            '        Else
            '            lbl5.Text = "Specific Parts"
            '        End If


            '        Dim lbl6 As Label = CType(gvWarranty.Rows(i).Cells(1).FindControl("lblListOfParts"), Label)
            '        lbl6.Text = dt.Rows(i).Item("gwd_PartNo").ToString & "-" & dt.Rows(i).Item("gwd_PartName").ToString

            '    Next
            'Else
            '    TdGarantyWaranty1.InnerHtml = "Product Guaranty Warranty Details :-"
            '    gvWarranty.Visible = True
            '    tblGarantyWaranty.Visible = True
            '    'TdGarantyWaranty1.InnerHtml += "<ul>"
            '    'TdGarantyWaranty1.InnerHtml += "<li> This Product does not have any Guaranty/Warranty Details.</li>"
            '    'TdGarantyWaranty1.InnerHtml += "</ul>"
            'End If
            'dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getPackaging()
        Try
            Dim dt As DataTable
            dt = ReturnDataTable("Select ProdPackaging_PackingType, ProdPackaging_Material, ProdPackaging_ProdDetails, ProdPackaging_IsFragile, ProdPackaging_IsWoodContain, ProdPackaging_IsEnvirnomentalFriendly from ProductPackaging where ProdPackaging_ProductId='" & RemoveLiterals(Session("ProductCode")) & "' and ProdPackaging_IsDeleted='0'")
            gvPackaging.DataSource = dt
            gvPackaging.DataBind()
            If dt.Rows.Count > 0 Then
                tblPackaging.Visible = True
                tdPackaging1.InnerText = "Product Packaging Details:"
                gvPackaging.Visible = True
                'By Pankaj Mishra

                'gvPackaging.DataSource = dt
                'gvPackaging.DataBind()

                Dim i As Integer
                For i = 0 To gvPackaging.Rows.Count - 1
                    If (gvPackaging.Rows(i).Cells(2).Text = "Y") Then
                        gvPackaging.Rows(i).Cells(2).Text = "YES"
                    ElseIf gvPackaging.Rows(i).Cells(2).Text = "N" Then
                        gvPackaging.Rows(i).Cells(2).Text = "NO"
                    End If

                    If (gvPackaging.Rows(i).Cells(3).Text = "Y") Then
                        gvPackaging.Rows(i).Cells(3).Text = "YES"
                    ElseIf gvPackaging.Rows(i).Cells(3).Text = "N" Then
                        gvPackaging.Rows(i).Cells(3).Text = "NO"
                    End If

                    If (gvPackaging.Rows(i).Cells(4).Text = "Y") Then
                        gvPackaging.Rows(i).Cells(4).Text = "YES"
                    ElseIf gvPackaging.Rows(i).Cells(4).Text = "N" Then
                        gvPackaging.Rows(i).Cells(4).Text = "NO"
                    End If

                Next

            Else
                tblPackaging.Visible = True
                tdPackaging1.InnerText = "Product Packaging Details:"
                gvPackaging.Visible = True
                'tdPackaging1.InnerHtml += "<ul>"
                'tdPackaging1.InnerHtml += "<li> This Product does not have any Packaging Details.</li>"
                'tdPackaging1.InnerHtml += "</ul>"
            End If

            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub getInstCommission()
        Try


            Dim dt As DataTable
            dt = ReturnDataTable("Select InstallationComm_IsRequired, InstallationComm_IsChargeable, InstallationComm_Amount, InstallationComm_IsMaintenanceTraining, InstallationComm_IsAMCAvailable from ProductInstallationCommissioning where InstallationComm_ProductId='" & RemoveLiterals(Session("ProductCode")) & "' and InstallationComm_IsDeleted='0'")

            If dt.Rows.Count > 0 Then
                If dt.Rows(0).Item("InstallationComm_IsRequired").ToString = "N" Then
                    TdInstComm2.InnerHtml = "<ul>"
                    TdInstComm2.InnerHtml += "<li>Required ? &nbsp; <span style='font-weight:bold'> NO </span></li>"
                ElseIf dt.Rows(0).Item("InstallationComm_IsRequired").ToString = "Y" Then
                    TdInstComm2.InnerHtml = "<ul>"
                    TdInstComm2.InnerHtml += "<li>Required ? &nbsp; <span style='font-weight:bold'> YES </span></li>"
                    If dt.Rows(0).Item("InstallationComm_IsChargeable").ToString = "Y" Then
                        TdInstComm2.InnerHtml += "<li>Chargeable ? &nbsp; <span style='font-weight:bold'> YES </span></li>"
                        If dt.Rows(0).Item("InstallationComm_Amount").ToString <> "" Then
                            TdInstComm2.InnerHtml += "<li> Amount :- <span style='font-weight:bold'> Rs.  " & dt.Rows(0).Item("InstallationComm_Amount").ToString & " </span></li>"
                        End If
                    ElseIf dt.Rows(0).Item("InstallationComm_IsChargeable").ToString = "N" Then
                        TdInstComm2.InnerHtml += "<li>Chargeable ? &nbsp; <span style='font-weight:bold'> NO </span></li>"
                    End If

                    If dt.Rows(0).Item("InstallationComm_IsMaintenanceTraining").ToString = "Y" Then
                        TdInstComm2.InnerHtml += "<li> Maintenance Training Required ? &nbsp; <span style='font-weight:bold'> YES </span></li>"
                    ElseIf dt.Rows(0).Item("InstallationComm_IsMaintenanceTraining").ToString = "N" Then
                        TdInstComm2.InnerHtml += "<li> Maintenance Training Required ? &nbsp; <span style='font-weight:bold'> NO </span></li>"
                    End If

                    If dt.Rows(0).Item("InstallationComm_IsAMCAvailable").ToString = "Y" Then
                        TdInstComm2.InnerHtml += "<li> AMC Available ? &nbsp; <span style='font-weight:bold'> YES </span></li>"
                    ElseIf dt.Rows(0).Item("InstallationComm_IsAMCAvailable").ToString = "N" Then
                        TdInstComm2.InnerHtml += "<li> AMC Available ? &nbsp; <span style='font-weight:bold'> NO </span></li>"
                    End If

                End If
            Else
                TdInstComm2.InnerHtml = "Product Does not have any Installation & Commissioning Data."
            End If


            'gvInstComm.DataSource = dt
            'gvInstComm.DataBind()
            'If dt.Rows.Count > 0 Then
            '    tblInstComm.Visible = True
            '    TdInstComm1.InnerText = "Product Installation Commissioning Details :-"
            '    gvInstComm.Visible = True
            '    'By Pankaj Mishra
            '    'gvInstComm.DataSource = dt
            '    'gvInstComm.DataBind()

            '    Dim i As Integer
            '    For i = 0 To gvInstComm.Rows.Count - 1
            '        If (gvInstComm.Rows(i).Cells(0).Text = "Y") Then
            '            gvInstComm.Rows(i).Cells(0).Text = "YES"
            '        ElseIf gvInstComm.Rows(i).Cells(0).Text = "N" Then
            '            gvInstComm.Rows(i).Cells(0).Text = "NO"
            '        End If

            '        If (gvInstComm.Rows(i).Cells(1).Text = "Y") Then
            '            gvInstComm.Rows(i).Cells(1).Text = "YES"
            '        ElseIf gvInstComm.Rows(i).Cells(1).Text = "N" Then
            '            gvInstComm.Rows(i).Cells(1).Text = "NO"
            '        End If

            '        If (gvInstComm.Rows(i).Cells(3).Text = "Y") Then
            '            gvInstComm.Rows(i).Cells(3).Text = "YES"
            '        ElseIf gvInstComm.Rows(i).Cells(3).Text = "N" Then
            '            gvInstComm.Rows(i).Cells(3).Text = "NO"
            '        End If

            '        If (gvInstComm.Rows(i).Cells(4).Text = "Y") Then
            '            gvInstComm.Rows(i).Cells(4).Text = "YES"
            '        ElseIf gvInstComm.Rows(i).Cells(4).Text = "N" Then
            '            gvInstComm.Rows(i).Cells(4).Text = "NO"
            '        End If

            '    Next

            'Else
            '    tblInstComm.Visible = True
            '    TdInstComm1.InnerText = "Product Installation Commissioning Details :-"
            '    gvInstComm.Visible = True
            '    'TdInstComm1.InnerHtml += "<ul>"
            '    'TdInstComm1.InnerHtml += "<li> This Product does not have any Installation Commissioning Details.</li>"
            '    'TdInstComm1.InnerHtml += "</ul>"

            'End If
            dt.Clear()
        Catch ex As Exception

        End Try
    End Sub
    Protected Sub ImgApplication_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        tblApplication.Style.Add("display", "inline")
        ImgApplication.Focus()
    End Sub


   
  
End Class
