using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SysCore.Control;
using SysCore.Model;
using SysCore.DAL;

public partial class Base_CustomerClass_CustomerClass_Edit : System.Web.UI.Page
{
    public AuthUI auth = new AuthUI();
    public CustomerClass m;
    public string action;
    public Hashtable xview = new Hashtable();
    protected void Page_Load(object sender, EventArgs e)
    {
        action = Request["action"].ToString();
        xview.Add("action", action);
        //update为修改状态
        BindData();
    }
    /// <summary>
    /// 绑定页面数据
    /// </summary>
    void BindData()
    {
        int cc_id = Convert.ToInt32(Request["id"]);
        CustomerClassDAL dal = new CustomerClassDAL();
        if (action.Equals("Add") && !Request["parent_id"].Equals(""))
        {
            int parent_id = Convert.ToInt32(Request["parent_id"]);
            CustomerClass d = new CustomerClassDAL().Get(parent_id);
            xview.Add("parent_id", d.cc_id);
            xview.Add("parent_code", d.cc_code);
            xview.Add("parent_name", d.cc_name);
        }
        m = dal.Get(cc_id);
        ModuleFormatDesigner mfd = new ModuleFormatDesigner();
        InputUI ui = new InputUI();
        string sql_select_field = "";//SQL所需选择列
        string module = "Base_CustomerClass_Input";//模块
        mfd.CreateInput(module, ref ui, ref sql_select_field, m);
        xview.Add("input_ui", ui.CreateUI());
        Hashtable ht_js = mfd.MakeJavaScript_GetInput(module);
        xview.Add("Script_GetInput", ht_js["Script_GetInput"].ToString());
        xview.Add("Script_SaveJSON", ht_js["Script_SaveJSON"].ToString());
    }
}