using framework_business;
using framework_library;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class controls_module_featuredProducts : System.Web.UI.UserControl
{
#region methods
///
/// Bind Featured Products
///
private void BindFeaturedProducts()
{
try
{
ArrayList featured = xData.GetTypedByCriteriaSpecific("recId", typeof(oProduct), "isActive,isFeatured", "1,1", "recId DESC");
rptFeaturedProducts.DataSource = featured;
rptFeaturedProducts.DataBind();
}
catch (Exception ex)
{
exception.HandleException("featured products:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
#endregion
#region events
///
/// Page Load Event
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
try
{
BindFeaturedProducts();
}
catch (Exception ex)
{
exception.HandleException("featured products:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// View Range
///
///
///
protected void lnkViewRange_Click(object sender, EventArgs e)
{
try
{
if (sender.GetType() == typeof(LinkButton))
{
int catId = int.Parse(((LinkButton)sender).CommandArgument);
foreach (oProductCategory cat in xData.GetTypedByCriteriaSpecific("recId", typeof(oProductCategory), "recId", catId.ToString()))
{
Response.Redirect("/products/" + cat.name.ToLower(), false);
}
}
}
catch (Exception ex)
{
exception.HandleException("featured products:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// View Product
///
///
///
protected void lnkViewProduct_Click(object sender, EventArgs e)
{
try
{
if (sender.GetType() == typeof(LinkButton))
{
int recId = int.Parse(((LinkButton)sender).CommandArgument);
foreach (oProduct prod in xData.GetTypedByCriteriaSpecific("recId", typeof(oProduct), "recId", recId.ToString()))
{
Response.Redirect("/product/" + prod.name.ToLower(), false);
break;
}
}
}
catch (Exception ex)
{
exception.HandleException("featured products:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
#endregion
}