public JsonResult CalculateWeight(decimal weight, string activityDate, long playerId)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            modelRepo.AddPlayerWeight(weight, activityDate, playerId);
            return(this.Json(new { playerId = playerId, lbsValue = Math.Round(Decimal.Multiply(weight, 2.2m)), kgValue = weight }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult ImageGallery(string id)
        {
            PlayerDashboardRepository modelRepo = new PlayerDashboardRepository();
            var playerDashboard = modelRepo.ReadOne(id);

            string Reason = "";

            if (modelRepo.ValidateLogin(playerDashboard, this, ref Reason))
            {
                PlayerProgressGallery model = new PlayerProgressGallery();

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

                ViewBag.PlayerProgressGallery = model;

                //Descrypt password
                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));
            }
        }
        public JsonResult GetAllBeforeAfter(long PlayerId)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            var result = modelRepo.ReadAll(PlayerId, false, true).Where(i => i.PlayerID == PlayerId && i.IsBeforeAfter == true).ToList();

            return(this.Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult RemovePlayerImages(string[] PlayerImgs, long ParamPlayerID = 4)
        {
            string Msg = "";
            // The parameter of the Remove action must be called "fileNames"
            string PlayerImagesFolder = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + ""), ParamPlayerID.ToString());

            if (PlayerImgs != null)
            {
                foreach (var fullName in PlayerImgs)
                {
                    var fileName     = Path.GetFileName(fullName);
                    var physicalPath = Path.Combine(PlayerImagesFolder, fileName);

                    PlayerImagesRepository mRepo = new PlayerImagesRepository();

                    if (mRepo.Delete(fileName, ref Msg, this))
                    {
                        if (System.IO.File.Exists(physicalPath))
                        {
                            // The files are not actually removed in this demo
                            System.IO.File.Delete(physicalPath);
                        }
                    }
                }
            }

            // Return an empty string to signify success
            return(Content(""));
        }
Beispiel #5
0
        public ActionResult ReadFirstImages(long ParamPlayerID)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            var result = modelRepo.ReadAll(ParamPlayerID, false, true).ToList();

            return(this.Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #6
0
        public ActionResult ReadSecondImages(long ParamPlayerID, long ParamImageID)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            var data = modelRepo.ReadAll(ParamPlayerID, false, true).Where(m => m.PlayerImageID != ParamImageID).ToList();

            return(this.Json(data, JsonRequestBehavior.AllowGet));
        }
Beispiel #7
0
        public ActionResult _Read_FirstImages([DataSourceRequest] DataSourceRequest request, long ParamPlayerID)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            DataSourceResult       result    = modelRepo.ReadAll(ParamPlayerID, false, true).ToDataSourceResult(request);

            return(Json(result));
        }
