Example #1
0
        /// <summary>
        /// 插入下载日志
        /// </summary>
        /// <param name="model"></param>
        public static void InsertLog(AttachmentDownloadLogInfo model) {
            string strSQL = @"DECLARE @C AS INT;
SELECT @C = COUNT(*) FROM AttachmentDownloadLog WITH(NOLOCK) WHERE AttachId = @AttachId AND UserId = @UserId
IF(@C =0)
	BEGIN
		INSERT INTO AttachmentDownloadLog(AttachId,UserId,UserName,DownloadCount,LastDownloadDateTime) VALUES(@AttachId,@UserId,@UserName,1,GETDATE());
	END
ElSE
	BEGIN
		UPDATE AttachmentDownloadLog SET DownloadCount = DownloadCount+1 ,LastDownloadDateTime = GETDATE() WHERE AttachId = @AttachId AND UserId = @UserId;
	END";
            SqlParameter[] param = { 
                                    new SqlParameter("Id",SqlDbType.Int),
                                    new SqlParameter("AttachId",SqlDbType.Int),
                                    new SqlParameter("UserId",SqlDbType.Int),
                                    new SqlParameter("UserName",SqlDbType.NVarChar)
                                   };
            param[0].Value = model.Id;
            param[1].Value = model.AttachId;
            param[2].Value = model.UserId;
            param[3].Value = model.UserName;
            Goodspeed.Library.Data.SQLPlus.ExecuteNonQuery(CommandType.Text,strSQL,param);
        }
Example #2
0
 /// <summary>
 /// 插入下载日志
 /// </summary>
 /// <param name="model"></param>
 public static void InsertLog(AttachmentDownloadLogInfo model) {
     AttachmentManage.InsertLog(model);
 }