public PlayersController() { _entities = new KSULaxEntities(); _playerBL = new PlayerBL(_entities); _gameBL = new GameBL(_entities); _awardBL = new AwardBL(_entities); }
public MainWindowVM(User user) { OnPropertyChanged(nameof(Users)); OnPropertyChanged(nameof(OnlineUsers)); OnPropertyChanged(nameof(Invitations)); userBl = UserBL.Instance; chatBl = ChatBL.Instance; gameBl = GameBL.Instance; _guiDispatcher = Dispatcher.CurrentDispatcher; userBl.OnLoggedIn += OnUserLoggedIn; userBl.OnLoggedOut += OnUserLoggedOut; userBl.OnRoomOpen += OnChatRoomOpen; gameBl.OnGameInvitation += OnGameInvitation; GetAllUsers(user); UserWelcome = $"Welcome {user.Name}"; StartChatCommand = new CommandExecuter(StartChat, () => { return SelectedUser != null; }); InviteToGameCommand = new CommandExecuter(InviteToGame, () => { return SelectedUser != null; }); Invitations = new ObservableCollection<Invitation>(); }
public IResponse SuccessActivatePrizeResponse(int ConsumerID, string Phone, string PIN, ref string error) { ActivatePrizeResponse response = new ActivatePrizeResponse(); GameBL gameBl = new GameBL(); string result = ""; try { ClaroClient client = new ClaroClient(); result = client.ActivatePin(ConsumerID, Phone, PIN, ref error); YoVendoRecargaAPI.BL.EventViewerLoggerBL.LogInformation("Response Web service Claro: " + result); var insertProcess = gameBl.InsertActivatePIN(ConsumerID, Phone, PIN, "Claro El Salvador", result, ref error); response.Code = (result == "0") ? "00" : result; response.Message = "Success"; } catch (Exception ex) { error = ex.Message; result = ""; } return(response); }
public Invitation(string sender, string room) { Room = room; gameBl = GameBL.Instance; Sender = sender; _guiDispatcher = Dispatcher.CurrentDispatcher; AcceptInvitationCommand = new CommandExecuter(Accept, () => { return(true); }); DenyInvitationCommand = new CommandExecuter(Deny, () => { return(true); }); }
public GameVM(string roomID) { _room = roomID; gameBl = GameBL.Instance; _guiDispatcher = Dispatcher.CurrentDispatcher; Dice = new int[2]; _checkerSelection = -1; RollDiceCommand = new CommandExecuter(RollDice, () => { return(TurnStatus == TurnStatus.RollDice && CurrentTurn); }); ChooseCheckerCommand = new ChooseCommand((place) => ChooseChecker(place)); gameBl.OnStartGame += OnStartGame; gameBl.OnDenyInitation += OnDenyInvitation; gameBl.OnGetPlayerColor += OnGetColor; gameBl.OnCurrentTurn += OnCurrentTurn; gameBl.OnGetPlayerName += OnGetPlayerName; gameBl.OnTurnStatusChange += OnChangeStatus; gameBl.OnBoardUpdate += UpdateBoard; gameBl.OnDiceResult += OnDiceResult; gameBl.OnGameOver += GameOver; gameBl.OnGameClosed += OnGameClosed; }
public HttpResponseMessage Post(HttpRequestMessage request) { PersonBL ConsumerAuth = new PersonBL(); GenericApiResponse response = new GenericApiResponse(); GameBL gameBL = new GameBL(); string error = ""; try { IEnumerable <string> AppVersion = null; request.Headers.TryGetValues("AppVersion", out AppVersion); IEnumerable <string> Platform = null; request.Headers.TryGetValues("Platform", out Platform); bool ApplyValidation = bool.Parse(ConfigurationManager.AppSettings["ApplyValidationAppVersion"].ToString()); if (ApplyValidation == false || (AppVersion != null && Platform != null)) { string versionRequired = ""; var isValidVersion = (ApplyValidation == false) ? true : gameBL.IsValidAppVersion(AppVersion.FirstOrDefault(), Platform.FirstOrDefault(), ref error, ref versionRequired); if (isValidVersion) { IEnumerable <string> key = null; request.Headers.TryGetValues("authenticationKey", out key); var consumerFb = ConsumerAuth.authenticateConsumer(key.FirstOrDefault().ToString()); if (consumerFb != null) { var process = gameBL.ProcessToValidateAndWinPrize(consumerFb.ConsumerID, consumerFb.CountryID, ref error); if (error == "" && (process.ResponseCode == "00" || process.ResponseCode == "02")) { WinPrizeInteractor interactor = new WinPrizeInteractor(); var responseSuccess = interactor.createWinPrizeResultsResponse(process, error); return(Request.CreateResponse <IResponse>(HttpStatusCode.OK, responseSuccess)); } else { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } } else { response.HttpCode = 404; response.Message = "Facebook information not found"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } else { response.HttpCode = 426; response.InternalCode = versionRequired; response.Message = "Upgrade required"; return(Request.CreateResponse <IResponse>(HttpStatusCode.UpgradeRequired, response)); } } else { response.HttpCode = 404; response.Message = "Version or Platform parameter can not be null"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } catch (Exception en) { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } }
public HttpResponseMessage ActivatePrize(HttpRequestMessage request, [FromBody] ActivatePrizeRequest data) { PersonBL ConsumerAuth = new PersonBL(); GenericApiResponse response = new GenericApiResponse(); GameBL gameBL = new GameBL(); string error = ""; try { IEnumerable <string> AppVersion = null; request.Headers.TryGetValues("AppVersion", out AppVersion); IEnumerable <string> Platform = null; request.Headers.TryGetValues("Platform", out Platform); bool ApplyValidation = bool.Parse(ConfigurationManager.AppSettings["ApplyValidationAppVersion"].ToString()); if (ApplyValidation == false || (AppVersion != null && Platform != null)) { string versionRequired = ""; var isValidVersion = (ApplyValidation == false) ? true : gameBL.IsValidAppVersion(AppVersion.FirstOrDefault(), Platform.FirstOrDefault(), ref error, ref versionRequired); if (isValidVersion) { if (String.IsNullOrEmpty(data.Phone) || String.IsNullOrEmpty(data.PIN)) { string errorMessage = (String.IsNullOrEmpty(data.Phone)) ? "Phone can not be empty" : "PIN can not be empty"; response.HttpCode = 404; response.Message = errorMessage; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } else { IEnumerable <string> key = null; request.Headers.TryGetValues("authenticationKey", out key); var consumerFb = ConsumerAuth.authenticateConsumer(key.FirstOrDefault().ToString()); if (consumerFb != null) { ActivatePrizeInteractor interactor = new ActivatePrizeInteractor(); var responseSuccess = interactor.SuccessActivatePrizeResponse(consumerFb.ConsumerID, data.Phone, data.PIN, ref error); return(Request.CreateResponse <IResponse>(HttpStatusCode.OK, responseSuccess)); } else { response.HttpCode = 404; response.Message = "Facebook information not found"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } } else { response.HttpCode = 426; response.InternalCode = versionRequired; response.Message = "Upgrade required"; return(Request.CreateResponse <IResponse>(HttpStatusCode.UpgradeRequired, response)); } } else { response.HttpCode = 404; response.Message = "Version or Platform parameter can not be null"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } catch (Exception en) { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } }
public HttpResponseMessage Post(HttpRequestMessage request, [FromBody] ExchangeDataRequest data) { int type = 0; GenericApiResponse response = new GenericApiResponse(); GameBL gameBL = new GameBL(); PersonBL ConsumerAuth = new PersonBL(); ExchangeCoinsBL exchangeBL = new ExchangeCoinsBL(); int coins = 0; string error = ""; string code = ""; Random random = new Random(); try { IEnumerable <string> AppVersion = null; request.Headers.TryGetValues("AppVersion", out AppVersion); IEnumerable <string> Platform = null; request.Headers.TryGetValues("Platform", out Platform); bool ApplyValidation = bool.Parse(ConfigurationManager.AppSettings["ApplyValidationAppVersion"].ToString()); if (ApplyValidation == false || (AppVersion != null && Platform != null)) { string versionRequired = ""; var isValidVersion = (ApplyValidation == false) ? true : gameBL.IsValidAppVersion(AppVersion.FirstOrDefault(), Platform.FirstOrDefault(), ref error, ref versionRequired); if (isValidVersion) { if (string.IsNullOrEmpty(data.LocationID) && (data.ChestType == 0 || data.ChestType == 0)) { response.HttpCode = 400; response.Message = "LocationID or ChestType cannot be empty"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } else { IEnumerable <string> key = null; request.Headers.TryGetValues("authenticationKey", out key); var consumerFb = ConsumerAuth.authenticateConsumer(key.FirstOrDefault().ToString()); if (consumerFb != null) { string RandomCoinsOrSouvenir = ConfigurationManager.AppSettings["RandomCoinOrSouvenir"].ToString(); var range = RandomCoinsOrSouvenir.Split(','); int minValue = int.Parse(range[0]); int maxValue = int.Parse(range[1]); int RandomResult = random.Next(minValue, maxValue); if (RandomResult <= 9) { type = 1; } else { type = 2; } if (type == 1) { var result = exchangeBL.ProcessExchangeCoins(data.LocationID, data.Longitude, data.Latitude, data.ChestType, consumerFb.ConsumerID, ref coins, data.AgeID); if (error == "") { ExchangeCoinsInteractor interactor = new ExchangeCoinsInteractor(); var responseSuccess = interactor.createExchangeCoinsResultsResponse(result, coins); return(Request.CreateResponse <IResponse>(HttpStatusCode.OK, responseSuccess)); } else { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } } else { var result = exchangeBL.ProcessExchangeSouvenir(data.LocationID, data.Longitude, data.Latitude, data.ChestType, consumerFb.ConsumerID, ref error, data.AgeID); ExchangeCoinsInteractor interactor = new ExchangeCoinsInteractor(); var responseSuccess = interactor.createExchangeSouvewnorResultsResponse(result, error); return(Request.CreateResponse <IResponse>(HttpStatusCode.OK, responseSuccess)); } } else { response.HttpCode = 404; response.Message = "Facebook information not found"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } } else { response.HttpCode = 426; response.InternalCode = versionRequired; response.Message = "Upgrade required"; return(Request.CreateResponse <IResponse>(HttpStatusCode.UpgradeRequired, response)); } } else { response.HttpCode = 404; response.Message = "Version or Platform parameter can not be null"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } catch (Exception) { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } }
public NationalRankingController() { _entities = new KSULaxEntities(); _dataBL = new DataBL(_entities); _gameBL = new GameBL(_entities); }
public SponsorsController() { _entities = new KSULaxEntities(); _gamesBL = new GameBL(_entities); }
public PrimaryServer() { InitializeComponent(); this.gameBL = new GameBL(); }
public HubForm(int hubId) { this.gameBL = new GameBL(); this.hubId = hubId; InitializeComponent(); }
static void Main(string[] args) { GameBL.opneGame(); }
public HttpResponseMessage Post(HttpRequestMessage request, [FromBody] PurchaseRequest data) { int type = 0; GenericApiResponse response = new GenericApiResponse(); GameBL gameBL = new GameBL(); PersonBL ConsumerAuth = new PersonBL(); int coins = 0; string error = ""; string code = ""; Random random = new Random(); try { IEnumerable <string> AppVersion = null; request.Headers.TryGetValues("AppVersion", out AppVersion); IEnumerable <string> Platform = null; request.Headers.TryGetValues("Platform", out Platform); bool ApplyValidation = bool.Parse(ConfigurationManager.AppSettings["ApplyValidationAppVersion"].ToString()); if (ApplyValidation == false || (AppVersion != null && Platform != null)) { string versionRequired = ""; var isValidVersion = (ApplyValidation == false) ? true : gameBL.IsValidAppVersion(AppVersion.FirstOrDefault(), Platform.FirstOrDefault(), ref error, ref versionRequired); if (isValidVersion) { if (data.StoreId == 0 || data.StoreId == null) { response.HttpCode = 400; response.Message = "StoreId cannot be empty"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } else { IEnumerable <string> key = null; request.Headers.TryGetValues("authenticationKey", out key); var consumerFb = ConsumerAuth.authenticateConsumer(key.FirstOrDefault().ToString()); if (consumerFb != null) { var result = gameBL.PurchaseAndGetSouvenir(consumerFb.ConsumerID, data.StoreId, ref error); if (result != null && error == "") { ShopPurchaseInteractor interactor = new ShopPurchaseInteractor(); var responseSuccess = interactor.createPurchaseResponse(result, error); return(Request.CreateResponse <IResponse>(HttpStatusCode.OK, responseSuccess)); } else { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } } else { response.HttpCode = 404; response.Message = "Facebook information not found"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } } else { response.HttpCode = 426; response.InternalCode = versionRequired; response.Message = "Upgrade required"; return(Request.CreateResponse <IResponse>(HttpStatusCode.UpgradeRequired, response)); } } else { response.HttpCode = 404; response.Message = "Version or Platform parameter can not be null"; return(Request.CreateResponse <IResponse>(HttpStatusCode.BadRequest, response)); } } catch (Exception) { response.HttpCode = 500; response.Message = "something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } }
public HomeController() { _entities = new KSULaxEntities(); _newsBL = new NewsBL(_entities); _gameBL = new GameBL(_entities); }
public GameController() { gameBussiness = new GameBL(); siteSetupBussiness = new SiteSetupBL(); }
public GamesController() { _entities = new KSULaxEntities(); _gamesBL = new GameBL(_entities); _photoBL = new PhotoBL(_entities); }