Esempio n. 1
0
        public ActionResult _Read([DataSourceRequest] DataSourceRequest request)
        {
            MemberToolsBenefitsRepository modelRepo = new MemberToolsBenefitsRepository();
            DataSourceResult result = modelRepo.ReadAll().ToDataSourceResult(request);

            return(Json(result));
        }
Esempio n. 2
0
        public ActionResult GetTools(string id, long PlayerID)
        {
            MemberToolsBenefitsRepository modelRepo = new MemberToolsBenefitsRepository();
            var data = modelRepo.ReadAll_PremiumDashboard(PlayerID, true, false);

            ViewBag.CarouselControlID = "Carousal_Tools";
            return(PartialView("_MemberToolBenefits", data));
        }
Esempio n. 3
0
        public ActionResult _Destroy([DataSourceRequest] DataSourceRequest request, MemberToolsBenefitsExt model)
        {
            string Msg = "";

            string ToolBenefit_ImageFolder = Server.MapPath("~" + SecurityUtils.ToolBenefit_ImagePath + "");

            MemberToolsBenefitsRepository modelRepo = new MemberToolsBenefitsRepository();

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

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

                MemberToolsBenefitsRepository modelRepo = new MemberToolsBenefitsRepository();
                if (modelRepo.CreateOrUpdate(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));
        }
Esempio n. 5
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
        }
Esempio n. 6
0
        public ActionResult SaveToolBenefit_Photo(IEnumerable <HttpPostedFileBase> ToolBenefit_Photo, long paramMemberToolsBenefitID)
        {
            string FinalFileName = "";

            // The Name of the Upload component is "files"
            if (ToolBenefit_Photo != null)
            {
                string ToolBenefit_ImageFolder = Server.MapPath("~" + SecurityUtils.ToolBenefit_ImagePath + "");

                foreach (var file in ToolBenefit_Photo)
                {
                    if (!(System.IO.Directory.Exists(ToolBenefit_ImageFolder)))
                    {
                        System.IO.Directory.CreateDirectory(ToolBenefit_ImageFolder);
                    }

                    using (Bitmap originalImage = new Bitmap(file.InputStream))
                    {
                        var width  = originalImage.Width;
                        var height = originalImage.Height;

                        if (width > 800 || height > 600)
                        {
                            return(Content("Maximum allowed Image resolution is 800x600 BUT Uploaded Image resolution is " + width.ToString() + "x" + height + " . Please resize the image and try again."));
                        }
                    }

                    // Some browsers send file names with full path. This needs to be stripped.
                    string IEFileName = "", FileNameWithExtension = "";

                    if (Request.Browser.Browser.ToLower().Equals("ie") || Request.Browser.Browser.ToLower().Equals("internetexplorer"))
                    {
                        IEFileName = Path.GetFileName(file.FileName);
                    }

                    if (IEFileName != "")
                    {
                        FileNameWithExtension = IEFileName;
                        SecurityUtils.CheckforInvalidFileNameChar(ref FileNameWithExtension);
                    }
                    else
                    {
                        FileNameWithExtension = file.FileName;
                        SecurityUtils.CheckforInvalidFileNameChar(ref FileNameWithExtension);
                    }

                    var fileExtension = Path.GetExtension(FileNameWithExtension);

                    //Following Code will rename the file if it is already Exists
                    int count = 1;

                    string fileNameOnly = Guid.NewGuid().ToString(); //Path.GetFileNameWithoutExtension(FileNameWithExtension);
                    string extension    = Path.GetExtension(FileNameWithExtension);
                    string newFullPath  = FileNameWithExtension;
                    newFullPath = Path.Combine(ToolBenefit_ImageFolder, fileNameOnly + extension);

                    while (System.IO.File.Exists(newFullPath))
                    {
                        string tempFileName = string.Format("{0}({1})", fileNameOnly, count++);
                        newFullPath = Path.Combine(ToolBenefit_ImageFolder, tempFileName + extension);
                    }

                    fileNameOnly = Path.GetFileNameWithoutExtension(newFullPath);

                    //Update Filename from Repository
                    string Msg    = "";
                    bool   status = true;
                    FinalFileName = fileNameOnly + extension;

                    //Save the file to the Disk
                    file.SaveAs(newFullPath);

                    // ImageWaterMark imgWaterMark = new ImageWaterMark();

                    string ToolBenefitImage_Path = Path.Combine(ToolBenefit_ImageFolder, FinalFileName);

                    MemberToolsBenefitsRepository modelRepo = new MemberToolsBenefitsRepository();
                    //var model = modelRepo.ReadOne(paramMemberToolsBenefitID);

                    ////Check if already had an Image then Delete the previous image before updating new in DB
                    //if(!string.IsNullOrEmpty(model.PictureName))
                    //{
                    //    string PrevImgPath = Path.Combine(ToolBenefit_ImageFolder, model.PictureName);

                    //    if (System.IO.File.Exists(PrevImgPath))
                    //    {
                    //        System.IO.File.Delete(PrevImgPath);
                    //    }
                    //}
                    ////Update currently Updloaded Image
                    //modelRepo.AddToolBenefitImage(paramMemberToolsBenefitID, FinalFileName, ref Msg, this);
                }
            }
            // Return an empty string to signify success
            return(Content(""));
        }