当前位置: 首页>>代码示例>>C#>>正文


C# FormCollection.CopyTo方法代码示例

本文整理汇总了C#中System.Web.Mvc.FormCollection.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# FormCollection.CopyTo方法的具体用法?C# FormCollection.CopyTo怎么用?C# FormCollection.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Mvc.FormCollection的用法示例。


在下文中一共展示了FormCollection.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveFormValuesToSettings

		private void SaveFormValuesToSettings(FormCollection collection)
		{
			ViewData["PostResult"] = Resources.SettingsSaved;
			var dictionary = new Dictionary<string, object>();
			collection.CopyTo(dictionary);
			_settingsManager.SaveCurrent(dictionary);
		}
开发者ID:andyliyuze,项目名称:POPForums,代码行数:7,代码来源:AdminController.cs

示例2: Result

        public ActionResult Result(FormCollection form, Account User)
        {
            Debug.Print("ANS COUNT IN CONTROLLER");

            //BRad Removed this
            //string[] Answers = new string[form.Count]; //for now hard code it
            //form.CopyTo(Answers, 0);
            //End Brads Remove

            /*Debug.Print("Length of form is: ");
            Debug.Print(Answers.Length.ToString());
            for (int i = 0; i < Answers.Length; i++)
            {
               Debug.Write(Answers[i] +",");
            }*/

            /**** Brads Code
            Adding the Account Id makes the form length 1 more larger, I had to fix it
            */
            string[] Answers = new string[form.Count - 1];
            string[] wrongAnswers = new string[form.Count];
            form.CopyTo(wrongAnswers, 0);
            for (int i = 0; i < wrongAnswers.Length - 1; i++)
            {
                Answers[i] = wrongAnswers[i + 1];
            }
            // BRads code ends

            if (PModel.IsValid(Answers))
            {
                Answers = PModel.RemoveQuestionIDS(Answers);
                PModel.Answers = Answers;
                PModel.EliminateProcessModels();
                string Result=PModel.ChooseProcessModels();
                ViewData["result"] = Result;
                return View("Result",User);
            }
            else
            {
                ViewData["questions"] = PModel.Questions;
                ViewData["multAnswers"] = PModel.MultipleChoiceAnswers;
                ViewData["isValid"] = "false";
                ViewData["answers"] = Answers;
                return View("Questions", User);
            }
        }
开发者ID:SMITHSTEPH,项目名称:FundamentalsOfSE,代码行数:46,代码来源:ProcessModelController.cs

示例3: Test

        public ActionResult Test(FormCollection form)
        {
            string[] info = new string[form.Count];
            form.CopyTo(info, 0);
            int id = Convert.ToInt16(info[0]);
            string model = info[1];

               //RegistrationEntities1Entities1 db = new RegistrationEntities1Entities1();
            RegistrationEntities1 db = new RegistrationEntities1();

            db.ProjectTables.Add(new ProjectTable
            {
                ProcessModelChosen = model
            });

            db.SaveChanges();

            List<ProjectTable> projectTables = db.ProjectTables.ToList();
            ProjectTable justAdded = projectTables.Last();

            db.JunctionTableProjectAndAccountV2.Add(new JunctionTableProjectAndAccountV2
            {
                AID = id,
                PId = justAdded.ProjectId,
                Responsibilities = "Leader",
                Role = "Leader"
            });

            db.SaveChanges();

            leaderTableV2 leader = db.leaderTableV2.Find(id);
            Account User = new Account();
            User.AccountId = leader.Id;
            User.Rank = "Leader";
            User.UserName = leader.UserName;

            return RedirectToAction("ExistingProjects", "Project", User);
        }
开发者ID:SMITHSTEPH,项目名称:FundamentalsOfSE,代码行数:38,代码来源:ProcessModelController.cs

示例4: TrainData

        //for training
        public ActionResult TrainData(FormCollection form)
        {
            string[] Answers2= new string[92] { "0True", "1True", "2True", "3True", "4True", "5False", "test", "7False", "8False", "9very little", "10False", "11False", "12at the end", "13very little to no time", "14False", "15False", "16Fast", "17False", "18Less than a Year", "19False", "20Every 1-3 weeks", "21Every 1-3 weeks", "22False", "23False", "24False", "25very", "26True", "27very", "28False", "29False", "30little", "31little", "32average amount", "33love it", "34False", "35spread out across country", "36low - Medium", "37High", "38False", "39False", "40True", "41False", "42False", "43low", "44True", "45One", "46False", "47True", "48True", "49True", "50None", "51True", "52True", "53False", "54Medium", "55True", "56True", "57False", "58False", "59False", "60Updated Often", "61False", "62False", "63False", "64Low Budget", "65Low Budget", "66Low Budget", "67Low Budget", "68False", "69False", "70False", "71Small", "72True", "73False", "74Flexable", "75True", "76True", "77True", "78True", "79True", "80True", "81True", "82True", "83True", "84False", "85False", "86False", "87False", "88True", "89False", "90False", "91False" };
            Debug.Print("Answers2: " +Answers2.Length.ToString());
            Debug.Print("Train COUNT IN CONTROLLER");
            string[] Answers = new string[form.Count]; //for now hard code it
            Debug.Print("Form length is: " + form.Count.ToString());
            form.CopyTo(Answers, 0);
            for(int i=0; i<Answers.Length; i++)
            {
                Debug.Write(Answers[i]+", ");
            }
            Debug.Print("Length of form is: ");
            Debug.Print(Answers.Length.ToString());
            if (Answers.Length==93) //if all the questions were answered
            {
                string winner = form[form.Count - 1];
                //Debug.Print("winner: " + winner);
                string key= form.GetKey(form.Count-1);
                form.Remove(form.GetKey(form.Count - 1));//hopefully removing the winner from the form
                Answers = new string[form.Count];
                form.CopyTo(Answers, 0);
                string[] OldAnswers = new string[form.Count];
                Answers.CopyTo(OldAnswers, 0);
                PModel.Answers = PModel.RemoveQuestionIDS(Answers);
                /*Debug.Print("Answers Again: ");
                for (int i = 0; i < Answers.Length; i++) //test
                {
                    Debug.Write(Answers[i] + ",");
                }*/
                int score =PModel.TrainData(winner);

                ViewData["isValid"] = "true";
                ViewData["answers"] = OldAnswers;
                ViewData["questions"] = PModel.Questions;
                ViewData["multAnswers"] = PModel.MultipleChoiceAnswers;
                ViewData["result"] = winner + " has been added to the database with a score of " + score.ToString();
                return View("TrainingData");
            }
            else
            {
                ViewData["questions"] = PModel.Questions;
                ViewData["multAnswers"] = PModel.MultipleChoiceAnswers;
                ViewData["isValid"] = "false";
                ViewData["answers"] = Answers;
                ViewData["result"] = "";
                return View("TrainingData");
            }
        }
开发者ID:SMITHSTEPH,项目名称:FundamentalsOfSE,代码行数:50,代码来源:ProcessModelController.cs


注:本文中的System.Web.Mvc.FormCollection.CopyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。