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();



            // NEED TO CHECK WITH BALTO: DO WE NEED ID?
            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));
        }
예제 #2
0
 public static bool Save(Frd FRD_File)
 {
     //save frd
     DB_Functions.SaveToDraft(ToByteArray(FRD_File));
     return(true);
 }