using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Favorites;
public partial class Search_SaveFavorites : Base.BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string ThisUrl = Request.Url.ToString();
        try
        {
            int intUserID = 0;
            string strType = Request.QueryString["type"].ToString();
            string strID = Request.QueryString["id"].ToString();
            if (CheckCookies())
            {
                intUserID = int.Parse(GetCookie("UserID"));
                Favorites.TFavorites tf = new TFavorites();
                tf.UserID = intUserID;
                tf.Type = strType;
                tf.ProductID = int.Parse(strID.ToString());
                int Reint = new RFavorites().Insert(tf);
                if (Reint == 1)
                    ShowMessage("收藏成功！", "../member/index.aspx"); 
            }
            else
                Response.Redirect("../login/login.aspx?done="+ThisUrl);
        }
        catch (Exception ex)
        {
            ShowMessage("已经存在该收藏!","../Member/index.aspx");
        }
    }
}
