コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_ModuleCheck model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_ModuleCheck set ");
            strSql.Append("s_Module=@s_Module,");
            strSql.Append("n_Enable=@n_Enable");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Module", SqlDbType.NVarChar, 50),
                new SqlParameter("@n_Enable", SqlDbType.Bit,       1),
                new SqlParameter("@n_ID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_Module;
            parameters[1].Value = model.n_Enable;
            parameters[2].Value = model.n_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCode_ModuleCheck model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCode_ModuleCheck(");
            strSql.Append("s_Module,n_Enable)");
            strSql.Append(" values (");
            strSql.Append("@s_Module,@n_Enable)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Module", SqlDbType.NVarChar, 50),
                new SqlParameter("@n_Enable", SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.s_Module;
            parameters[1].Value = model.n_Enable;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_ModuleCheck DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_ModuleCheck model = new IPSP.Model.TCode_ModuleCheck();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["s_Module"] != null)
         {
             model.s_Module = row["s_Module"].ToString();
         }
         if (row["n_Enable"] != null && row["n_Enable"].ToString() != "")
         {
             if ((row["n_Enable"].ToString() == "1") || (row["n_Enable"].ToString().ToLower() == "true"))
             {
                 model.n_Enable = true;
             }
             else
             {
                 model.n_Enable = false;
             }
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_ModuleCheck GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,s_Module,n_Enable from TCode_ModuleCheck ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

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