Beispiel #1
0
        public GameSale(MyHome input)
        {
            myHome = input;
            InitializeComponent();
            Responses <GameDTOs> GameResponse = GameControllerShould.GetAllGamesController();
            List <GameDTOs>      gameDTOs     = GameResponse.Payload;

            foreach (GameDTOs a in gameDTOs)
            {
                GameObject temp1 = toGameObject(a);
                lib_game.Add(temp1);
            }
            foreach (GameObject game in lib_game)
            {
                GameCollection.Items.Add(game.Name);
            }
            GameCollection.Text = "Choose a game to sale";
        }
Beispiel #2
0
        public void LoadDatabase(string UserId)
        {
            GameResponse     = GameControllerShould.GetAllGamesController();
            User             = AccountsControllerShould.GetUserByIdController(UserId);
            GameSaleResponse = GameControllerShould.GetAllGamesSaleController();


            List <GameDTOs> gameDTOs = GameResponse.Payload;

            foreach (GameDTOs a in gameDTOs)
            {
                GameObject temp1 = toGameObject(a);
                lib_game.Add(temp1);
            }

            foreach (TitleGame a in User.Games)
            {
                Response <GameDTOs> temp    = GameControllerShould.GetGameByIdController(a.Id.ToString());
                GameObject          gameobj = toGameObject(temp.Payload);
                user_game.Add(gameobj);
            }

            //foreach (TitleGame a in User.WishGames)
            //{
            //    Response<GameDTOs> temp = GameControllerShould.GetGameByIdController(a.Id.ToString());
            //    GameObject gameobj = toGameObject(temp.Payload);
            //    user_wishgame.Add(gameobj);
            //}

            foreach (GameDTOs a in GameSaleResponse.Payload)
            {
                GameObject gameobj = toGameObject(a);
                sale_game.Add(gameobj);
            }
            if (sale_game.Count() < 4)
            {
                for (int i = 0; i < 4; i++)
                {
                    sale_game.Add(lib_game.ElementAt(i));
                }
            }
        }
Beispiel #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtName.Text != "" &&
                txtContent.Text != "" &&
                txtLink1.Text != "" &&
                txtLink2.Text != "" &&
                txtLink3.Text != "" &&
                txtLink4.Text != "" &&
                txtPrice.Text != "")
            {
                pushGameCallBack += _pushGameCallBack;
                GameControllerShould gameControllerShould = new GameControllerShould();
                gameControllerShould.PostNewGameController(txtName.Text,
                                                           publisherDTOs[publisherIndex].Id.ToString(), "", "", "", "", 2, "", "", txtContent.Text, "128bbdf2-5038-498b-a32e-31ace3068cfe", "128bbdf2-5038-498b-a32e-31ace3068cfe", int.Parse(txtPrice.Text), pushGameCallBack);

                this.Close();
            }
            else
            {
                MessageBox.Show("Information is not enough!");
            }
        }
Beispiel #4
0
        private void btn_AddWishList_Click(object sender, EventArgs e)
        {
            TitleGame           wishgame = new TitleGame();
            Response <GameDTOs> temp     = GameControllerShould.GetGameByIdController(currGame.Id.ToString());

            //if (user_wishgame != null)
            //{
            //    foreach(GameObject a in user_wishgame)
            //    {
            //        if (temp.Payload.Id == a.Id)
            //        {
            //            MessageBox.Show("Game already exist in wishlist", "Error");
            //            return;
            //        }
            //    }
            //}
            //user_wishgame.Add(toGameObject(temp.Payload));

            wishgame.Id          = temp.Payload.Id;
            wishgame.ImageGames  = temp.Payload.ImageGames;
            wishgame.Name        = temp.Payload.Name;
            wishgame.ReleaseDate = temp.Payload.PurchaseDate;

            //User.Password = currPass;
            //var response = AccountsControllerShould.UpdateAccountController(User, this.id);
            var response = AccountsControllerShould.PostAccountLikeGameController(new BuyGameObject(this.currGame.Id.ToString()), this.id);

            if (response == "False")
            {
                MessageBox.Show("Fail or Duplicate game to add to wishlist", "Error");
            }
            else
            {
                User.WishGames.Add(wishgame);

                MessageBox.Show("Wish list updated", "Success");
            }
        }
Beispiel #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DateTime start = StartDate.Value;
            DateTime end   = EndDate.Value;

            if (start.CompareTo(end) > 0)
            {
                MessageBox.Show("End date has to be later than Start date", "Error");
            }
            else
            {
                GameSaleRequest sale     = new GameSaleRequest(Convert.ToInt32(txbPercent.Text), start, end);
                var             response = GameControllerShould.PutGameSaleByGameIdController(sale, selectedgamed.Id.ToString());
                if (response.IsSuccess == "True")
                {
                    MessageBox.Show("GameSale has been published", "Succeeded");
                }
                else
                {
                    MessageBox.Show("Sale request response was a failure", "Error");
                }
            }
        }