/// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCode_DropDownValues model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCode_DropDownValues(");
            strSql.Append("n_CtrID,s_CtrlValue,s_IsSystem,n_Sequence,s_CtrlCode)");
            strSql.Append(" values (");
            strSql.Append("@n_CtrID,@s_CtrlValue,@s_IsSystem,@n_Sequence,@s_CtrlCode)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CtrID",     SqlDbType.Int,        4),
                new SqlParameter("@s_CtrlValue", SqlDbType.NVarChar, 500),
                new SqlParameter("@s_IsSystem",  SqlDbType.NVarChar, 100),
                new SqlParameter("@n_Sequence",  SqlDbType.Int,        4),
                new SqlParameter("@s_CtrlCode",  SqlDbType.NVarChar, 10)
            };
            parameters[0].Value = model.n_CtrID;
            parameters[1].Value = model.s_CtrlValue;
            parameters[2].Value = model.s_IsSystem;
            parameters[3].Value = model.n_Sequence;
            parameters[4].Value = model.s_CtrlCode;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_DropDownValues DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_DropDownValues model = new IPSP.Model.TCode_DropDownValues();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_CtrID"] != null && row["n_CtrID"].ToString() != "")
         {
             model.n_CtrID = int.Parse(row["n_CtrID"].ToString());
         }
         if (row["s_CtrlValue"] != null)
         {
             model.s_CtrlValue = row["s_CtrlValue"].ToString();
         }
         if (row["s_IsSystem"] != null)
         {
             model.s_IsSystem = row["s_IsSystem"].ToString();
         }
         if (row["n_Sequence"] != null && row["n_Sequence"].ToString() != "")
         {
             model.n_Sequence = int.Parse(row["n_Sequence"].ToString());
         }
         if (row["s_CtrlCode"] != null)
         {
             model.s_CtrlCode = row["s_CtrlCode"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_DropDownValues model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_DropDownValues set ");
            strSql.Append("s_CtrlValue=@s_CtrlValue,");
            strSql.Append("s_IsSystem=@s_IsSystem,");
            strSql.Append("n_Sequence=@n_Sequence,");
            strSql.Append("s_CtrlCode=@s_CtrlCode");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_CtrlValue", SqlDbType.NVarChar, 500),
                new SqlParameter("@s_IsSystem",  SqlDbType.NVarChar, 100),
                new SqlParameter("@n_Sequence",  SqlDbType.Int,        4),
                new SqlParameter("@s_CtrlCode",  SqlDbType.NVarChar,  10),
                new SqlParameter("@n_ID",        SqlDbType.Int,        4),
                new SqlParameter("@n_CtrID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_CtrlValue;
            parameters[1].Value = model.s_IsSystem;
            parameters[2].Value = model.n_Sequence;
            parameters[3].Value = model.s_CtrlCode;
            parameters[4].Value = model.n_ID;
            parameters[5].Value = model.n_CtrID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_DropDownValues GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_CtrID,s_CtrlValue,s_IsSystem,n_Sequence,s_CtrlCode from TCode_DropDownValues ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

            IPSP.Model.TCode_DropDownValues model = new IPSP.Model.TCode_DropDownValues();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TCode_DropDownValues model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TCode_DropDownValues model)
 {
     return(dal.Add(model));
 }