using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using EKETEAM.Data;
using EKETEAM.FrameWork;
using EKETEAM.UserControl;
using System.Xml;
using System.Xml.Serialization;


namespace eFrameWork.Manage
{
    public partial class templateDesign : System.Web.UI.Page
    {
        public eUser user;
        string sql = "";
        public string act = eParameters.Request("act");
        public string TemplateID = eParameters.QueryString("TemplateID");
        public dynamic template = new eViewObject();

        protected void Page_Load(object sender, EventArgs e)
        {
            user = new eUser("Manage");

            if (act == "update")
            {
                string designJson = eParameters.Form("designJson");
                designJson = eBase.decode(designJson);
                string designData = eParameters.Form("designData");
                designData = eBase.decode(designData);
                //eBase.DataBase.Execute("update a_eke_sysDataTemplates set designJson='" + designJson + "',designData='" + designData + "' where TemplateID='" + TemplateID + "'");
                eBase.DataBase.Execute("update a_eke_sysDataTemplates set designJson='" + designData + "' where TemplateID='" + TemplateID + "'");
                eResult.Success("成功!");
            }
            template = eBase.DataBase.getValues("select * from a_eke_sysDataTemplates where TemplateID='" + TemplateID + "'");
            if (template.designJson.Length < 10) template.designJson = "[{\"name\": \"Sheet1\",\"defaultRowHeight\": 25,\"column\":15,\"row\":20}]";
        }
 
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (Master == null) return;
            Literal lit = (Literal)Master.FindControl("LitTitle");
            if (lit != null)
            {
                lit.Text = "模板管理 - " + eConfig.manageName(); 
            }
        }
    }
}