Exemplo n.º 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());
        }
Exemplo n.º 3
0
        public ActionResult New(Frd submittedFrd)
        {
            if (Functions.NoSession())
            {
                return(RedirectToAction("Login", "Authentication"));
            }
            switch (submittedFrd.SubmitType)
            {
            case Frd.ButtonsEnum.Reset:    //reset
                DB_Functions.DeleteSavedDraft();
                return(RedirectToAction("New", new { message = "The FRD data has been reset successfully!" }));

            case Frd.ButtonsEnum.Submit:    //submit
                if (DB_Functions.SubmitNewFrd(submittedFrd))
                {
                    SuccessData viewModel = new SuccessData()
                    {
                        Heading            = "FRD has been submitted successfully",
                        PrimaryParagraph   = "Your FRD has been submitted successfully!",
                        SecondaryParagraph = "Please wait for your manager's approval.",
                        LastParagraph      = "The submitted FRD can be found in the 'Pending Requests' page.",
                        ButtonText         = "GO TO PENDING REQUESTS",
                        ButtonLink         = "Request/Pending"
                    };
                    return(View("Success", viewModel));
                }
                else
                {
                    submittedFrd.Type = Frd.TypesEnum.Saved;
                    return(RedirectToAction("New", SavedFrdHandling.ProcessInfo(submittedFrd)));
                }

            case Frd.ButtonsEnum.Save:    //save
                DB_Functions.SaveToDraft(G_Functions.ToByteArray(submittedFrd));
                return(RedirectToAction("New", new { message = "The FRD data has been saved successfully!" }));
            }



            var a = FRD_Submit.Save(submittedFrd);

            return(RedirectToAction("New"));
        }
        // GET: NotificationPage

        public ActionResult NotificationPage(string op = "all", string frd = null)
        {
            if (Models.Session.Functions.NoSession())
            {
                return(RedirectToAction("Login", "Authentication"));
            }

            NotificationPage viewModel = new NotificationPage();

            switch (op)
            {
            case "all":
                viewModel.Notifications = DB_Functions.ReadNotifications(Functions.GetID());
                break;

            case "R":
                viewModel.Notifications = DB_Functions.ReadNotifications(Functions.GetID(), DB_Functions.NotificationsType.Received);
                break;

            case "C":
                viewModel.Notifications = DB_Functions.ReadNotifications(Functions.GetID(), DB_Functions.NotificationsType.Closed);
                break;

            case "P":
                viewModel.Notifications = DB_Functions.ReadNotifications(Functions.GetID(), DB_Functions.NotificationsType.Pending);
                break;

            case "A":
                viewModel.Notifications = DB_Functions.ReadNotifications(Functions.GetID(), DB_Functions.NotificationsType.Active);
                break;

            case "FRD":
                viewModel.Notifications = DB_Functions.ReadNotifications(Functions.GetID(), DB_Functions.NotificationsType.FRD, G_Functions.GetIdFromHash(frd));
                break;
            }


            return(View("NotificationPage", viewModel));
        }
Exemplo n.º 5
0
        public ActionResult New(String message)
        {
            ViewBag.Message = message;

            if (Functions.NoSession())
            {
                return(RedirectToAction("Login", "Authentication"));
            }

            //check for saved FRD here

            byte[] file = DB_Functions.GetSaved();
            if (file != null)
            {
                if (String.IsNullOrEmpty(message))
                {
                    ViewBag.Message = "Previously saved FRD data loaded successfully. To erase, click on the RESET button";
                }

                Frd myfrd = G_Functions.DeserializeFromBytes <Frd>(file);

                myfrd.Type          = Frd.TypesEnum.Saved;
                ViewBag.helpMessage = "•Panl0, Panel1 and Panel 7 are compulsory to fill, all other panels are optional. \n" +
                                      "•Save To Draft Button will quickly save the currently inserted data for subsequent use.\n" +
                                      "•Reset Button will erase the currently inserted data and the most recent draft data, if any.";

                return(View(SavedFrdHandling.ProcessInfo(myfrd)));
            }

            //get list of target audience from database and store in variable a
            List <TargetAudience> a = DB_Functions.DefaultTargets();

            //get list of channels from database and store in variable b
            List <Channel> b = DB_Functions.DefaultChannels();


            //get list of departments with their respective employees inside from database and store in
            //variable c
            List <Distribution_Groups> c = DB_Functions.DefaultGroups();



            var senders = DB_Functions.DefaultSmsSenders();


            var viewModel = new Frd()
            {
                Type         = Frd.TypesEnum.New,
                Upload_Token = DB_Functions.NewUploadToken(DB_Functions.UploadTokenType.New),
                Panel0       = new Panel_0()
                {
                    Owner = Functions.GetName()
                },
                Panel2 = new Panel_2()
                {
                    Targets = a
                },
                Panel3 = new Panel_3()
                {
                    Channels = b
                },
                Panel4 = new Panel_4()
                {
                    Senders = senders
                },
                Panel7 = new Panel_7()
                {
                    DistributionGroups = c
                }
            };

            ViewBag.helpMessage = "•Panl0, Panel1 and Panel 7 are compulsory to fill, all other panels are optional. \n" +
                                  "•Save To Draft Button will quickly save the currently inserted data for subsequent use.\n" +
                                  "•Reset Button will erase the currently inserted data and the most recent draft data, if any.";
            return(View(viewModel));
        }