/// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(DigiPower.Onlinecol.Standard.Model.T_Field_MDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Field set ");
            strSql.Append("table_name=@table_name,");
            strSql.Append("table_chn_name=@table_chn_name,");
            strSql.Append("column_name=@column_name,");
            strSql.Append("column_chn_name=@column_chn_name,");
            strSql.Append("column_order=@column_order,");
            strSql.Append("note=@note");
            strSql.Append(" where FieldID=@FieldID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FieldID",         SqlDbType.Int,      8),
                new SqlParameter("@table_name",      SqlDbType.VarChar, 50),
                new SqlParameter("@table_chn_name",  SqlDbType.VarChar, 50),
                new SqlParameter("@column_name",     SqlDbType.VarChar, 50),
                new SqlParameter("@column_chn_name", SqlDbType.VarChar, 50),
                new SqlParameter("@column_order",    SqlDbType.Int,      8),
                new SqlParameter("@note",            SqlDbType.VarChar, 255)
            };
            parameters[0].Value = model.FieldID;
            parameters[1].Value = model.table_name;
            parameters[2].Value = model.table_chn_name;
            parameters[3].Value = model.column_name;
            parameters[4].Value = model.column_chn_name;
            parameters[5].Value = model.column_order;
            parameters[6].Value = model.note;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 绑定页面
        /// </summary>
        /// <param name="ID"></param>
        private void BindPage(string ID)
        {
            Model.T_Field_MDL model = new DigiPower.Onlinecol.Standard.Model.T_Field_MDL();

            BLL.T_Field_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_Field_BLL();

            model = bll.GetModel(Convert.ToInt32(ID));

            if (model != null)
            {
                ViewState["model"] = model;
                DigiPower.Onlinecol.Standard.Web.Comm.SetValueToPage(model, this.tbl);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DigiPower.Onlinecol.Standard.Model.T_Field_MDL GetModel(int FieldID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 FieldID,table_name,table_chn_name,column_name,column_chn_name,column_order,note from T_Field ");
            strSql.Append(" where FieldID=@FieldID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FieldID", SqlDbType.Int, 8)
            };
            parameters[0].Value = FieldID;

            DigiPower.Onlinecol.Standard.Model.T_Field_MDL model = new DigiPower.Onlinecol.Standard.Model.T_Field_MDL();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["FieldID"].ToString() != "")
                {
                    model.FieldID = int.Parse(ds.Tables[0].Rows[0]["FieldID"].ToString());
                }
                model.table_name      = ds.Tables[0].Rows[0]["table_name"].ToString();
                model.table_chn_name  = ds.Tables[0].Rows[0]["table_chn_name"].ToString();
                model.column_name     = ds.Tables[0].Rows[0]["column_name"].ToString();
                model.column_chn_name = ds.Tables[0].Rows[0]["column_chn_name"].ToString();
                if (ds.Tables[0].Rows[0]["column_order"].ToString() != "")
                {
                    model.column_order = int.Parse(ds.Tables[0].Rows[0]["column_order"].ToString());
                }
                model.note = ds.Tables[0].Rows[0]["note"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DigiPower.Onlinecol.Standard.Model.T_Field_MDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Field(");
            strSql.Append("table_name,table_chn_name,column_name,column_chn_name,column_order,note)");
            strSql.Append(" values (");
            strSql.Append("@table_name,@table_chn_name,@column_name,@column_chn_name,@column_order,@note)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@table_name",      SqlDbType.VarChar, 50),
                new SqlParameter("@table_chn_name",  SqlDbType.VarChar, 50),
                new SqlParameter("@column_name",     SqlDbType.VarChar, 50),
                new SqlParameter("@column_chn_name", SqlDbType.VarChar, 50),
                new SqlParameter("@column_order",    SqlDbType.Int,      8),
                new SqlParameter("@note",            SqlDbType.VarChar, 255)
            };
            parameters[0].Value = model.table_name;
            parameters[1].Value = model.table_chn_name;
            parameters[2].Value = model.column_name;
            parameters[3].Value = model.column_chn_name;
            parameters[4].Value = model.column_order;
            parameters[5].Value = model.note;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.T_Field_MDL model = new DigiPower.Onlinecol.Standard.Model.T_Field_MDL();

            BLL.T_Field_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_Field_BLL();
            if (ViewState["model"] != null)
            {
                model = (Model.T_Field_MDL)ViewState["model"];
            }
            object obj = Comm.GetValueToObject(model, this.tbl);

            if (obj != null)
            {
                Model.T_Field_MDL Newmodel = (Model.T_Field_MDL)obj;

                switch ((CommonEnum.PageState)ViewState["ps"])
                {
                case CommonEnum.PageState.ADD:

                    bll.Add(Newmodel);

                    break;

                case CommonEnum.PageState.EDIT:
                {
                    Newmodel.FieldID = Convert.ToInt32(ID);

                    bll.Update(Newmodel);
                }

                break;
                }
            }

            Response.Redirect("FieldList.aspx?sqlwhere=" + SqlWhere + "&PageIndex=" + pPageIndex + "");
        }