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

namespace KstCMS.Plus
{
    public partial class PostLy : KstCmsBase.WebPage.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
                if (Request.Form["txt_webcode"].Trim() != (string)Session["WebCode"])
                {
                    ShowMsgModle("The authentication code input error!", "history.go(-1);");
                    return;
                }
                string YourName = Request.Form["txt_attn"].Trim();
                string Tel = Request.Form["txt_tel"].Trim();
                string email = Request.Form["txt_email"].Trim();
                string Content = Request.Form["txt_lycontent"].Trim();
                if (YourName == "" || Tel == "" || email == "" || Content == "")
                {
                    ShowMsgModle("You typed the incomplete information, please enter again!", "history.go(-1);");
                    return;
                }
                string Lylbid = Request.QueryString.Get("Lylbid");
                string SiteId = Request.QueryString.Get("SiteId");
                if (!string.IsNullOrEmpty(Lylbid) && !string.IsNullOrEmpty(SiteId))
                {
                    string[] data = new string[]{
                    Lylbid,
                    SiteId,
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_cname"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_attn"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_tel"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_fax"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_email"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_addr"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_lytitle"].Trim()),
                    KstCmsBase.Common.Fucs.NoHTML(Request.Form["txt_lycontent"].Trim()),
                    DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),
                    Request.UserHostAddress
                };
                    KstCmsBase.DAL.Feeback.Ly.ClientLy(data, "LbID", "SiteID", "CName", "Attn", "Tel", "Fax", "Email", "Addr", "LyTitle", "LyContent", "LyTime", "IP");
                    ShowMsgModle("Thank you, your information has been submitted success!","history.go(-1);");

                }
                else
                {
                    ShowMsgModle("留言表单设置错误，请在内容标签中设置好\"Lylbid\"或SiteId.","history.go(-1);");
                }
            }



    }
}