using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KstCMS.KstCMS_Manager.WebSet.Template.tagtmp
{
    public partial class TagTempLB : KstCmsBase.WebPage.ValidationPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button3.Click += new EventHandler(Button3_Click);
            RepMain.ItemCommand += new RepeaterCommandEventHandler(RepMain_ItemCommand);
            if (!IsPostBack)
                RepMain_Bind();
        }

        void RepMain_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int Act = Convert.ToInt32(e.CommandArgument.ToString());
            int TagLBID = Convert.ToInt32(e.CommandName.ToString());
            switch (Act)
            {
                case 0:
                    string[] data = new string[] { Request.Form.Get("TagLBNAME_" + TagLBID.ToString()) };
                    KstCmsBase.DAL.Tag.TagTEMP.TagLB_Update(TagLBID, data, "TagLBNAME");
                    break;
                case 1:
                    KstCmsBase.DAL.Tag.TagTEMP.TagLB_Delete(TagLBID);
                    break;
            }
            RepMain_Bind();
        }

        void Button3_Click(object sender, EventArgs e)
        {
            string[] data = new string[] { txt_TagLBNAME.Text.Trim() };
            KstCmsBase.DAL.Tag.TagTEMP.TagLB_insert(data, "TagLBNAME");
            RepMain_Bind();
        }
        void RepMain_Bind()
        {
            RepMain.DataSource = KstCmsBase.DAL.Tag.TagTEMP.TagTempLBItems();
            RepMain.DataBind();
        }
    }
}