예제 #1
0
        public ActionResult ViewFrd(string Id, int V)
        {
            if (Functions.NoSession())
            {
                return(RedirectToAction("Login", "Authentication"));
            }
            Frd File = DB_Functions.CheckForFrd(ASCIIEncoding.UTF8.GetString(Convert.FromBase64String(Id)));

            if (File == null)
            {
                //Error page
                return(new HttpNotFoundResult());
            }
            if (V != 0)
            {
                File.LatestVersion        = V;
                File.Panel0.LatestVersion = V;
            }


            Frd s = ActiveFrdProcessor.Process(File, V);

            s.Type = Frd.TypesEnum.Closed;
            ViewBag.helpMessage = "This FRD can not be edited and can only be viewed from the archive of versions. \n";

            return(View("View_NoEdit", s));
        }
예제 #2
0
        public ActionResult SearchedFrd(string FrdId, int Version = 0)
        {
            if (Functions.NoSession())
            {
                return(RedirectToAction("Login", "Authentication"));
            }
            Frd frd = DB_Functions.CheckForFrd(FrdId);

            if (frd == null)
            {
                return(new HttpNotFoundResult());
            }

            if (Version == 0 || frd.LatestVersion == Version)
            {
                switch (frd.Type)
                {
                case Frd.TypesEnum.Active:
                    return(RedirectToAction("ActiveFrd", "Request", new { Id = G_Functions.GetHash(FrdId) }));

                case Frd.TypesEnum.Closed:
                    return(RedirectToAction("ClosedFrd", "Request", new { Id = G_Functions.GetHash(FrdId) }));

                    break;

                case Frd.TypesEnum.Pending:
                    return(RedirectToAction("PendingFrd", "Request", new { Id = G_Functions.GetHash(FrdId) }));

                    break;

                case Frd.TypesEnum.ReceivedManagerActive:


                case Frd.TypesEnum.ReceivedManagerPending:


                case Frd.TypesEnum.ReceivedUser:
                    return(RedirectToAction("ReceivedFrd", "Request", new { Id = G_Functions.GetHash(FrdId) }));


                    break;
                }
            }
            else
            {
                return(RedirectToAction("ViewFrd", "Request", new { Id = G_Functions.GetHash(FrdId), V = Version }));
            }
            return(new HttpNotFoundResult());
        }
        public ActionResult Check(string noti_id)
        {
            if (Models.Session.Functions.NoSession())
            {
                return(RedirectToAction("Login", "Authentication"));
            }
            Notification N = DB_Functions.GetNotiInfo(noti_id);

            if (N == null)
            {
                return(new HttpNotFoundResult());
            }

            DB_Functions.NotiSeen(noti_id);
            Frd frd = DB_Functions.CheckForFrd(N.FrdId);

            if (frd == null)
            {
                return(new HttpNotFoundResult());
            }


            if (frd.LatestVersion == N.Version)
            {
                switch (frd.Type)
                {
                case Frd.TypesEnum.Active:
                    return(RedirectToAction("ActiveFrd", "Request", new { Id = G_Functions.GetHash(N.FrdId) }));

                case Frd.TypesEnum.Closed:
                    return(RedirectToAction("ClosedFrd", "Request", new { Id = G_Functions.GetHash(N.FrdId) }));

                case Frd.TypesEnum.Pending:
                    return(RedirectToAction("PendingFrd", "Request", new { Id = G_Functions.GetHash(N.FrdId) }));

                case Frd.TypesEnum.ReceivedManagerActive:
                case Frd.TypesEnum.ReceivedManagerPending:
                case Frd.TypesEnum.ReceivedUser:
                    return(RedirectToAction("ReceivedFrd", "Request", new { Id = G_Functions.GetHash(N.FrdId) }));
                }
            }
            else
            {
                return(RedirectToAction("ViewFrd", "Request", new { Id = G_Functions.GetHash(N.FrdId), V = N.Version }));
            }

            return(View());
        }