搜索
 找回密码
 加入

租赁有关的存储

ctgwglzc 2010-10-28 16:15:24 1484
  1. /****** Object:  Stored Procedure dbo.RENTAL_ITEM_REGISTER    Script Date: 6/6/2006 6:03:34 PM ******/


  2. CREATE PROCEDURE RENTAL_ITEM_REGISTER
  3. @charID                char(21),       
  4. @AccountID        char(21),
  5. @sRentalTime        smallint,
  6. @nItemID        int,
  7. @sDurability        smallint,
  8. @nMoney                int,
  9. @bGameBangType        tinyint,
  10. @bItemType        tinyint,
  11. @bItemClass        tinyint,
  12. @nSerialNumber         bigint,
  13. @nRet_Index           int OUTPUT,
  14. @nRet                smallint OUTPUT

  15. AS

  16. DECLARE @Row tinyint, @nRentalIndex int
  17. DECLARE @timeRegister smalldatetime
  18. SET @Row = 0
  19. SET @nRet_Index  = -1
  20. SET @timeRegister = getdate()

  21. ---------------------------------------
  22. --SET @nRet =  -9
  23. --RETURN


  24. SELECT @Row = COUNT(*) FROM RENTAL_ITEM WHERE nItemIndex = @nItemID and strLenderAcID = @AccountID
  25. IF @Row > 0
  26. BEGIN
  27.         SET @nRet =  -9
  28.         RETURN
  29. END

  30. BEGIN TRAN       

  31.         INSERT INTO
  32.         RENTAL_ITEM ( nItemIndex, sDurability, nSerialNumber, byRegType, byItemType, byClass, sRentalTime, nRentalMoney, strLenderCharID, strLenderAcID )
  33.         VALUES         (@nItemID, @sDurability, @nSerialNumber, @bGameBangType, @bItemType, @bItemClass, @sRentalTime, @nMoney, @charID, @AccountID )
  34.        
  35.         IF @@ERROR <> 0
  36.         BEGIN         
  37.                 ROLLBACK TRAN
  38.                 SET @nRet =  -16
  39.                 RETURN
  40.         END

  41.         SELECT @nRentalIndex = nRentalIndex FROM RENTAL_ITEM WHERE nItemIndex = @nItemID and strLenderAcID = @AccountID

  42. --         &#51076;&#45824;&#51088;&#51221;&#48372;&#50640; &#52628;&#44032;(&#46321;&#47197;)
  43.         INSERT INTO
  44.         USER_RENTAL_ITEM ( strUserID, strAccountID, byRentalType, byRegType, nRentalIndex, nItemIndex, sDurability, nSerialNumber, nRentalMoney, sRentalTime, sDuringTime, timeRegister )
  45.         VALUES                 ( @charID,   @AccountID,   1,           @bGameBangType, @nRentalIndex, @nItemID, @sDurability, @nSerialNumber, @nMoney,  @sRentalTime, @sRentalTime, @timeRegister )

  46.         IF @@ERROR <> 0
  47.         BEGIN         
  48.                 ROLLBACK TRAN
  49.                 SET @nRet =  -17
  50.                 RETURN
  51.         END

  52. --        SELECT @nRentalIndex = nRentalIndex FROM RENTAL_ITEM WHERE nItemIndex = @nItemID and strLenderAcID = @AccountID
  53.         SET @nRet_Index  = @nRentalIndex

  54. COMMIT TRAN
  55. SET @nRet =  1
  56. GO
复制代码
  1. /****** Object:  Stored Procedure dbo.RENTAL_ITEM_CANCEL    Script Date: 6/6/2006 6:03:33 PM ******/


  2. -- 2004.03.26. sungyong

  3. CREATE PROCEDURE RENTAL_ITEM_CANCEL
  4. @AccountID        char(21),                --     &#46321;&#47197;&#51088; &#44228;&#51221;
  5. @CharID        char(21),                        --     &#46321;&#47197;&#51088; &#52880;&#47533; &#50500;&#51060;&#46356;
  6. @nRentalIndex  int,
  7. @nItemNumber   int,
  8. @nRet                smallint OUTPUT

  9. AS

  10. --SET @Row = 0

  11. -- rentallist &#49325;&#51228;
  12. DELETE FROM RENTAL_ITEM WHERE nRentalIndex = @nRentalIndex and nItemIndex = @nItemNumber

  13. -- &#51076;&#45824;&#51088;&#51221;&#48372;&#50640; &#45824;&#50668;&#51221;&#48372; &#49325;&#51228;
  14. DELETE FROM USER_RENTAL_ITEM WHERE nRentalIndex = @nRentalIndex and nItemIndex = @nItemNumber

  15. SET @nRet =  1



  16. GO
复制代码

9 回复

ctgwglzc
2010-1-18 01:25:04
楼主
点击查看详情
  1. /****** Object:  Stored Procedure dbo.RENTAL_ITEM_DESTORY    Script Date: 6/6/2006 6:03:33 PM ******/


  2. -- 2004.03.26. sungyong

  3. CREATE PROCEDURE RENTAL_ITEM_DESTORY
  4. @AccountID        char(21),       
  5. @CharID        char(21),               
  6. @nItemNumber   int,
  7. @nRentalIndex   int,
  8. @nDurability        smallint,
  9. @nRet                smallint OUTPUT

  10. AS

  11. DELETE FROM USER_RENTAL_ITEM WHERE strAccountID = @AccountID and nItemIndex = @nItemNumber

  12. EXEC RENTAL_ITEM_DURABILITY_UPDATE @nRentalIndex, @nDurability

  13. SET @nRet =  1



  14. GO
