コード例 #1
0
        public ActionResult Project(int row, int userID, string userName, string mode)
        {
            ViewBag.Title = "Project";
            Story myStory = new Story();

            myStory.userName   = userName;
            myStory.userID     = userID;
            ViewData["userID"] = userID;
            myStory.Mode       = mode;
            ViewData["Mode"]   = mode;

            DropdownModel model        = new DropdownModel();
            DropdownModel modelAnimal  = new DropdownModel();
            GetLookups    myGetLookups = new GetLookups();

            model          = myGetLookups.GeLookupPosted();
            myStory.Posted = model;
            myStory        = myGetLookups.GetReaderstory(row, userID);

            //var title = JakataID.ToString();

            foreach (SelectListItem s in model.items)
            {
                if (s.Value == myStory.PostedString)
                {
                    s.Selected = true;
                }
            }



            ViewData["postedData"] = model.items;

            //ilustrators

            //model = myGetLookups.GeLookupCatUsers(1);
            model = myGetLookups.GeLookupCatUsers(1);

            if (mode == "edit")
            {
                var IllustrationType = myStory.Illustrations;

                IllustrationType = IllustrationType.Trim();

                if (IllustrationType.EndsWith(","))
                {
                    IllustrationType = IllustrationType.Remove(IllustrationType.Length - 1, 1);
                }

                string[] Illustrationchosen = IllustrationType.Split(',');
                //model = new DropdownModel();

                //model = myGetLookups.GeLookupAnimal();


                for (int i = 0; i < Illustrationchosen.Length; i++)
                {
                    var x = Illustrationchosen[i];


                    foreach (SelectListItem s in model.items)
                    {
                        if (s.Value == x)
                        {
                            s.Selected = true;
                        }
                    }
                }

                //ViewData["animalTypeData"] = model.items;

                myStory.IllustrationsCombo = model;
            }
            myStory.IllustrationsCombo = model;

            //ViewData["IllustrationsData"] = model.items;
            model = myGetLookups.GeLookupCatUsers(2);
            myStory.ReadersCombo = model;
            //ViewData["ReadersData"] = model.items;
            //model = myGetLookups.GeLookupCatUsers(3);
            model = myGetLookups.GeLookupCatUsers(3);

            if (mode == "edit")
            {
                var MusicType = myStory.Music;

                MusicType = MusicType.Trim();

                if (MusicType.EndsWith(","))
                {
                    MusicType = MusicType.Remove(MusicType.Length - 1, 1);
                }

                string[] Musicchosen = MusicType.Split(',');
                //model = new DropdownModel();

                //model = myGetLookups.GeLookupAnimal();
                //model = myGetLookups.GeLookupCatUsers(3);

                for (int i = 0; i < Musicchosen.Length; i++)
                {
                    var x = Musicchosen[i];


                    foreach (SelectListItem s in model.items)
                    {
                        if (s.Value == x)
                        {
                            s.Selected = true;
                        }
                    }
                }

                //ViewData["animalTypeData"] = model.items;



                myStory.MusicCombo = model;
            }

            myStory.MusicCombo = model;
            //ViewData["MusicData"] = model.items;
            model = myGetLookups.GeLookupCatUsers(4);
            if (mode == "edit")
            {
                myStory.DanceCombo = model;

                var DanceType = myStory.Dance;

                DanceType = DanceType.Trim();

                if (DanceType.EndsWith(","))
                {
                    DanceType = DanceType.Remove(DanceType.Length - 1, 1);
                }

                string[] Dancechosen = DanceType.Split(',');
                //model = new DropdownModel();

                //model = myGetLookups.GeLookupAnimal();
                //model = myGetLookups.GeLookupCatUsers(1);

                for (int i = 0; i < Dancechosen.Length; i++)
                {
                    var x = Dancechosen[i];


                    foreach (SelectListItem s in model.items)
                    {
                        if (s.Value == x)
                        {
                            s.Selected = true;
                        }
                    }
                }
            }
            //ViewData["animalTypeData"] = model.items;

            myStory.DanceCombo = model;



            //ViewData["DanceData"] = model.items;
            model = myGetLookups.GeLookupCatUsers(5);
            myStory.AdminCombo = model;
            //ViewData["AdminData"] = model.items;

            model = myGetLookups.GeLookupJakataMaster();
            ViewData["jakataMasterData"] = model.items;

            model = myGetLookups.GeLookupStorySource();
            ViewData["storySourceData"] = model.items;

            model = myGetLookups.GeLookupJakataMaster();


            Story modelStory = new Story();

            modelStory = myGetLookups.GetSpecificStory(row, "jakataID");

            var ID1 = modelStory.ID.ToString();

            ViewData["id"] = ID1;

            var JakataID       = modelStory.JakataID;
            var JakataIDString = modelStory.JakataID.ToString();

            ViewData["JakataID"] = JakataIDString;

            var title = JakataID.ToString();

            foreach (SelectListItem s in model.items)
            {
                if (s.Value == title)
                {
                    s.Selected          = true;
                    myStory.TitleString = s.Text;
                }
            }

            GetLookups myYouTubeGetLookups = new GetLookups();

            model = myYouTubeGetLookups.GetYouTube(JakataID, userID);
            //ViewData["youTubeData"] = model.items;
            myStory.youTubeCombo = model;



            ViewData["jakataMasterData"] = model.items;


            //myStory.Posted = "0";



            return(View(myStory));
        }