using System;
using System.Data;
using System.Configuration;
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;

/// <summary>
/// HomeCount 的摘要说明
/// </summary>
public class HomeCount
{    private DataSet1 ds = new DataSet1();
    private DataSet1.HomeCountDataTable dt = new DataSet1.HomeCountDataTable();
    private DataSet1TableAdapters.HomeCountTableAdapter da = new DataSet1TableAdapters.HomeCountTableAdapter();

    public HomeCount()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }
    public void ForCount(string id)
    {
        this.da.Fill(this.dt);
        string Id = id;
        for (int i = 0; i < this.dt.Rows.Count; i++)
        {
            string s = (string)dt.Rows[i]["bloger_name"];
            if (IsPerfec(Id, s))
            {
                int temp = 0;

                temp = int.Parse(this.dt.Rows[i]["click_count"].ToString());
                dt.Rows[i]["click_count"] = temp + 1;
                break;
            }
        }
        this.da.Update(this.dt);
    }

    public bool IsPerfec(string s1, string s2)
    {
        string ob1 = s1;
        string ob2 = s2;
        if (ob1.Length == ob2.Length)
        {
            for (int i = 0; i < ob1.Length; i++)
            {
                if (ob1[i] != ob2[i])
                {
                    return false;
                    break;
                }
            }
        }
        else
        {
            return false;
        }
        
        return true;
    }
}