Beispiel #8
0
        public ActionResult _Read_SecondImages([DataSourceRequest] DataSourceRequest request, long ParamPlayerID, long ParamImageID)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            var data = modelRepo.ReadAll(ParamPlayerID, false, true).Where(m => m.PlayerImageID != ParamImageID).ToList();
            DataSourceResult result = data.ToDataSourceResult(request);

            return(Json(result));
        }
        public JsonResult DeleteImage(long PlayerImageID, long PlayerID)
        {
            string Msg    = "";
            bool   status = true;
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            string fileName = modelRepo.Delete(PlayerImageID, ref Msg, ref status, this);

            return(this.Json(new { status = status, Msg = Msg }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult CreateGif(long[] PlayerImageIDs)
        {
            string Msg                       = "";
            bool   status                    = true;
            long   ParamPlayerID             = 0;
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            // var Selected_PlayerImgs = modelRepo.ReadAll(false).Where(m => PlayerImageIDs.Contains(m.PlayerImageID)).ToList();
            List <string> ListOfImagePaths = new List <string>();

            foreach (var item in PlayerImageIDs)
            {
                var    Selected_PlayerImgs = modelRepo.ReadOne(item);
                string FullPath            = Server.MapPath(Selected_PlayerImgs.ImageLink);
                ListOfImagePaths.Add(FullPath);
                ParamPlayerID = Selected_PlayerImgs.PlayerID;
            }

            string PlayerImagesFolder = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + ""), ParamPlayerID.ToString());

            modelRepo.CreateGif(ListOfImagePaths, PlayerImagesFolder, ParamPlayerID, ref Msg, ref status, this);

            //String[] imageFilePaths = new String[] { "D:\\temp\\01.png", "D:\\temp\\02.png", "D:\\temp\\03.png" };
            //String outputFilePath = "D:\\temp\\test.gif";
            //AnimatedGifEncoder e = new AnimatedGifEncoder();
            //e.Start(outputFilePath);
            //e.SetDelay(1000);
            ////-1:no repeat,0:always repeat
            //e.SetRepeat(0);
            //for (int i = 0, count = imageFilePaths.Length; i < count; i++)
            //{
            //    e.AddFrame(Image.FromFile(imageFilePaths[i]));
            //}
            //e.Finish();
            ///* extract Gif */
            //string outputPath = "D:\\temp";
            //GifDecoder gifDecoder = new GifDecoder();
            //gifDecoder.Read("D:\\temp\\Finalsss.gif");
            //for (int i = 0, count = gifDecoder.GetFrameCount(); i < count; i++)
            //{
            //    Image frame = gifDecoder.GetFrame(i);  // frame i
            //    frame.Save(outputPath + Guid.NewGuid().ToString() + ".png", ImageFormat.Png);
            //}

            if (status && SecurityUtils.Enable_PremiumDashboard)
            {
                AchievementsRepository achRepo = new AchievementsRepository();

                Guid guid = Guid.NewGuid();
                AchievementThread      = new Thread(() => achRepo.ImageGallery_AchievementPoints(ParamPlayerID, AchievementThread));
                AchievementThread.Name = "ImageGallery_BeforeAfterImageCreated_AchievementPoints_" + guid.ToString();
                AchievementThread.Start();
            }

            return(new JsonResult {
                Data = new { status = status, Msg = Msg }
            });
        }
Beispiel #11
0
        // GET: Member
        //id compare from PlayerDashboard.Dashboard URL to get PlayerID
        public ActionResult Index(string id)
        {
            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 (true)//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;

                PlayerDashboardNotificationsRepository paRepo = new PlayerDashboardNotificationsRepository();
                var playerNotifications = paRepo.ReadAll_NonDismissed(model.PlayerID.Value);
                ViewBag.Notifications = playerNotifications.ToList();


                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
        }
        public ActionResult UnMarkForDeletion(long PlayerImageID)
        {
            string Msg    = "";
            bool   status = true;
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            modelRepo.UnMarkForDeletion(PlayerImageID, ref Msg, ref status, this);

            return(new JsonResult {
                Data = new { status = status, Msg = Msg }
            });
        }
        public ActionResult UpdateImageDate(long PlayerImageID, DateTime ImageDate)
        {
            string Msg    = "";
            bool   status = true;
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            modelRepo.UpdateImageDate(PlayerImageID, ImageDate, ref Msg, ref status, this);

            return(new JsonResult {
                Data = new { status = status, Msg = Msg }
            });
        }
        public ActionResult MakeImageFront_SideDisplay(long PlayerImageID)
        {
            string Msg    = "";
            bool   status = true;
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            modelRepo.MakeImageFront_SideDisplay(PlayerImageID, ref Msg, ref status, this);

            return(new JsonResult {
                Data = new { status = status, Msg = Msg }
            });
        }
        public ActionResult DownloadImage(long id)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            var playerimg = modelRepo.ReadOne(id);

            var filename = DateTime.Now.ToString("ddMMyyyy_HHmmss") + ".gif";

            var imgPath = Server.MapPath(playerimg.ImageLink);

            Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
            Response.WriteFile(imgPath);
            Response.End();
            return(null);
        }
        public JsonResult GetPlayerWeightByDate(long playerId, string activityDate)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();
            var result = modelRepo.GetPlayerWeightByDate(playerId, activityDate);

            if (result != null)
            {
                return(this.Json(new { playerId = result.PlayerID, lbsValue = Math.Round(Decimal.Multiply(result.Weight, 2.2m)), kgValue = result.Weight }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
        public ActionResult Combine_BeforeAfterImage(long PlayerID, string FirstImagePath, string SecondImagePath)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            string PlayerImagesFolder = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + ""), PlayerID.ToString());

            FirstImagePath  = FirstImagePath.Replace("/Content/Data/PlayerImages/" + PlayerID + "/", "");
            SecondImagePath = SecondImagePath.Replace("/Content/Data/PlayerImages/" + PlayerID + "/", "");

            string FirstImageServerPath  = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + "/" + PlayerID.ToString()), FirstImagePath);
            string SecondImageServerPath = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + "/" + PlayerID.ToString()), SecondImagePath);

            Image_Combine imgCombine        = new Image_Combine();
            string        CombinedImageName = imgCombine.CombineBitmap_BeforeAfter(PlayerImagesFolder, FirstImageServerPath, SecondImageServerPath);

            //Clear the Object
            imgCombine = null;

            string Msg    = "";
            bool   status = true;

            PlayerImagesExt PlayerImg = new PlayerImagesExt()
            {
                PlayerID       = PlayerID,
                FileName       = CombinedImageName,
                IsAnimated     = false,
                Display        = true,
                DefaultImage   = false,
                UploadDateTime = DateTime.Now,
                IsBeforeAfter  = true
            };

            modelRepo.CreateOrUpdate(ref PlayerImg, ref Msg, ref status, this);

            if (status && SecurityUtils.Enable_PremiumDashboard)
            {
                AchievementsRepository achRepo = new AchievementsRepository();

                Guid guid = Guid.NewGuid();
                AchievementThread      = new Thread(() => achRepo.ImageGallery_BeforeAfterImageCreated_AchievementPoints(PlayerID, AchievementThread));
                AchievementThread.Name = "ImageGallery_BeforeAfterImageCreated_AchievementPoints_" + guid.ToString();
                AchievementThread.Start();
            }

            return(new JsonResult {
                Data = status
            });
        }
        public ActionResult GetPlayerImagesAsync(long id)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            return(this.Json(modelRepo.ReadAll(id, false, true), JsonRequestBehavior.AllowGet));
        }
        public ActionResult Async_Save(IEnumerable <HttpPostedFileBase> files)
        {
            long   ParamPlayerID = 4;
            string FinalFileName = "";

            // The Name of the Upload component is "files"
            if (files != null)
            {
                PlayerImagesRepository modelRepo = new PlayerImagesRepository();

                string PlayerImagesFolder = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + ""), ParamPlayerID.ToString());

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

                    // 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(PlayerImagesFolder, fileNameOnly + extension);

                    while (System.IO.File.Exists(newFullPath))
                    {
                        string tempFileName = string.Format("{0}({1})", fileNameOnly, count++);
                        newFullPath = Path.Combine(PlayerImagesFolder, 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);

                    string PlayerImagePath = Path.Combine(PlayerImagesFolder, FinalFileName);

                    string WaterMarkImagePath = Server.MapPath("~/Images/verticle_mvff.png");

                    Image_Combine imgCombine = new Image_Combine();

                    string FinalFileName_WaterMarked = imgCombine.CombineBitmap_WatermarkImage(PlayerImagesFolder, FinalFileName, WaterMarkImagePath);

                    //Clear the Object
                    imgCombine = null;

                    PlayerImagesExt PlayerImg = new PlayerImagesExt()
                    {
                        PlayerID       = ParamPlayerID,
                        FileName       = FinalFileName_WaterMarked,
                        IsAnimated     = false,
                        Display        = true,
                        DefaultImage   = false,
                        UploadDateTime = DateTime.Now
                    };

                    modelRepo.CreateOrUpdate(ref PlayerImg, ref Msg, ref status, this);

                    string NonWaterMarkImagePath = Path.Combine(PlayerImagesFolder, FinalFileName);

                    if (System.IO.File.Exists(NonWaterMarkImagePath))
                    {
                        System.IO.File.Delete(NonWaterMarkImagePath);
                    }

                    if (status && SecurityUtils.Enable_PremiumDashboard)
                    {
                        AchievementsRepository achRepo = new AchievementsRepository();

                        Guid guid = Guid.NewGuid();
                        AchievementThread      = new Thread(() => achRepo.ImageGallery_AchievementPoints(ParamPlayerID, AchievementThread));
                        AchievementThread.Name = "ImageGallery_BeforeAfterImageCreated_AchievementPoints_" + guid.ToString();
                        AchievementThread.Start();
                    }
                }
            }

            // Return an empty string to signify success
            return(Content(""));
        }
        public ActionResult GetPlayerGIFImages(long id, bool All)
        {
            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            return(this.Json(modelRepo.ReadAll(id, true, All), JsonRequestBehavior.AllowGet));
        }
