using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using TopWinCMS.BLL;
using TopWinCMS.Common;
using TopWinCMS.Model;
namespace TopWinCMS.WebUI.Admin.Task
{
    public partial class Task_Manage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (!IsPostBack)
            {
                this.LB_Path.Text = Config.SiteName + " →  <a href=\"Task_Manage.aspx\">计划任务</a>"; 

                new TaskManage().BindList(GV_List);
                
                MyJavascript.RegJS(UpdatePanel1, "attachMouseEvent('" + GV_List.ClientID + "');");
            }
        }

        protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            { 
                LinkButton LB = e.Row.Cells[3].Controls[0] as LinkButton;

                if (LB.Text == "1")
                {
                    LB.Text = "<IMG alt=\"启用\" src=\"../Images/success-true.gif\">";
                }
                else
                {
                    LB.Text = "<IMG alt=\"停止\" src=\"../Images/failed-false.gif\">";
                }
            }
        }

        protected void GV_List_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            TaskManage BLLClass = new TaskManage();
            TaskInfo model = BLLClass.EditLoad(GV_List.DataKeys[(int)e.CommandArgument].Value.ToString());

            model.IsUsed = 1 - model.IsUsed;

            string Err=null;
            BLLClass.Add(model, ref Err);

        }
    }
}
