using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using xabaraCOM;

public partial class WebXabara_Link_Del : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        admin a = new admin();
        fileDocument f = new fileDocument();
        javasrcipt js = new javasrcipt();
        a.check("|link|");

        long idTemp=xabara.isNum(Request["id"]);

        sqlServer sql = new sqlServer();
        DataTable dt = sql.getDataTable("select linkName,uploadFile from linkXabara where lid=" + idTemp.ToString());
        if (dt.Rows.Count > 0)
        {
            string img = dt.Rows[0]["uploadFile"].ToString().Trim();
            if (!string.IsNullOrEmpty(img as string))
            {
                string DelFilePath = img.Substring(5, 8) + "/" + img;
                f.del(DelFilePath);
            }

            sql.log(a.uid, "admin", "删除链接：" + dt.Rows[0]["linkName"].ToString().Trim());
        }
        dt.Dispose();

        js.div(false, "", "text", sql.del("linkXabara", "lid", xabara.isNum(Request["id"]).ToString(), string.Empty, false, string.Empty), 350, 0, "default.aspx?cid=" + Request.QueryString["cid"] + "&page=" + Request.QueryString["page"], "goto");
    }
}
