public IList<FriendLinkInfo> GetLinks(LinkItemType linkType)
        {
            SqlHelper objSqlHelper = new SqlHelper();
            List<FriendLinkInfo> friendlinks = new List<FriendLinkInfo>();
            SqlParameter[] objParams = new SqlParameter[1];
            objParams[0] = new SqlParameter("@linkType", SqlDbType.Int, 4);
            objParams[0].Value = (int)linkType;
            SqlDataReader reader = objSqlHelper.ExecuteReader("je_Link_GetLinks", objParams); ;

            objParams[0].Value = (int)linkType;

            while (reader.Read())
            {
                FriendLinkInfo item = new FriendLinkInfo();
                item.LinkID = reader.GetInt32(reader.GetOrdinal("linkID"));
                item.LinkName = reader.GetString(reader.GetOrdinal("linkName"));
                item.LinkURL = reader.GetString(reader.GetOrdinal("linkURL"));
                item.LinkLogo = reader.GetString(reader.GetOrdinal("linkLogo"));
                item.LinkOrder = reader.GetInt32(reader.GetOrdinal("linkOrder"));
                item.IsMain = reader.GetBoolean(reader.GetOrdinal("linkMain"));
                item.IsArrow = reader.GetBoolean(reader.GetOrdinal("linkArrow"));
                friendlinks.Add(item);
            }
            reader.Close();
            return friendlinks;
        }
 void dataBind()
 {
     string edit = Request.QueryString["edit"];
     if (edit != null)
     {
         FriendLinkInfo f = new FriendLinkInfo();
         f = FriendLink.GetLinkByID(int.Parse(edit));
         LinkNameTxt.Text = f.LinkName;
         LinkIndexChk.Checked = f.IsMain;
         LinkUrlTxt.Text = f.LinkURL;
         LinkLogoTxt.Text = f.LinkLogo;
         LinkAddBtn.Text = "编辑";
     }
     else
     {
         LinkAddBtn.Text = "新增";
     }
 }
    protected void LinkAddBtn_Click(object sender, EventArgs e)
    {
        string edit = Request.QueryString["edit"];
        FriendLinkInfo f = new FriendLinkInfo();
        f.LinkName = LinkNameTxt.Text;
        f.IsMain = LinkIndexChk.Checked;
        f.LinkURL = LinkUrlTxt.Text;
        f.LinkLogo = LinkLogoTxt.Text;
        if (edit != null)
        {
            f.LinkID = int.Parse(edit);
            FriendLink.UpdateLink(f);
            Response.Redirect("friendLink.aspx");
        }
        else
        {
            FriendLink.InsertLink(InsertLinkType.Arrowed, f);
            Response.Redirect("friendLink.aspx");
        }

    }
        /// <summary>
        /// 获取特定链接
        /// </summary>
        /// <returns></returns>
        public FriendLinkInfo GetLinkByID(int linkID)
        {

            SqlHelper objSqlHelper = new SqlHelper();
            SqlParameter[] objParams = new SqlParameter[1];
            objParams[0] = new SqlParameter("@LinkID", SqlDbType.Int, 4);
            objParams[0].Value = linkID;
            SqlDataReader reader = objSqlHelper.ExecuteReader("je_Link_GetLinkByID", objParams);
            FriendLinkInfo item = new FriendLinkInfo();
            while (reader.Read())
            {
                item.LinkID = reader.GetInt32(reader.GetOrdinal("linkID"));
                item.LinkName = reader.GetString(reader.GetOrdinal("linkName"));
                item.LinkURL = reader.GetString(reader.GetOrdinal("linkURL"));
                item.LinkLogo = reader.GetString(reader.GetOrdinal("linkLogo"));
                item.LinkOrder = reader.GetInt32(reader.GetOrdinal("linkOrder"));
                item.IsMain = reader.GetBoolean(reader.GetOrdinal("linkMain"));
                item.IsArrow = reader.GetBoolean(reader.GetOrdinal("linkArrow"));
            }
            reader.Close();
            return item;
        }
 /// <summary>
 /// 更新友情链接
 /// </summary>
 /// <param name="link"></param>
 /// <returns></returns>
 public static int UpdateLink(FriendLinkInfo link)
 {
     return friendLink.UpdateLink(link);
 }
 /// <summary>
 /// 添加友情链接
 /// </summary>
 /// <param name="link"></param>
 public static void InsertLink(InsertLinkType linkType, FriendLinkInfo link)
 {
     friendLink.InsertLink(linkType, link);
 }
 /// <summary>
 /// 添加友情链接
 /// </summary>
 /// <param name="r"></param>
 public void InsertLink(InsertLinkType linkType, FriendLinkInfo f)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[6];
     objParams[0] = new SqlParameter("@LinkName", f.LinkName);
     objParams[1] = new SqlParameter("@LinkURL", f.LinkURL);
     objParams[2] = new SqlParameter("@LinkLogo", StringHelper.convertStr(f.LinkLogo));
     objParams[3] = new SqlParameter("@linkMain", f.IsMain);
     objParams[4] = new SqlParameter("@LinkAddDate", DateTime.Now);
     objParams[5] = new SqlParameter("@linkArrow", (int)linkType); ;
     objSqlHelper.ExecuteNonQuery("je_Link_InsertLink", objParams);
 }
 /// <summary>
 /// 更新友情链接
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int UpdateLink(FriendLinkInfo f)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[5];
     objParams[0] = new SqlParameter("@LinkName", f.LinkName);
     objParams[1] = new SqlParameter("@LinkURL", f.LinkURL);
     objParams[2] = new SqlParameter("@LinkLogo", StringHelper.convertStr(f.LinkLogo));
     objParams[3] = new SqlParameter("@linkMain", f.IsMain);
     objParams[4] = new SqlParameter("@LinkID", f.LinkID);
     return objSqlHelper.ExecuteNonQuery("je_Link_UpdateLink", objParams);
 }