using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PageAdmin.BLL;using PageAdmin.Filter;
using PageAdmin.Common;
using System.Collections.Specialized;
using System.Data;

namespace PageAdmin.Web.Areas.Admin.Controllers
{
    public class CollectionController : BaseController
    {
        //CollectionBLL BLL = new CollectionBLL();
        public CollectionController() : base("pa_collection", "Tool")
        {
            //base.AddExecuting = new Action(Is_Hashttp);
            //base.EditExecuting = new Action(Is_Hashttp);
            //base.DeleteExecuting = new Action(DeleteContent);
        }
        //public void Is_Hashttp()
        //{
        //    string url = Request.Form["url"];
        //    TipsInfo tipsInfo = base.MvcContext.TipsInfo;
        //    if (url.IndexOf("http://") == -1 && url.IndexOf("https://") == -1)
        //    {
        //        tipsInfo.State = 0;
        //        tipsInfo.Msg = "请加上http://或https://";
        //    }
        //}
        //public void DeleteContent()
        //{
        //    int id = StringHelper.Format<int>(Request.Form["id"]);
        //    _DbContext.Delete("pa_collection_content", "collection_id="+id);
        //}
        //[HttpGet]
        //public ActionResult DetailRule()
        //{
        //    int collection_id = StringHelper.Format<int>(Request.QueryString["id"]);
        //    string FieldName = BLL.SelectField(collection_id);
        //    ViewBag.FieldName = BLL.GetCollectionFields(collection_id);
        //    return View((object)FieldName);
        //}
        //[ValidateInput(false)]
        //[HttpPost]
        //public JsonResult DetailRule(FormCollection form)
        //{
        //    return Json(BLL.DetailRule(form));
        //}
        //[ValidateInput(false)]
        //[HttpPost]
        //public JsonResult Save(FormCollection form)
        //{
        //    int collection_id = StringHelper.Format<int>(form["id"]);
        //    TipsInfo tipsInfo = new TipsInfo();
        //    if (collection_id != 0)
        //    {
        //        BLL.InsertRule(form, collection_id);
        //        tipsInfo.State = 1;
        //        tipsInfo.Msg = "保存成功！";
        //    }
        //    else
        //    {
        //        tipsInfo.State = 0;
        //        tipsInfo.Msg = "参数id有误,保存失败！";
        //    }
        //    return Json(tipsInfo);
        //}
        //[HttpGet]
        //public ActionResult Test()
        //{
        //    NameValueCollection form = Request.QueryString;
        //    ViewBag.field = BLL.GetCollectionFields(StringHelper.Format<int>(form["id"]));
        //    ViewBag.Test = BLL.Test(form);
        //    return View();
        //}
        //[ValidateInput(false)]
        //[HttpPost]
        //public void Test(FormCollection form)
        //{
        //    int collection_id = StringHelper.Format<int>(form["id"]);
        //    BLL.InsertRule(form, collection_id);
        //}
        //[HttpGet]
        //public ActionResult Set()
        //{
        //    return View();
        //}
        //[HttpGet]
        //public override string ListData()
        //{
        //    var form = Request.QueryString;
        //    int site_id = StringHelper.Format<int>(form["site_id"]);
        //    DataTable dt = PA.GetDataTable("pa_column", "id,name", "site_id=" + site_id);
        //    return Json(dt);
        //}
    }
}