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 int InsertActivatePIN(int consumerID, string Phone, string PIN, string ProviderName, string ResponseProvider, ref string error) { EventViewerLoggerDAL.LogError("InsertActivatePIN... ConsumerID: " + consumerID.ToString() + " , Phone: " + Phone + " , PIN: " + PIN + " , Response WS Claro: " + ResponseProvider); int result = -1; try { con.Cnn.Open(); result = con.Cnn.Query <int>("InsertActivatePin", new { ConsumerID = consumerID, Phone = Phone, PIN = PIN, ProviderName = ProviderName, ResponseProvider = ResponseProvider }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { result = -1; error = ex.Message; Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public PlayersTrackingEN GetProgressGameIsNotExistTracking(int consumerID, string LocationID, DateTime RegDate, ref string error) { PlayersTrackingEN result = new PlayersTrackingEN(); try { con.Cnn.Open(); result = con.Cnn.Query <PlayersTrackingEN>("SpGetProgressGameByConsumerIsNotExistTracking", new { ConsumerID = consumerID, LocationID = LocationID, RegDate = RegDate }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { Console.WriteLine("Error ExchangeCoinsDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); result = null; error = ex.Message; } finally { con.Cnn.Close(); } return(result); }
public AllLeaderBoards GetLeaderBoards() { AllLeaderBoards result = new AllLeaderBoards(); try { con.Cnn.Open(); using (var multi = con.Cnn.QueryMultiple("SP_GetLeaderBoards", commandType: CommandType.StoredProcedure)) { var ListLBToday = multi.Read <LeaderBoards>().ToList(); var ListLBWeek = multi.Read <LeaderBoards>().ToList(); var ListLBMonth = multi.Read <LeaderBoards>().ToList(); var ListLBOverAll = multi.Read <LeaderBoards>().ToList(); result.ListLeaderBoardsToday = ListLBToday; result.ListLeaderBoardsWeek = ListLBWeek; result.ListLeaderBoardsMonth = ListLBMonth; result.ListLeaderBoardsOverAll = ListLBOverAll; } } catch (Exception ex) { 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 LastWinnerLeaderBoards GetLastWinner() { LastWinnerLeaderBoards result = new LastWinnerLeaderBoards(); try { con.Cnn.Open(); using (var multi = con.Cnn.QueryMultiple("SP_GetLastWinnerLeaderBoards", commandType: CommandType.StoredProcedure)) { var LastWinnerLBYesterday = multi.Read <LeaderBoards>().FirstOrDefault(); var LastWinnerLBWeek = multi.Read <LeaderBoards>().FirstOrDefault(); var LastWinnerLBMonth = multi.Read <LeaderBoards>().FirstOrDefault(); result.LastWinnerOnYesterday = LastWinnerLBYesterday; result.LastWinnerOnWeek = LastWinnerLBWeek; result.LastWinnerOnMonth = LastWinnerLBMonth; } } catch (Exception ex) { Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public PlayersTrackingEN UpdatePlayerAge(int pConsumerID, int pAgeID) { PlayersTrackingEN playerTracking = new PlayersTrackingEN(); try { playerTracking = cnn.Cnn.Query <PlayersTrackingEN>("SpUpdatePlayerAge", new { ConsumerID = pConsumerID, AgeID = pAgeID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { playerTracking = null; Console.WriteLine("Error AgeDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { cnn.Cnn.Close(); } return(playerTracking); }
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 bool IsValidAppVersion(string VersionCode, string Platform, ref string error, ref string versionRequired) { bool result = false; try { Platform = Platform.ToLower(); con.Cnn.Open(); var resultSP = con.Cnn.Query <RecargoAppVersions>("SP_RecarGOAppVersionValid", new { Platform = Platform }, commandType: CommandType.StoredProcedure).FirstOrDefault(); if (resultSP != null) { decimal dbversionName = decimal.Parse(resultSP.VersionName); decimal pVersionName = decimal.Parse(VersionCode); if (dbversionName <= pVersionName) { result = true; } else { result = false; versionRequired = dbversionName.ToString(); } } else { result = false; } } catch (Exception ex) { result = false; error = ex.Message; Console.WriteLine("Error GameDAL: " + 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 List <LeaderBoards> GetLeaderBoardsMonth() { List <LeaderBoards> result = new List <LeaderBoards>(); try { result = Connection.Query <LeaderBoards>(@"select * from dbo.VLeaderBoardsMonth").ToList(); } catch (Exception ex) { Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); throw; } 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 LeaderBoards GetLastWinnerOnLastMonth() { LeaderBoards result = new LeaderBoards(); try { result = Connection.Query <LeaderBoards>(@"select * from dbo.VLastWinnerOnMonth").FirstOrDefault(); } catch (Exception ex) { Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); throw; } 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 List <LeaderBoards> GetLeaderBoardsToday() { List <LeaderBoards> result = new List <LeaderBoards>(); try { con.Cnn.Open(); result = con.Cnn.Query <LeaderBoards>(@"select * from dbo.VLeaderBoardsToday").ToList(); } catch (Exception ex) { Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public List <AgeImagesResponseEN> GetAgeImagesList(int AgeID, ref string error) { List <AgeImagesResponseEN> result = new List <AgeImagesResponseEN>(); try { cnn.Cnn.Open(); result = cnn.Cnn.Query <AgeImagesResponseEN>("SpGetAgeImages", new { @AgeID = AgeID }, commandType: CommandType.StoredProcedure).AsList(); } catch (Exception ex) { Console.WriteLine("Error AgeDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { cnn.Cnn.Close(); } return(result); }
public ChangeAgeEN GetAgeImages(int AgeID, int ConsumerID, ref string error) { ChangeAgeEN result = new ChangeAgeEN(); try { cnn.Cnn.Open(); result = cnn.Cnn.Query <ChangeAgeEN>("SpGetAgeByID", new { AgeID = AgeID, ConsumerID = ConsumerID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { Console.WriteLine("Error AgeDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { cnn.Cnn.Close(); } return(result); }
public LeaderBoards GetLastWinnerOnLastWeek() { LeaderBoards result = new LeaderBoards(); try { con.Cnn.Open(); result = con.Cnn.Query <LeaderBoards>(@"select * from dbo.VLastWinnerOnWeek").FirstOrDefault(); } catch (Exception ex) { 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); }
public List <AgeEN> GetAges() { List <AgeEN> agesList = new List <AgeEN>(); try { int AllAges = int.Parse(ConfigurationManager.AppSettings["ShowAllAges"].ToString()); cnn.Cnn.Open(); agesList = cnn.Cnn.Query <AgeEN>("SpGetAges", new { AllAges = AllAges }, commandType: CommandType.StoredProcedure).AsList(); } catch (Exception ex) { Console.WriteLine("Error AgeDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { cnn.Cnn.Close(); } return(agesList); }
public PlayersTrackingEN GetProgressGame(int consumerID, ref string error) { PlayersTrackingEN result = new PlayersTrackingEN(); try { con.Cnn.Open(); result = 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 WinCoinEN Exist(int consumerID, string locationID, DateTime regDate, ref string error) { WinCoinEN result = new WinCoinEN(); try { con.Cnn.Open(); result = con.Cnn.Query <WinCoinEN>("SpExistLocationByConsumerAndDate", new { @ConsumerID = consumerID, @LocationID = locationID, @RegDate = regDate }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { EventViewerLoggerDAL.LogError(ex.Message); result = null; } finally { con.Cnn.Close(); } return(result); }
public WinPrizeEN IsAvailableWinPrize(int consumerID, ref string error) { WinPrizeEN result = new WinPrizeEN(); try { con.Cnn.Open(); result = con.Cnn.Query <WinPrizeEN>("GetPrizeByConsumerID", new { @ConsumerID = consumerID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { Console.WriteLine("Error WinPrizeDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }
public List <ComboSouvenirEN> GetCombosByConsumerIDAndAge(int consumerID, ref string error) { List <ComboSouvenirEN> result = new List <ComboSouvenirEN>(); try { con.Cnn.Open(); result = con.Cnn.Query <ComboSouvenirEN>("SPGetComboByConsumerID", new { ConsumerID = consumerID }, commandType: CommandType.StoredProcedure).ToList(); } catch (Exception ex) { error = ex.Message; Console.WriteLine("Error GameDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { con.Cnn.Close(); } return(result); }