Пример #1
0
        /// <summary>
        /// 添加配置信息
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public static bool InsertServiceCodeSourceConfig(SqlConnection conn, ServiceCodeSourceConfig config)
        {
            const string sql = @"
			INSERT INTO Tuhu_thirdparty..ServiceCodeSourceConfig
					( SourceName ,
					    Source ,
					    SourceRegex ,
					    Remarks ,
					    CreatedTime ,
					    UpdatedTime
					)
			VALUES  ( @SourceName ,
					    @Source ,
					    @SourceRegex ,
					    @Remarks ,
					    GETDATE() , 
					    GETDATE() 
					)"                    ;

            return(conn.Execute(sql, new
            {
                config.Source,
                config.SourceName,
                config.SourceRegex,
                config.Remarks
            }, commandType: CommandType.Text) > 0);
        }
Пример #2
0
        /// <summary>
        /// 更新配置信息
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public static bool UpdateServiceCodeSourceConfig(SqlConnection conn, ServiceCodeSourceConfig config)
        {
            const string sql = @"
            UPDATE  Tuhu_thirdparty..ServiceCodeSourceConfig
            SET     SourceName = @SourceName ,
                    SourceRegex = @SourceRegex ,
                    Remarks = @Remarks ,
                    UpdatedTime = GETDATE()
            WHERE   PKID = @PKID";

            return(conn.Execute(sql, new
            {
                config.PKID,
                config.SourceName,
                config.SourceRegex,
                config.Remarks
            }, commandType: CommandType.Text) > 0);
        }