Exemple #1
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());
        }