public ActionResult _Read([DataSourceRequest] DataSourceRequest request)
        {
            HeaderTextsRepository modelRepo = new HeaderTextsRepository();
            DataSourceResult      result    = modelRepo.ReadAll().ToDataSourceResult(request);

            return(Json(result));
        }
        public ActionResult _Destroy([DataSourceRequest] DataSourceRequest request, HeaderTextsExt model)
        {
            string Msg = "";

            HeaderTextsRepository modelRepo = new HeaderTextsRepository();

            if (modelRepo.Delete(model, ref Msg, this) == false)
            {
                return(this.Json(new DataSourceResult {
                    Errors = Msg
                }));
            }

            return(Json(request));
        }
        public ActionResult _Update([DataSourceRequest] DataSourceRequest request, HeaderTextsExt model)
        {
            if (ModelState.IsValid)
            {
                string Msg = "";

                HeaderTextsRepository modelRepo = new HeaderTextsRepository();
                if (modelRepo.Update(model, ref Msg, this) == false)
                {
                    return(this.Json(new DataSourceResult {
                        Errors = Msg
                    }));
                }
            }
            else
            {
                string error = ErrorHandling.HandleModelStateErrors(ModelState);
                return(this.Json(new DataSourceResult {
                    Errors = error
                }));
            }
            return(Json(request));
        }
Example #4
0
        // GET: Member
        //id compare from PlayerDashboard.Dashboard URL to get PlayerID
        public ActionResult Index(string id)
        {
            if (SecurityUtils.Enable_PremiumDashboard == false)
            {
                return(RedirectToAction("Index", "Home"));
            }

            PlayerDashboardRepository modelRepo = new PlayerDashboardRepository();
            //Check if Player is Allowed to Access Premium Dashboard
            var playerDashboard = modelRepo.ReadOne(id);

            //if Didn't found any record then difinitely Player is not registered for Premium Dashboard
            if (playerDashboard == null)
            {
                return(RedirectToAction("NoPremiumMembership"));
            }

            //If system found a Cookie and Login Cookie Session is similar then let the user Login to Player Dashboard without Displaying Login Screen
            string Reason = "";
            //if (modelRepo.ValidateLogin(playerDashboard, this, ref Reason))
            //{
            //    if (playerDashboard.IsFirstLogin)
            //    {
            //        System.Web.Routing.RouteValueDictionary rt = new System.Web.Routing.RouteValueDictionary();
            //        rt.Add("id", id);
            //        return RedirectToAction("Settings", rt);
            //    }

            PlayerProgressGallery model = new PlayerProgressGallery();

            model.PlayerID = playerDashboard.PlayerID;
            PlayerImagesRepository pImgRepo = new PlayerImagesRepository();

            model.playerImages = pImgRepo.ReadAll(model.PlayerID.Value, false, false);

            ViewBag.PlayerProgressGallery = model;
            List <PlayerImagesExt> ListOfPlayerImages = new List <PlayerImagesExt>();
            PlayerImagesRepository modelImagesRepo    = new PlayerImagesRepository();

            ListOfPlayerImages            = modelImagesRepo.ReadAll(model.PlayerID.Value, true, false);
            ViewBag.PlayerAnimatedGallery = ListOfPlayerImages;
            PlayerDashboardNotificationsRepository paRepo = new PlayerDashboardNotificationsRepository();
            var playerNotifications = paRepo.ReadAll_NonDismissed(model.PlayerID.Value);

            ViewBag.Notifications = playerNotifications.ToList();

            MemberToolsBenefitsRepository toolsRepo = new MemberToolsBenefitsRepository();

            ViewBag.ToolsAndBenifits = toolsRepo.ReadAll();


            HeaderTextsRepository headerTexts = new HeaderTextsRepository();
            var headerTextList = headerTexts.ReadAll();

            //Select if date specific header exists
            if (headerTextList.Exists(x => x.DisplayDate.HasValue && x.DisplayDate.Value.Date.ToString("dd/MM/YYYY") == DateTime.Now.Date.ToString("dd/MM/yyyy")))
            {
                playerDashboard.HeaderTexts = new HeaderTextsExt();
                playerDashboard.HeaderTexts = headerTextList.Where(x => x.DisplayDate.HasValue && x.DisplayDate.Value.Date.ToString("dd/MM/YYYY") == DateTime.Now.Date.ToString("dd/MM/yyyy")).SingleOrDefault();
            }
            else
            {
                var headerListWithoutDateHeaders = headerTextList.Where(x => x.DisplayDate == null).ToList();
                if (headerListWithoutDateHeaders != null && headerListWithoutDateHeaders.Count > 0)
                {
                    playerDashboard.HeaderTexts = new HeaderTextsExt();
                    //Select general header
                    int randomNumber = GeneralHelper.GetRandomNumber(1, headerListWithoutDateHeaders.Count);
                    var listArray    = headerListWithoutDateHeaders.ToArray();
                    playerDashboard.HeaderTexts = listArray[randomNumber - 1];
                }
            }
            return(View(playerDashboard));
            //}
            //else
            //{
            //    //Otherwise Redirect to Login Screen, if cookie didn't match then redirect to Login Page
            //    System.Web.Routing.RouteValueDictionary rt = new System.Web.Routing.RouteValueDictionary();
            //    rt.Add("id", id);
            //    rt.Add("Reason", Reason);
            //    return RedirectToAction("Login", rt);
            //}

            //We need to Implement Cookies to store Login Session ID.
            //Member can be login for upto 1 week after that they must enter their Password to View their Dashboard

            //Must have Paid Out payment of type "Premium Dashboard" in last 31 days

            //var dashboard = modelRepo.va
        }