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 Fm.Bussiness;

public partial class Admin_Link_Update : BasePage
{
      
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
        }
    }
    //页面加载的时候获取需要修改的友情连接的资料信息
    void Bind()
    {
        public_select ps = new public_select();
        DataView dv = ps.Getps("Fm_link","*","link_id=" + int.Parse(Request.QueryString["lid"].ToString()) + "");
        
        int bo=0;

        if(dv[0]["link_type"].ToString()=="True")
        {
            bo=1;
        }
        foreach (ListItem i in RadioButtonList1.Items)
        {
            if (i.Value == bo.ToString())
            {
                i.Selected = true;
            }
        }

        TextBox2.Text = dv[0]["link_name"].ToString();
        TextBox3.Text = dv[0]["link_url"].ToString();
        TextBox4.Text = dv[0]["link_logo"].ToString();
        TextBox5.Text = dv[0]["link_px"].ToString();
        TextBox6.Text = dv[0]["link_intro"].ToString();

    }
    //友情连接修改方法
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        sys_link lk = new sys_link();
        Fm.EntityClass.Link link = new Fm.EntityClass.Link();
        link.link_id = int.Parse(Request.QueryString["lid"].ToString());
        link.link_name = TextBox2.Text;
        link.link_px = int.Parse(TextBox5.Text);
        link.link_url = TextBox3.Text;
        link.link_type = bool.Parse(RadioButtonList1.SelectedItem.Value);
        link.link_logo = TextBox4.Text;
        link.link_intro = TextBox6.Text;
        if (lk.Link_Update(link))
        {
            Response.Redirect("Erro.aspx?eid=友情连接信息修改成功!&url=Link_List.aspx", true);
        }
    }
}
