Exemple #1
0
        public bool ModifyFund(int gameId, int roomId, long value1)
        {
            try
            {
                string gameName = string.Empty;
                string query    = string.Empty;

                switch (gameId)
                {
                case 1:
                    gameName = "Nông trại";
                    query   += "declare @_fund bigint\n";
                    query   += $"update [eBankGame.SlotDiamondDB].[dbo].[RoomFunds] set @_fund = PrizeFund -= {value1} where RoomID = {roomId}";
                    break;

                case 2:
                    gameName = "Mafia";
                    query   += "declare @_fund bigint\n";
                    query   += $"update [eBankGame.SlotIslandsDB].[dbo].[RoomFunds] set @_fund = PrizeFund -= {value1} where RoomID = {roomId}";
                    break;

                case 3:
                    gameName = "Hải vương";
                    query   += "declare @_fund int\n";
                    query   += $"update [Slot.25Lines].[dbo].[RoomFund] set @_fund = PrizeFund -= {value1} where RoomID = {roomId}";
                    break;

                case 4:
                    gameName = "Vua bão";
                    query   += "declare @_fund bigint\n";
                    query   += $"update [eBankGame.SlotsGodDB].[dbo].[RoomFunds] set @_fund = PrizeFund -= {value1} where RoomID = {roomId}";
                    break;

                case 6:
                    gameName = "Minipoker";
                    query   += "declare @_fund bigint\n";
                    query   += $"update [CardGame.MiniPokerDB].[dbo].[Funds] set @_fund = PrizeFund -= {value1} where RoomID = {roomId} and BetType = 1";
                    break;

                case 7:
                    gameName = "Cao thấp";
                    query   += "declare @_fund bigint\n";
                    query   += $"update [MiniGame.Hilo].[dbo].[Funds] set @_fund = PrizeFund -= {value1} where RoomID = {roomId} and BetType = 1";
                    break;
                    //case 8:
                    //    gameName = "Bầu cua";
                    //    query += "declare @_fund bigint\n";
                    //    query += $"update [HooHeyHow].[dbo].[GoldFund] set @_fund = Fund -= {value1}";
                    //    break;
                    //case 9:
                    //    gameName = "Xóc xóc";
                    //    query += "declare @_fund bigint\n";
                    //    query += $"update [CardGame].[dbo].[DiskShaking.GoldFund] set @_fund = Fund -= {value1}";
                    //    break;
                }
                query += "\nselect @_fund response";
                var newFund = Convert.ToInt64(GameDAO.ExecuteQueryWithResultRootDb(query).FirstOrDefault().response);
                GameDAO.AddEditFundLog(UserContext.UserInfo.FullName, gameName, value1, newFund, roomId);
                GameDAO.UpdateMinusGameFund(value1, 2);
                return(true);
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return(false);
        }