Ejemplo n.º 1
0
        public IActionResult AddLink(string alltags, string title, string URL, string duration, DateTime datecompleted, string videotype, string description)
        {
            bool result = login.checkSession();

            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            bool _test1 = String.IsNullOrEmpty(title);
            bool _test2 = String.IsNullOrEmpty(URL);
            bool _test3 = String.IsNullOrEmpty(duration);
            bool _test4 = String.IsNullOrEmpty(videotype);
            bool _test5 = String.IsNullOrEmpty(description);

            if (_test1 || _test2 || _test3 || _test4 || _test5)
            {
                TempData["error"] = "It appears you missed a field.  Make sure all fields are filled out";
                return(RedirectToAction("AddLink", "VideoBackend"));
            }
            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();

            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }


            VideoBackendViewModel videoMetaData = new VideoBackendViewModel();
            VideoBackEnd          VBM           = new VideoBackEnd();

            string[] tagArray;
            videoMetaData.VideoName        = title;
            videoMetaData.URL              = URL;
            videoMetaData.Duration         = duration;
            videoMetaData.DateCompleted    = datecompleted;
            videoMetaData.VideoType        = videotype;
            videoMetaData.VideoDescription = description;
            tagArray = VBM.parseTags(alltags);

            string x = VBM.processEntry(videoMetaData, tagArray, curUser.username);

            TempData["error"] = x;


            return(RedirectToAction("AddLink", "VideoBackend", curPage));
        }
Ejemplo n.º 2
0
        public IActionResult jayAdmin(string deleteThese)
        {
            #region login

            bool result = login.checkSession();
            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();
            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes" && curUser.username == "jamunro")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }


            #endregion


            VideoBackendViewModel videodata    = new VideoBackendViewModel();
            VideoBackEnd          videomethods = new VideoBackEnd();



            string[] tags = deleteThese.Split('|');

            foreach (var t in tags)
            {
                if (t != "")
                {
                    videomethods.deletetag(t);
                }
            }
            TempData["error"] = " Deleted " + deleteThese;

            videodata = videomethods.jayAllTags(videodata);
            return(View(videodata));
        }
Ejemplo n.º 3
0
        public IActionResult EditLink(string id)
        {
            bool result = login.checkSession();

            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();

            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            VideoBackendViewModel videodata    = new VideoBackendViewModel();
            VideoBackEnd          videomethods = new VideoBackEnd();


            videodata         = videomethods.listVideos(id);
            videodata         = videomethods.getAllTags(videodata);
            videodata.vidID   = id;
            videodata         = videomethods.getTagsForVideo(videodata);
            TempData["error"] = videodata.returnMsg;
            return(View(videodata));
        }
Ejemplo n.º 4
0
        public IActionResult AddLink()
        {
            bool result = login.checkSession();

            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();

            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            VideoBackendViewModel taglist = new VideoBackendViewModel();
            VideoBackEnd          VBM     = new VideoBackEnd();

            taglist = VBM.getAllTags(taglist);


            return(View(taglist));
        }
Ejemplo n.º 5
0
        public IActionResult addTag(string alltags, string delTags)
        {
            bool result = login.checkSession();

            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();

            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            VideoBackendViewModel videoMetaData = new VideoBackendViewModel();
            VideoBackEnd          VBM           = new VideoBackEnd();


            if (delTags != "na")
            {
                string[] tags = delTags.Split('|');

                foreach (var t in tags)
                {
                    if (t != "")
                    {
                        VBM.deletetag(t);
                    }
                }
                TempData["error"] = "Deleted Tags";
                return(RedirectToAction("MainMenu", "VideoBackend", curPage));
            }


            if (alltags == "na")
            {
                TempData["error"] = "No tags entered...";
                return(RedirectToAction("MainMenu", "VideoBackend", curPage));
            }


            string[] tagArray;

            tagArray = VBM.parseTags(alltags);
            string x = VBM.processNewTags(tagArray);

            TempData["error"] = "Success";
            if (x != "Success")
            {
                TempData["error"] = "Unable to add. " + x;
            }

            return(RedirectToAction("MainMenu", "VideoBackend", curPage));
        }
Ejemplo n.º 6
0
        public IActionResult EditLink(string alltags, string vidID, string title, string URL, string duration, DateTime datecompleted, string videotype, string description, string delete)
        {
            bool result = login.checkSession();

            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();

            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            VideoBackendViewModel videoMetaData = new VideoBackendViewModel();
            VideoBackEnd          VBM           = new VideoBackEnd();

            try
            {
                string[] tagArray;
                videoMetaData.VideoName        = title;
                videoMetaData.URL              = URL;
                videoMetaData.Duration         = duration;
                videoMetaData.DateCompleted    = datecompleted;
                videoMetaData.VideoType        = videotype;
                videoMetaData.VideoDescription = description;
                videoMetaData.vidID            = vidID;
                tagArray = VBM.parseTags(alltags);



                string y = VBM.cleanLinkEntrys(vidID);

                if (delete == "1")
                {
                    TempData["error"] = y;
                    return(RedirectToAction("ListLinks", "VideoBackend"));
                }

                if (y == "Success")
                {
                    string x = VBM.processEntry(videoMetaData, tagArray, curUser.username);


                    TempData["error"] = x;
                }
                return(RedirectToAction("ListLinks", "VideoBackend", curPage));
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
                return(RedirectToAction("ListLinks", "VideoBackend", curPage));
            }
        }