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 printTemplateDesign : System.Web.UI.Page
    {
        public eUser user;
        string sql = "";
        public string act = eParameters.Request("act");
        public string ModelPrintID = eParameters.Request("id");
        public string ModelID = eParameters.Request("modelid");
        public string code = eParameters.Request("code");
        public string designJson = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            user = new eUser("Manage");

            if (act == "update")
            {
                designJson = eParameters.Form("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 + "'");
                if (ModelPrintID.Length > 10)
                {
                    sql = "update a_eke_sysModelPrints set " + code + "='" + designJson + "' where ModelPrintID='" + ModelPrintID + "'";
                }
                else
                {
                    sql = "update a_eke_sysModels set " + code + "='" + designJson + "' where ModelID='" + ModelID + "'";
                }
                eBase.DataBase.Execute(sql);
                eResult.Success("成功!");
            }
            if (ModelPrintID.Length > 10)
            {
                sql = "select "+ code +" from a_eke_sysModelPrints where ModelPrintID='" + ModelPrintID + "'";
            }
            else
            {
                sql = "select " + code + " from a_eke_sysModels where ModelID='" + ModelID + "'";
            }
            designJson = eBase.DataBase.getValue(sql);
            if (designJson.Length < 10) designJson = "[{\"name\": \"Sheet1\",\"defaultRowHeight\": 25,\"column\":15,\"row\":20}]";
        }
 
    }
}