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 Base;
using Keywords;

public partial class admin_Keywords_KeywordsAdd : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckRights("Basic", "A1");
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string myValue = "";
            TKeywords TKeyword = new TKeywords();
            TKeyword.Name = txtName.Text;
            TKeyword.Count = int.Parse(txtCount.Text);
            TKeyword.IsCommend = Convert.ToBoolean(radlIsCommend.SelectedValue);
            foreach (ListItem li in chklType.Items)
            {
                if (li.Selected)
                {
                    myValue += li.Value + ",";
                }

            }
            if (myValue != "")
            {
                myValue = myValue.Substring(0, myValue.Length - 1);
            }

            TKeyword.Type = myValue;
            TKeyword.EditDate = DateTime.Now;
            IKeywords RKeyword = new RKeywords();
            RKeyword.Insert(TKeyword);
            ShowMessage("热门关键字添加成功！", "Keywords/KeywordsList.aspx");

        }
        catch (Exception ex)
        {

            ShowMessage("热门关键字添加失败！", "Keywords/KeywordsList.aspx");
        }
    }


    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Write("<script language='javascript'>window.location='KeywordsList.aspx'</script>");
    }
}
