Imports Kosmochem Imports System.Data Imports System.Collections.ObjectModel Partial Class Index Inherits System.Web.UI.Page Private Sub Index_Init(sender As Object, e As EventArgs) Handles Me.Init Page.Title = "Kosmochem: Home Health Care Products & Equipment for Elderly Online" Page.MetaDescription = "Kosmochem provides a wide range of quality Home Health Care Products, Mobility Aids & Equipment for Elderly/Old Citizen/Seniors Online @ Lowest Price in India, which is designed for convenience of users and care-givers and to support Independent Living. Shop Now * Fast Shipping * COD * Easy Returns!" Page.MetaKeywords = "home care products for elderly, elderly care products, home health care products for elderly, equipment for elderly care at home " 'Page.Title = "Kosmochem Home Healthcare: Elderly Aid Products & Equipment Online India" 'Page.MetaDescription = "Kosmochem Home Healthcare provides a wide range of quality Home Healthcare Products, Mobility Aids & Equipment Online @ Lowest Price in India for Elderly/Old Citizen/Seniors, which is designed for convenience of users and care-givers and to support Independent Living. Shop Now * Fast Shipping * COD * Easy Returns!" 'Page.MetaKeywords = "home care products for elderly, elderly care products, home health care products for elderly, equipment for elderly care at home " End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then 'SentInvoiceEmail(7479, "SHIPPED") 'SendEmailForNotShippedOrder() 'SendEmailForNotDeliverOrder() 'ReviewYourPurchase() Dim qry As String = "SELECT * FROM HomePageImage" Dim ds As DataSet = gc.GetDataToListBinder(qry) lblImgDesc1.InnerHtml = ds.Tables(0).Rows(0)("Description") lblImgDesc2.InnerHtml = ds.Tables(0).Rows(1)("Description") lblImgDesc3.InnerHtml = ds.Tables(0).Rows(2)("Description") lblImgDesc4.InnerHtml = ds.Tables(0).Rows(3)("Description") lblImgDesc5.InnerHtml = ds.Tables(0).Rows(4)("Description") lblImgLink1.Attributes.Add("data-link", ds.Tables(0).Rows(0)("URL")) lblImgLink2.Attributes.Add("data-link", ds.Tables(0).Rows(1)("URL")) lblImgLink3.Attributes.Add("data-link", ds.Tables(0).Rows(2)("URL")) lblImgLink4.Attributes.Add("data-link", ds.Tables(0).Rows(3)("URL")) lblImgLink5.Attributes.Add("data-link", ds.Tables(0).Rows(4)("URL")) rptFeaturedProduct.DataSource = ProductSQL.GetFeaturedProduct rptFeaturedProduct.DataBind() rptNewProduct.DataSource = ProductSQL.GetNewArrivalProduct rptNewProduct.DataBind() 'rptCategory.DataSource = CategorySQL.GetHomePageCategory 'rptCategory.DataBind() Dim s As List(Of Brand) = BrandSQL.GetBrand(True) Dim lst As ObservableCollection(Of Brand) = New ObservableCollection(Of Brand)(s) For index = 0 To lst.Count - 1 If lst(index).Name.ToLower = "KosmoCare".ToLower Then lst.Move(index, 0) Exit For End If Next rptBrand.DataSource = lst rptBrand.DataBind() End If LoadJsonData() End Sub Sub LoadJsonData() Dim jsonString As New StringBuilder jsonString.Append("var rptCategoryData=" & JSONHelper.Serialize(CategorySQL.GetHomePageCategory) & ";") 'jsonString.Append("var rptFeaturedProductData=" & JSONHelper.Serialize(ProductSQL.GetFeaturedProduct) & ";") 'jsonString.Append("var rptNewProductData=" & JSONHelper.Serialize(ProductSQL.GetFeaturedProduct) & ";") jsonString.Append("var rptBrandData=" & JSONHelper.Serialize(BrandSQL.GetBrand(True)) & ";") ScriptManager.RegisterStartupScript(Me, Me.GetType, "", jsonString.ToString, True) End Sub Protected Sub rptFeaturedProduct_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptFeaturedProduct.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim item As FeaturedProduct = e.Item.DataItem 'CType(e.Item.FindControl("lblProductName"), Label).Text = item.GroupName 'CType(e.Item.FindControl("lblDiscountedPrice"), Label).Text = "Rs. " & DecimalTwoDigit(item.DiscountedPrice) 'CType(e.Item.FindControl("lblUnitPrice"), Label).Text = "Rs. " & DecimalTwoDigit(item.UnitPrice) 'If item.DiscountedPrice = item.UnitPrice Then ' CType(e.Item.FindControl("lblUnitPrice"), Label).Visible = False 'End If CType(e.Item.FindControl("imgFeaturedProduct"), Image).ImageUrl = item.ImageURL CType(e.Item.FindControl("lnk1"), HtmlAnchor).HRef = "ProductDetails.aspx?CatId=" & item.CategoryID & "&PID=" & item.ProductGroupID 'CType(e.Item.FindControl("lnk2"), HtmlAnchor).HRef = "ProductDetails.aspx?CatId=" & item.CategoryID & "&PID=" & item.ProductGroupID CType(e.Item.FindControl("lnk3"), HtmlAnchor).HRef = "ProductDetails.aspx?CatId=" & item.CategoryID & "&PID=" & item.ProductGroupID End If End Sub Protected Sub rptNewProduct_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptNewProduct.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim item As Product = e.Item.DataItem CType(e.Item.FindControl("lblProductName"), Label).Text = item.Name CType(e.Item.FindControl("lblDiscountedPrice"), Label).Text = "Rs. " & gc.putcommas(item.DiscountedPrice, 0) CType(e.Item.FindControl("lblUnitPrice"), Label).Text = "Rs. " & gc.putcommas(item.UnitPrice, 0) If item.DiscountedPrice = item.UnitPrice Then CType(e.Item.FindControl("lblUnitPrice"), Label).Visible = False End If CType(e.Item.FindControl("imgProduct"), Image).ImageUrl = item.ImageURL CType(e.Item.FindControl("lnk1"), HtmlAnchor).HRef = "ProductDetails.aspx?CatId=" & item.CategoryID & "&PID=" & item.ProductID CType(e.Item.FindControl("lnk2"), HtmlAnchor).HRef = "ProductDetails.aspx?CatId=" & item.CategoryID & "&PID=" & item.ProductID CType(e.Item.FindControl("lnk3"), HtmlAnchor).HRef = "ProductDetails.aspx?CatId=" & item.CategoryID & "&PID=" & item.ProductID End If End Sub Protected Sub rptBrand_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptBrand.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim item As Brand = e.Item.DataItem CType(e.Item.FindControl("imgBrand"), Image).ImageUrl = item.ImageURL End If End Sub 'Protected Sub rptCategory_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptCategory.ItemDataBound ' If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then ' Dim item As ProductCategory = e.Item.DataItem ' CType(e.Item.FindControl("lblName"), Label).Text = item.Name ' CType(e.Item.FindControl("lblCategoryDescription"), HtmlTableCell).InnerHtml = If(item.Description.Length > 57, item.Description.Substring(0, 57) & "...", item.Description) ' CType(e.Item.FindControl("imgCategory"), Image).ImageUrl = item.ImageURL ' CType(e.Item.FindControl("lnkPage"), HtmlAnchor).HRef = "ProductCategorySearch.aspx?CID=" & item.CategoryID ' CType(e.Item.FindControl("lnkMore"), HtmlAnchor).HRef = "ProductCategorySearch.aspx?CID=" & item.CategoryID ' End If 'End Sub End Class