Пример #1
0
        private void ActivateDesignTemplate(System.Web.HttpContext context)
        {
            string flag    = string.Empty;
            string strHtml = string.Empty;

            strHtml = context.Request["strHtml"];
            bool          startUsing   = false;
            StringBuilder stringBuider = new StringBuilder();

            stringBuider.Append("{");
            if (!string.IsNullOrEmpty(context.Request["flag"]))
            {
                flag = context.Request["flag"];
            }
            else
            {
                stringBuider.Append("\"success\":0,");
                stringBuider.Append("\"mesg:\",\"改变状态失败\"");
                stringBuider.Append("}");
                context.Response.Write(stringBuider.ToString());
                context.Response.End();
                return;
            }
            if (flag == "1")
            {
                startUsing = false;
            }
            else
            {
                startUsing = true;
            }
            if (startUsing && !string.IsNullOrEmpty(strHtml))//生成静态页面
            {
                CreateHtml(strHtml);
            }
            if (!startUsing)
            {
                File.Delete(HttpContext.Current.Server.MapPath("/Vshop/index.html"));
            }

            if (StoreHelper.ActivateDefaultTemplate(startUsing))
            {
                stringBuider.Append("\"success\":1");
            }
            else
            {
                stringBuider.Append("\"success\":0,");
                stringBuider.Append("\"mesg:\",\"改变状态失败\"");
            }
            stringBuider.Append("}");
            context.Response.Write(stringBuider.ToString());
            context.Response.End();
        }