public WinPrizeEN ProcessToWinPrizeWildcard(int consumerID, string LocationID, int AgeID, ref string error) { WinPrizeEN result = new WinPrizeEN(); AchievementEN achievementEN = new AchievementEN(); try { con.Cnn.Open(); result = con.Cnn.Query <WinPrizeEN>("SpProcessToWinPrizeWildcard", new { ConsumerID = consumerID, LocationID = LocationID, AgeID = AgeID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); result.tracking = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumer", new { @ConsumerID = consumerID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { error = ex.Message; Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public AchievementEN ProcessToWinAchievement(int consumerID, int Value, int TotalWinCoins, int AchievementID, SqlTransaction transaction) { try { AchievementEN achievement = new AchievementEN(); var p = new DynamicParameters(); p.Add("AchievementID", AchievementID); p.Add("ConsumerID", consumerID); p.Add("Value", Value); p.Add("CurrentCoinsProgress", 20); p.Add("TotalWinCoins", TotalWinCoins); achievement = con.Cnn.Query <AchievementEN>("SpProcessToWinAchievement", p, transaction, commandType: CommandType.StoredProcedure).FirstOrDefault(); return(achievement); } catch (Exception ex) { EventViewerLoggerDAL.LogError("GameDAL... SpProcessToWinAchievement - Error: " + ex.StackTrace); throw; } }
public AchievementEN SaveData(int consumerID, string locationID, decimal Longitude, decimal Latitude, DateTime regDate, int ChestType, int ExchangeCoins, int TotalWinCoins, int CurrentCoinsProgress, int TotalWinPrizes, ref string error, int AgeID) { AchievementEN result = new AchievementEN(); try { con.Cnn.Open(); con.Tra = con.Cnn.BeginTransaction(); result = con.Cnn.Query <AchievementEN>("SpSaveExchangeCoinsAndProgressGame", new { @ConsumerID = consumerID, @LocationID = locationID, @Longitude = Longitude, @Latitude = Latitude, @RegDate = regDate, @ChestType = ChestType, @ExchangeCoins = ExchangeCoins, @TotalWinCoins = TotalWinCoins, @CurrentCoinsProgress = CurrentCoinsProgress, @TotalWinPrizes = TotalWinPrizes, @AgeID = AgeID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (result.Code == "00") { result = ProcessToWinAchievement(consumerID, ExchangeCoins, TotalWinCoins, 1, con.Tra); result.Tracking = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumer", new { @ConsumerID = consumerID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); } con.Tra.Commit(); } catch (Exception ex) { con.Tra.Rollback(); Console.WriteLine("Error ExchangeCoinsDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public ShopPurchaseEN PurchaseAndGetSouvenir(int consumerID, int StoreId, ref string error, int LevelBarrel1, int LevelBarrel2) { ShopPurchaseEN result = new ShopPurchaseEN(); AchievementEN achievement = new AchievementEN(); try { con.Cnn.Open(); con.Tra = con.Cnn.BeginTransaction(); result = con.Cnn.Query <ShopPurchaseEN>("SpPurchaseStore", new { ConsumerID = consumerID, StoreId = StoreId, LevelBarrel1 = LevelBarrel1, LevelBarrel2 = LevelBarrel2 }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (result.Code == "00") { result.tracking = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumer", new { @ConsumerID = consumerID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); int TotalWinCoins = result.tracking.TotalWinCoins; result.Achievement = ProcessToWinAchievement(consumerID, 1, TotalWinCoins, 7, con.Tra); } con.Tra.Commit(); } catch (Exception ex) { con.Tra.Rollback(); Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); error = ex.StackTrace; result = null; } finally { con.Cnn.Close(); } return(result); }
public WinPrizeEN ProcessToExchangeSouvenirByPrize(int consumerID, int SouvenirID, int CountryID, ref string error) { WinPrizeEN result = new WinPrizeEN(); AchievementEN achievement = new AchievementEN(); int TotalWinCoins = 0; try { con.Cnn.Open(); con.Tra = con.Cnn.BeginTransaction(); result = con.Cnn.Query <WinPrizeEN>("SpExchangeSouvenirByPrize", new { ConsumerID = consumerID, SouvenirID = SouvenirID, CountryID = CountryID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (result.ResponseCode == "04") { result = con.Cnn.Query <WinPrizeEN>("SpExchangeSouvenirByPrize", new { ConsumerID = consumerID, SouvenirID = SouvenirID, CountryID = CountryID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); } result.tracking = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumer", new { @ConsumerID = consumerID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); TotalWinCoins = result.tracking.TotalWinCoins; result.Achievement = ProcessToWinAchievement(consumerID, 1, TotalWinCoins, 8, con.Tra); con.Tra.Commit(); } catch (Exception ex) { con.Tra.Rollback(); error = ex.Message; Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public WinPrizeEN ProcessToWinPrize(int consumerID, int CountryID, ref string error) { WinPrizeEN result = new WinPrizeEN(); AchievementEN achievementEN = new AchievementEN(); try { con.Cnn.Open(); con.Tra = con.Cnn.BeginTransaction(); result = con.Cnn.Query <WinPrizeEN>("SpProcessToWinPrize", new { ConsumerID = consumerID, CountryID = CountryID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (result.ResponseCode == "04") { result = con.Cnn.Query <WinPrizeEN>("SpProcessToWinPrize", new { ConsumerID = consumerID, CountryID = CountryID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (result.ResponseCode == "00") { result.Achievement = ProcessToWinAchievement(consumerID, 1, result.TotalWinCoins, 8, con.Tra); } } else if (result.ResponseCode == "00") { result.Achievement = ProcessToWinAchievement(consumerID, 1, result.TotalWinCoins, 8, con.Tra); } con.Tra.Commit(); } catch (Exception ex) { con.Tra.Rollback(); result.Code = "500"; error = ex.Message; Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public AchievementEN SaveCoinsWildCard(int consumerID, string locationID, decimal Longitude, decimal Latitude, DateTime regDate, int ExchangeCoins, int TotalWinCoins, int CurrentCoinsProgress, int TotalWinPrizes, ref string error, int AgeID) { AchievementEN result = new AchievementEN(); try { con.Cnn.Open(); result = con.Cnn.Query <AchievementEN>("SpSaveCoinsWildCard", new { @ConsumerID = consumerID, @LocationID = locationID, @Longitude = Longitude, @Latitude = Latitude, @RegDate = regDate, @ExchangeCoins = ExchangeCoins, @TotalWinCoins = TotalWinCoins, @CurrentCoinsProgress = CurrentCoinsProgress, @TotalWinPrizes = TotalWinPrizes, @AgeID = AgeID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); result.Tracking = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumer", new { @ConsumerID = consumerID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { Console.WriteLine("Error ExchangeCoinsDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public SouvenirEN SpSaveSouvenirAndProgressGame(int consumerID, string locationID, decimal Longitude, decimal Latitude, DateTime regDate, int ChestType, ref string error, int AgeID, int Level, int TotalWinCoins) { SouvenirEN result = new SouvenirEN(); AchievementEN achievementEN = new AchievementEN(); GameDAL gameDal = new GameDAL(); try { con.Cnn.Open(); con.Tra = con.Cnn.BeginTransaction(); result = con.Cnn.Query <SouvenirEN>("SpSaveSouvenirAndProgressGame", new { ConsumerID = consumerID, LocationID = locationID, Longitude = Longitude, Latitude = Latitude, RegDate = regDate, ChestType = ChestType, AgeID = AgeID, Level = Level, TotalWinCoins = TotalWinCoins }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (result.Code == "00") { result.Achievement = ProcessToWinAchievement(consumerID, 1, TotalWinCoins, 7, con.Tra); } result.tracking = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumer", new { @ConsumerID = consumerID }, con.Tra, commandType: CommandType.StoredProcedure).FirstOrDefault(); con.Tra.Commit(); } catch (Exception ex) { con.Tra.Rollback(); Console.WriteLine("Error ExchangeCoinsDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }