Transform Online Hours In Webshop Credits

Results 1 to 8 of 8
  1. #1
    Member mRpLaYbOy is offline
    MemberRank
    Jan 2012 Join Date
    RomaniaLocation
    95Posts

    information Transform Online Hours In Webshop Credits

    How to transform online hours in webshop credits?
    Help Please!


  2. #2
    Member mRpLaYbOy is offline
    MemberRank
    Jan 2012 Join Date
    RomaniaLocation
    95Posts

    Re: Transform Online Hours In Webshop Credits

    how to modify this code to get webshop credits?

    CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
    @memb___id varchar(10)
    AS
    Begin
    set nocount on
    Declare @find_id varchar(10)
    Declare @ConnectStat tinyint
    declare @OnlineHours real
    declare @cspoints int
    Set @ConnectStat = 0
    Set @find_id = 'NOT'
    select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id
    where I.memb___id = @memb___id
    if( @find_id <> 'NOT' )
    begin
    SELECT @cspoints= cs_points FROM MEMB_INFO where memb___id = @memb___id
    update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = @cspoints/10+(DATEDIFF(hh,ConnectTM,getdate()))
    where memb___id = @memb___id
    SELECT @OnlineHours =OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id

    UPDATE [dbo].[MEMB_INFO]
    SET cs_points=cs_points + (@OnlineHours * 10)
    WHERE memb___id = @memb___id

    end
    end
    GO

  3. #3
    Grand Master 2009x2014 is offline
    Grand MasterRank
    Dec 2009 Join Date
    2,765Posts

    Re: Transform Online Hours In Webshop Credits

    UPDATE [dbo].[MEMB_INFO]
    SET cs_points=cs_points + (@OnlineHours * 10)
    WHERE memb___id = @memb___id

    end
    end
    GO



    in this change name of table MEMB_INFO to table where you have stored credits row

    and change name of cs_points "SET cs_points=cs_points" to name of credits row

    so for example if your table name is Awesome and row of credits is Yeah

    script should be

    Code:
    CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
    @memb___id varchar(10)
    AS
    Begin
    set nocount on
    Declare @find_id varchar(10)
    Declare @ConnectStat tinyint
    declare @OnlineHours real
    declare @cspoints int
    Set @ConnectStat = 0
    Set @find_id = 'NOT'
    select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id
    where I.memb___id = @memb___id
    if( @find_id <> 'NOT' )
    begin
    SELECT @cspoints= cs_points FROM MEMB_INFO where memb___id = @memb___id
    update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = @cspoints/10+(DATEDIFF(hh,ConnectTM,getdate()))
    where memb___id = @memb___id
    SELECT @OnlineHours =OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id
    
    UPDATE [dbo].[Awesome]
    SET Yeah=Yeah + (@OnlineHours * 10)
    WHERE memb___id = @memb___id
    
    end
    end
    GO

    where OnlineHours * 10

    10 = number of credits for 1 hour

  4. #4
    Member mRpLaYbOy is offline
    MemberRank
    Jan 2012 Join Date
    RomaniaLocation
    95Posts

    Re: Transform Online Hours In Webshop Credits

    CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
    @memb___id varchar(10)
    AS
    Begin
    set nocount on
    Declare @find_id varchar(10)
    Declare @ConnectStat tinyint
    declare @OnlineHours real
    declare @cspoints int
    Set @ConnectStat = 0
    Set @find_id = 'NOT'
    select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id
    where I.memb___id = @memb___id
    if( @find_id <> 'NOT' )
    begin
    SELECT @cspoints= cs_points FROM MEMB_INFO where memb___id = @memb___id
    update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = @cspoints/10+(DATEDIFF(hh,ConnectTM,getdate()))
    where memb___id = @memb___id
    SELECT @OnlineHours =OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id


    UPDATE [dbo].[MEMB_CREDITS]
    SET credits=credits + (@OnlineHours * 2)
    WHERE memb___id = @memb___id

    end
    end
    GO
    ==>
    Server: Msg 446, Level 16, State 9, Procedure WZ_DISCONNECT_MEMB, Line 12
    Cannot resolve collation conflict for equal to operation.
    Help?:-s
    Last edited by mRpLaYbOy; 24-06-12 at 06:19 PM.

  5. #5
    Grand Master 2009x2014 is offline
    Grand MasterRank
    Dec 2009 Join Date
    2,765Posts

    Re: Transform Online Hours In Webshop Credits

    change names there too

    declare @cspoints int

    select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id

    SELECT @cspoints= cs_points FROM MEMB_INFO where memb___id = @memb___id

    update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = @cspoints/10+



    MEMB_INFO to ur credits table (MEMB_CREDITS)

    and cspoints to ur credits row (credits)

    and of course if in ur table MEMB_CREDITS accounts is different than memb___id change this line everywhere too

    but if you have memb___id in MEMB_CREDITS don't change this line ;p

    hope u get it

  6. #6
    Member mRpLaYbOy is offline
    MemberRank
    Jan 2012 Join Date
    RomaniaLocation
    95Posts

    Re: Transform Online Hours In Webshop Credits

    in memb_stat don`t work OnlineHours... How To Fix?

  7. #7
    Member mRpLaYbOy is offline
    MemberRank
    Jan 2012 Join Date
    RomaniaLocation
    95Posts

    Re: Transform Online Hours In Webshop Credits

    Up :-s

  8. #8
    Member mRpLaYbOy is offline
    MemberRank
    Jan 2012 Join Date
    RomaniaLocation
    95Posts

    Re: Transform Online Hours In Webshop Credits

    Up :(



Advertisement