Beispiel #21
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
        }
        /// <summary>
        /// Save Player Progress Image
        /// </summary>
        /// <param name="PlayerProgressImages">List of Uploaded Images</param>
        /// <param name="PlayerEmailAddress">Player Email Address to match and save against Player record in DB</param>
        /// <param name="LeagueID">League ID from current League Home Page</param>
        /// <param name="IsFront">IsFront</param>
        /// <param name="IsSide">IsSide</param>
        /// <returns></returns>
        public ActionResult SavePlayerProgressImages(IEnumerable <HttpPostedFileBase> PlayerProgressImages_Front, IEnumerable <HttpPostedFileBase> PlayerProgressImages_Side,
                                                     string PlayerEmailAddress, long LeagueID, bool IsFront, bool IsSide)
        {
            IEnumerable <HttpPostedFileBase> PlayerProgressImages = null;
            List <PlayerImagesExt>           ListOfPlayerImages   = new List <PlayerImagesExt>();

            if (PlayerProgressImages_Front != null)
            {
                PlayerProgressImages = PlayerProgressImages_Front;
            }
            else if (PlayerProgressImages_Side != null)
            {
                PlayerProgressImages = PlayerProgressImages_Side;
            }

            PlayersRepository playerRepo = new PlayersRepository();
            var player = playerRepo.ReadOne_ByEmailAddress(PlayerEmailAddress);

            PlayerImagesRepository modelRepo = new PlayerImagesRepository();

            if (player != null)
            {
                ListOfPlayerImages = modelRepo.ReadAll(player.PlayerID, false, false);
            }

            var ErrorMsg = ValidatePlayer_ForProgressImage(player, ListOfPlayerImages, LeagueID, IsFront, IsSide);

            if (!string.IsNullOrEmpty(ErrorMsg))
            {
                return(Content(ErrorMsg));
            }
            else
            {
                var ParamPlayerID = player.PlayerID;

                string FinalFileName = "";
                // The Name of the Upload component is "files"
                if (PlayerProgressImages != null)
                {
                    string PlayerImagesFolder = Path.Combine(Server.MapPath("~" + SecurityUtils.Players_ImagePath + ""), ParamPlayerID.ToString());

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

                        // 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(PlayerImagesFolder, fileNameOnly + extension);

                        while (System.IO.File.Exists(newFullPath))
                        {
                            string tempFileName = string.Format("{0}({1})", fileNameOnly, count++);
                            newFullPath = Path.Combine(PlayerImagesFolder, 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 PlayerImagePath = Path.Combine(PlayerImagesFolder, FinalFileName);

                        string WaterMarkImagePath = Server.MapPath("~/Images/verticle_mvff.png");

                        Image_Combine imgCombine = new Image_Combine();

                        string FinalFileName_WaterMarked = imgCombine.CombineBitmap_WatermarkImage(PlayerImagesFolder, FinalFileName, WaterMarkImagePath);
                        //imgWaterMark.GenerateWaterMarkOnImage(PlayerImagesFolder, FinalFileName, false, true, WaterMarkImagePath, null, false, false, true, false, false);

                        //Clear the Object
                        imgCombine = null;

                        PlayerImagesExt PlayerImg = new PlayerImagesExt()
                        {
                            PlayerID       = ParamPlayerID,
                            FileName       = FinalFileName_WaterMarked,
                            IsAnimated     = false,
                            Display        = true,
                            DefaultImage   = false,
                            IsFront        = IsFront,
                            IsSide         = IsSide,
                            UploadDateTime = DateTime.Now
                        };

                        modelRepo.CreateOrUpdate(ref PlayerImg, ref Msg, ref status, this);

                        string NonWaterMarkImagePath = Path.Combine(PlayerImagesFolder, FinalFileName);

                        if (System.IO.File.Exists(NonWaterMarkImagePath))
                        {
                            System.IO.File.Delete(NonWaterMarkImagePath);
                        }
                    }
                }

                // Return an empty string to signify success
                return(Content(""));
            }
        }