Exemplo n.º 1
0
        // GET: Html5
        public ActionResult AKGame()
        {
            List <AssetsViewModel> avList = new List <AssetsViewModel>();

            avList            = new AssetsRepository().getAssetsListByUserID(User.Identity.GetUserId());
            Session["Assets"] = avList;
            ViewBag.Assets    = String.Format("{0:N1}", avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset);
            ViewBag.a         = avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset;
            var game = new H5GameRepository().H5GetAll(1).Where(x => x.gameStatus == 1).FirstOrDefault();

            ViewBag.EndTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", game.endTime);

            var h5 = new H5GameRepository().H5GetAll(1).Where(x => x.gameStatus != 1).LastOrDefault();
            //var akm = new List<AkGameVewModel>();
            AkGameVewModel ak = new AkGameVewModel();

            ak.gamenumberRecords = new H5GameRepository().GetNumberAll(h5.id);
            ViewBag.p            = ak.Brand;

            /* foreach (var h in h5.Where(x=>x.gameStatus!= 1))
             * {
             *   AkGameVewModel ak = new AkGameVewModel();
             *   ak.gamenumberRecords = new H5GameRepository().GetNumberAll(h.id);
             *
             *
             *   akm.Add(ak);
             * }
             *
             * ViewBag.p = akm.LastOrDefault().Brand;*/


            return(View(ak));
        }
Exemplo n.º 2
0
        public ActionResult AkAssets()
        {
            List <AssetsViewModel> avList = new List <AssetsViewModel>();

            avList            = new AssetsRepository().getAssetsListByUserID(User.Identity.GetUserId());
            Session["Assets"] = avList;
            ViewBag.Assets    = String.Format("{0:N1}", avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset);
            ViewBag.a         = avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset;
            return(View());
        }
Exemplo n.º 3
0
        public JsonResult SlottoLogin()
        {
            int          b      = 1;
            SlotVewModel slotvm = new SlotVewModel();

            if (User.Identity.GetUserId() == null)
            {
                b = 4;
            }
            else
            {
                List <AssetsViewModel> avList = new List <AssetsViewModel>();
                avList           = new AssetsRepository().getAssetsListByUserID(User.Identity.GetUserId());
                slotvm.usermoney = avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset;


                var u = new H5GameRepository().Usercount(User.Identity.GetUserId()).Where(x => x.gameModel == 5).FirstOrDefault();
                if (u == null)
                {
                    DailyGameCount d = new DailyGameCount
                    {
                        userId    = User.Identity.GetUserId(),
                        gameModel = 5,
                        count     = 0
                    };
                    u = new H5GameRepository().DaycountCreate(d);
                }
                int r = new Random().Next(1, 14);
                slotvm.slotm = new H5GameRepository().GetSlotCash(r);
            }
            slotvm.loginUser = b;

            return(Json(slotvm, JsonRequestBehavior.AllowGet));
        }
        public int LottoBets(int[] Number)
        {
            List <AssetsViewModel> avList = new List <AssetsViewModel>();

            avList = new AssetsRepository().getAssetsListByUserID(User.Identity.GetUserId());
            int b = 1;

            //玩家扣錢記錄
            if (avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset >= 10000)
            {
                H5LottoBets h5b  = new H5LottoBets();
                var         game = new H5GameRepository().H5GetAll(2).Where(x => x.gameStatus == 1).FirstOrDefault();
                h5b.gameBets = new GameBets
                {
                    userId     = User.Identity.GetUserId(),
                    GameSn     = game.id,
                    unitSn     = 1,
                    money      = 10000,
                    Odds       = 12,
                    valid      = 1,
                    gameModel  = game.gameModel,
                    createDate = DateTime.Now,
                    modiDate   = DateTime.Now
                };
                List <PlayerNumber> pnvm = new List <PlayerNumber>();
                foreach (var n in Number)
                {
                    var pn = new PlayerNumber
                    {
                        Number = n
                    };
                    pnvm.Add(pn);
                }
                h5b.playnumber = pnvm;

                new H5GameRepository().LottoBets(h5b);


                AssetsRecord assr = new AssetsRecord
                {
                    UserId     = h5b.gameBets.userId,
                    unitSn     = 1,
                    gameSn     = h5b.gameBets.GameSn,
                    assets     = -10000,
                    type       = -15,
                    h5forValue = game.gameModel
                };

                new AssetsRepository().Addh5gameByAssets(assr);
            }
            else
            {
                b = 0;
            }


            return(b);
            //return Json(akm, JsonRequestBehavior.AllowGet);
        }
        public int AKBets(float money, int Number)
        {
            H5Bets h5b  = new H5Bets();
            var    game = new H5GameRepository().H5GetAll(1).Where(x => x.gameStatus == 1).FirstOrDefault();

            h5b.gameBets = new GameBets {
                userId     = User.Identity.GetUserId(),
                GameSn     = game.id,
                unitSn     = 1,
                money      = money,
                Odds       = 12,
                valid      = 1,
                gameModel  = game.gameModel,
                createDate = DateTime.Now,
                modiDate   = DateTime.Now
            };
            h5b.playnumber = new PlayerNumber {
                Number = Number
            };
            new H5GameRepository().AkBets(h5b);
            int b = 1;
            List <AssetsViewModel> avList = new List <AssetsViewModel>();

            avList = new AssetsRepository().getAssetsListByUserID(User.Identity.GetUserId());

            //玩家扣錢記錄
            if (avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset >= money)
            {
                AssetsRecord assr = new AssetsRecord
                {
                    UserId     = h5b.gameBets.userId,
                    unitSn     = 1,
                    gameSn     = h5b.gameBets.GameSn,
                    assets     = -(double)money,
                    type       = -15,
                    h5forValue = game.gameModel
                };

                new AssetsRepository().Addh5gameByAssets(assr);
            }
            else
            {
                b = 0;
            }


            return(b);
            //return Json(akm, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 6
0
        public int BricktoCount()
        {
            //1:沒問題 4:沒登入 5:沒錢 0:沒每日
            int b = 1;

            if (User.Identity.GetUserId() != null)
            {
                var u = new H5GameRepository().Usercount(User.Identity.GetUserId()).Where(x => x.gameModel == 4).FirstOrDefault();
                if (u == null && User.Identity.GetUserId() != null)
                {
                    DailyGameCount d = new DailyGameCount
                    {
                        userId    = User.Identity.GetUserId(),
                        gameModel = 4,
                        count     = 5
                    };
                    u = new H5GameRepository().DaycountCreate(d);
                }

                List <AssetsViewModel> avList = new List <AssetsViewModel>();
                avList = new AssetsRepository().getAssetsListByUserID(User.Identity.GetUserId());

                if (avList.Where(x => x.unitSn == 1).FirstOrDefault().Asset < 200)
                {
                    b = 5;
                }



                if (u.count == 0)
                {
                    b = 0;
                }
            }
            else
            {
                b = 4;
            }



            return(b);
        }