复制代码
  1. /****** Object:  Stored Procedure dbo.RENTAL_ITEM_DURABILITY_UPDATE    Script Date: 6/6/2006 6:03:34 PM ******/



  2. -- 2004.04.22. sungyong
  3. CREATE PROCEDURE RENTAL_ITEM_DURABILITY_UPDATE
  4. @nRentalIndex  int,
  5. @nDurability   int

  6. AS

  7. DECLARE @Row tinyint
  8. DECLARE @LendercharID char(21), @LenderAccountID char(21)

  9. SET @Row = 0

  10. SELECT @LendercharID = strLenderCharID, @LenderAccountID = strLenderAcID
  11. FROM RENTAL_ITEM_LIST
  12. WHERE nRentalIndex = @nRentalIndex

  13. -- &#51076;&#45824;&#51088;&#51221;&#48372;&#50640; &#45236;&#44396;&#47141; &#50629;&#45936;&#51060;&#53944;
  14. UPDATE USER_RENTAL_ITEM
  15. SET sDurability = @nDurability
  16. WHERE strAccountID = @LenderAccountID and nRentalIndex = @nRentalIndex



  17. GO
复制代码
  1. /****** Object:  Stored Procedure dbo.RENTAL_ITEM_LEND    Script Date: 6/6/2006 6:03:34 PM ******/


  2. -- 2004.03.26. sungyong
  3. CREATE PROCEDURE RENTAL_ITEM_LEND
  4. @AccountID        char(21),                --     &#45824;&#50668;&#51088; &#44228;&#51221;
  5. @CharID        char(21),                --     &#45824;&#50668;&#51088; &#52880;&#47533; &#50500;&#51060;&#46356;
  6. @nRentalIndex  int,
  7. @nItemNumber   int,
  8. @nRet                smallint OUTPUT

  9. AS
  10. SET @nRet =  -5
  11. RETURN

  12. DECLARE @Row tinyint, @sDurability smallint, @nSerialNumber bigint
  13. DECLARE @bItemType tinyint, @bItemClass tinyint, @sRentalTime smallint, @nMoney int, @LendercharID char(21), @LenderAccountID char(21)
  14. DECLARE @timeLend smalldatetime, @timeRegister smalldatetime
  15. SET @Row = 0
  16. SET @timeLend = getdate()

  17. SELECT @sDurability=sDurability, @nSerialNumber=nSerialNumber, @bItemType=byItemType, @bItemClass=byClass,
  18.        @sRentalTime=sRentalTime, @nMoney=nRentalMoney, @LendercharID=strLenderCharID, @LenderAccountID=strLenderAcID, @timeRegister=timeRegister
  19. FROM RENTAL_ITEM
  20. WHERE nRentalIndex = @nRentalIndex and nItemIndex = @nItemNumber

  21. IF @bItemType = 0
  22. BEGIN
  23.         SET @nRet =  -5
  24.         RETURN
  25. END

  26. -- list&#50640; &#51077;&#47141;
  27. INSERT INTO
  28. RENTAL_ITEM_LIST ( nRentalIndex, nItemIndex, sDurability, nSerialNumber, byItemType, byClass, sRentalTime, nRentalMoney, strLenderCharID, strLenderAcID, strBorrowerCharID, strBorrowerAcID, timeLender, timeRegister )
  29. VALUES         (@nRentalIndex, @nItemNumber, @sDurability, @nSerialNumber, @bItemType, @bItemClass, @sRentalTime, @nMoney, @LendercharID, @LenderAccountID, @CharID, @AccountID, @timeLend, @timeLend )

  30. -- rentallist &#49325;&#51228;
  31. DELETE FROM RENTAL_ITEM WHERE nRentalIndex = @nRentalIndex and nItemIndex = @nItemNumber

  32. -- &#45824;&#50668;&#51088;&#51221;&#48372;&#50640; &#52628;&#44032;
  33. INSERT INTO
  34. USER_RENTAL_ITEM ( strUserID, strAccountID, byRentalType, nRentalIndex, nItemIndex, sDurability, nSerialNumber, nRentalMoney, sRentalTime, sDuringTime, timeRental, timeRegister )
  35. VALUES                 ( @CharID,   @AccountID,   3,           @nRentalIndex, @nItemNumber, @sDurability, @nSerialNumber, 0,               @sRentalTime, @sRentalTime, @timeLend, @timeRegister )

  36. -- &#51076;&#45824;&#51088;&#51221;&#48372;&#50640; &#45824;&#50668;&#51221;&#48372; &#52628;&#44032;
  37. UPDATE USER_RENTAL_ITEM
  38. SET byRentalType=2, nRentalMoney = @nMoney, timeRental = @timeLend
  39. WHERE strAccountID = @LenderAccountID and nRentalIndex = @nRentalIndex

  40. SET @nRet =  1

  41. GO
复制代码
leonjaykai
2010-1-18 08:53:15
請問 ct 是把這5個存儲copy進去就可以了嗎??
28085279
2010-1-18 12:27:12
关闭和开启怎么改
v123
2010-1-18 18:54:24
关闭和开启怎么改
28085279 发表于 2010-1-18 04:27


我也想知道~~
jianweis
2010-1-19 12:32:06
关闭和开启怎么改"
duepbbmal336
2010-1-19 19:21:06
1# ctgwglzc


谢谢楼主
这个还从来没用过,国服用过不过自己的单机没搞过
tdss
2010-1-30 01:34:39
好像2.0没有租凭了是伐??
duepbbmal336
2010-1-30 18:57:41
8# tdss


不会吧2.0没有这个?
lvevl
2010-10-28 16:15:24
提示: 作者被禁止或删除 内容自动屏蔽
高级模式
游客