public HttpResponseBase GetPage()
        {
            List<SitePage> store = new List<SitePage>();
            string json = string.Empty;
            try
            {
                SitePage bp = new SitePage();

                _sitePageMg = new SitePageMgr(mySqlConnectionString);
                store = _sitePageMg.GetPage(bp);

                json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented) + "}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;

        }
        public JsonResult UpdateSitePageStatus()
        {
            string json = string.Empty;
            try
            {
                SitePageQuery query = new SitePageQuery();
                if (!string.IsNullOrEmpty(Request.Params["id"]))
                {
                    query.page_id = Convert.ToInt32(Request.Params["id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["active"]))
                {
                    query.page_status = Convert.ToInt32(Request.Params["active"]);
                }
                query.page_updatedate = DateTime.Now;
                query.update_userid = (Session["caller"] as Caller).user_id;
                _sitePageMg = new SitePageMgr(mySqlConnectionString);
                if (_sitePageMg.UpdateStatus(query) > 0)
                {
                    return Json(new { success = "true" });
                }
                else
                {
                    return Json(new { success = "false" });
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                return Json(new { success = "false" });
            }
        }
        public HttpResponseBase SaveSitePage()
        {
            string json = string.Empty;
            SitePageQuery query = new SitePageQuery();
            _sitePageMg = new SitePageMgr(mySqlConnectionString);
            try
            {
                if (string.IsNullOrEmpty(Request.Params["page_id"]))
                {
                    if (!string.IsNullOrEmpty(Request.Params["page_name"]))
                    {
                        query.page_name = Request.Params["page_name"];
                    }
                    else
                    {
                        query.page_name = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["page_url"]))
                    {
                        query.page_url = Request.Params["page_url"];
                    }
                    else
                    {
                        query.page_url = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["page_html"]))
                    {
                        query.page_html = Request.Params["page_html"];

                    }
                    else
                    {
                        query.page_html = string.Empty;
                    }

                    query.page_desc = Request.Params["page_desc"];

                    query.page_status = 0;
                    query.page_createdate = DateTime.Now;
                    query.page_updatedate = DateTime.Now;
                    query.create_userid = (Session["caller"] as Caller).user_id;
                    query.update_userid = (Session["caller"] as Caller).user_id;
                    _sitePageMg.Save(query);
                    json = "{success:true}";
                }
                else
                {
                    query.page_id = Convert.ToInt32(Request.Params["page_id"]);
                    query.page_name = Request.Params["page_name"];
                    query.page_url = Request.Params["page_url"];
                    query.page_html = Request.Params["page_html"];
                    query.page_desc = Request.Params["page_desc"];
                    query.page_status = 0;
                    query.page_updatedate = DateTime.Now;
                    query.update_userid = (Session["caller"] as Caller).user_id;
                    _sitePageMg.Update(query);
                    json = "{success:true}";

                }

            }
            catch (Exception ex)
            {

                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false}";
            }


            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
        //public HttpResponseBase Getpic()
        //{//判斷該文件是否超過限制
        //    string Json = "";
        //    FileManagement fileLoad = new FileManagement();

        //    string path = Server.MapPath(xmlPath);
        //    SiteConfigMgr _siteConfigMgr = new SiteConfigMgr(path);
        //    SiteConfig minValue_config = _siteConfigMgr.GetConfigByName("PIC_Length_Min_Element");
        //    SiteConfig maxValue_config = _siteConfigMgr.GetConfigByName("PIC_Length_MaxValue");
        //    //擴展名、最小值、最大值
        //    string minValue = minValue_config.Value == "" ? minValue_config.DefaultValue : minValue_config.Value;
        //    string maxValue = maxValue_config.Value == "" ? maxValue_config.DefaultValue : maxValue_config.Value;
        //    //if (Request.Files.Count > 0)//單個圖片上傳
        //    for (int iFile = 0; iFile < Request.Files.Count; iFile++)//多個上傳圖片
        //    {
        //        HttpPostedFileBase file = Request.Files[iFile];//單個Request.Files[0]
        //        int fileSize = file.ContentLength;
        //        if (fileSize > int.Parse(minValue) && fileSize < int.Parse(maxValue))
        //        {
        //            Json = "{success:true}";
        //        }
        //        else
        //        {
        //            Json = "{success:false}";
        //        }
        //    }
        //    this.Response.Clear();
        //    this.Response.Write(Json);
        //    this.Response.End();
        //    return this.Response;
        //}

        #endregion

        #region 站台頁面管理
        #region 頁面列表頁 +HttpResponseBase SitePageList()
        public HttpResponseBase SitePageList()
        {
            List<SitePageQuery> store = new List<SitePageQuery>();
            string json = string.Empty;
            SitePageQuery query = new SitePageQuery();
            try
            {
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
                //if (!string.IsNullOrEmpty(Request.Params["site"]))
                //{
                //    query.site_name = Request.Params["site"];
                //}
                //else
                //{
                //    query.site_id = 0;
                //}
                if (!string.IsNullOrEmpty(Request.Params["pagename"]))
                {
                    query.page_name = Request.Params["pagename"];
                }
                else
                {
                    query.page_name = string.Empty;
                }

                _sitePageMg = new SitePageMgr(mySqlConnectionString);
                int totalCount = 0;
                query.create_userid = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                store = _sitePageMg.GetSitePageList(query, out totalCount);
                foreach (var item in store)
                {

                    if (item.page_html.Length >= 15)
                    {
                        item.page_shortHtml = item.page_html.Substring(0, 15) + "...";
                    }
                    else
                    {
                        item.page_shortHtml = item.page_html;
                    }
                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }