Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(IPSP.Model.TRCode_RemindTemplate model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TRCode_RemindTemplate(");
            strSql.Append("g_ID,s_Name,s_Title,s_Content,s_Path,s_Description)");
            strSql.Append(" values (");
            strSql.Append("@g_ID,@s_Name,@s_Title,@s_Content,@s_Path,@s_Description)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_ID",          SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@s_Name",        SqlDbType.NVarChar,          100),
                new SqlParameter("@s_Title",       SqlDbType.NVarChar,          100),
                new SqlParameter("@s_Content",     SqlDbType.NVarChar,           -1),
                new SqlParameter("@s_Path",        SqlDbType.NVarChar,         1000),
                new SqlParameter("@s_Description", SqlDbType.NVarChar, 1000)
            };
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = model.s_Name;
            parameters[2].Value = model.s_Title;
            parameters[3].Value = model.s_Content;
            parameters[4].Value = model.s_Path;
            parameters[5].Value = model.s_Description;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TRCode_RemindTemplate DataRowToModel(DataRow row)
 {
     IPSP.Model.TRCode_RemindTemplate model = new IPSP.Model.TRCode_RemindTemplate();
     if (row != null)
     {
         if (row["g_ID"] != null && row["g_ID"].ToString() != "")
         {
             model.g_ID = new Guid(row["g_ID"].ToString());
         }
         if (row["s_Name"] != null)
         {
             model.s_Name = row["s_Name"].ToString();
         }
         if (row["s_Title"] != null)
         {
             model.s_Title = row["s_Title"].ToString();
         }
         if (row["s_Content"] != null)
         {
             model.s_Content = row["s_Content"].ToString();
         }
         if (row["s_Path"] != null)
         {
             model.s_Path = row["s_Path"].ToString();
         }
         if (row["s_Description"] != null)
         {
             model.s_Description = row["s_Description"].ToString();
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TRCode_RemindTemplate model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TRCode_RemindTemplate set ");
            strSql.Append("s_Name=@s_Name,");
            strSql.Append("s_Title=@s_Title,");
            strSql.Append("s_Content=@s_Content,");
            strSql.Append("s_Path=@s_Path,");
            strSql.Append("s_Description=@s_Description");
            strSql.Append(" where g_ID=@g_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Name",        SqlDbType.NVarChar,          100),
                new SqlParameter("@s_Title",       SqlDbType.NVarChar,          100),
                new SqlParameter("@s_Content",     SqlDbType.NVarChar,           -1),
                new SqlParameter("@s_Path",        SqlDbType.NVarChar,         1000),
                new SqlParameter("@s_Description", SqlDbType.NVarChar,         1000),
                new SqlParameter("@g_ID",          SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.s_Name;
            parameters[1].Value = model.s_Title;
            parameters[2].Value = model.s_Content;
            parameters[3].Value = model.s_Path;
            parameters[4].Value = model.s_Description;
            parameters[5].Value = model.g_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TRCode_RemindTemplate GetModel(Guid g_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 g_ID,s_Name,s_Title,s_Content,s_Path,s_Description from TRCode_RemindTemplate ");
            strSql.Append(" where g_ID=@g_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = g_ID;

            IPSP.Model.TRCode_RemindTemplate model = new IPSP.Model.TRCode_RemindTemplate();
            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.TRCode_RemindTemplate model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.TRCode_RemindTemplate model)
 {
     return(dal.Add(model));
 }