public void TestEditScrum()
        {
            ScrumModel scrumModel = new ScrumModel();
            scrumModel.AnswerList = new System.Collections.ArrayList();

            Answers answers = new Answers();
            answers.Answer = "Test Edit";
            answers.QuestionId = 1;
            answers.UserId = 1;
            answers.AnswerKey = 0;
            scrumModel.AnswerList.Add(answers);

            answers = new Answers();
            answers.Answer = "Test Edit";
            answers.QuestionId = 2;
            answers.UserId = 1;
            answers.AnswerKey = 0;
            scrumModel.AnswerList.Add(answers);

            answers = new Answers();
            answers.Answer = "None";
            answers.QuestionId = 3;
            answers.UserId = 1;
            answers.AnswerKey = 0;
            scrumModel.AnswerList.Add(answers);

            Assert.IsTrue(new ScrumController().EditScrum(scrumModel));
        }
        protected void submit_Click(object sender, EventArgs e)
        {
            ScrumModel scrumModel = new ScrumModel();
            scrumModel.AnswerList = new System.Collections.ArrayList();

            Answers answer = new Answers();
            answer.QuestionId = 1;
            answer.AnswerKey = Convert.ToInt32(Request["AnswerKey"]);
            answer.Answer = txtBoxAnswer1.Text;
            scrumModel.AnswerList.Add(answer);

            answer = new Answers();
            answer.QuestionId = 2;
            answer.AnswerKey = Convert.ToInt32(Request["AnswerKey"]);
            answer.Answer = txtBoxAnswer2.Text;
            scrumModel.AnswerList.Add(answer);

            answer = new Answers();
            answer.QuestionId = 3;
            answer.AnswerKey = Convert.ToInt32(Request["AnswerKey"]);
            answer.Answer = txtBoxAnswer3.Text;
            scrumModel.AnswerList.Add(answer);

            new Controllers.ScrumController().EditScrum(scrumModel);
            Response.Redirect("~/Scrum/ViewScrumData.aspx");
        }
        protected void submit_Click(object sender, EventArgs e)
        {
            User user = (User)Session["User"];
            ScrumModel scrumModel = new ScrumModel();
            scrumModel.AnswerList = new System.Collections.ArrayList();

            Answers answers = new Answers();
            answers.Answer = answer1.Text;
            answers.QuestionId = Convert.ToInt32(answer1.ID);
            answers.UserId = user.UserId;
            scrumModel.AnswerList.Add(answers);

            answers = new Answers();
            answers.Answer = answer2.Text;
            answers.QuestionId = Convert.ToInt32(answer2.ID);
            answers.UserId = user.UserId;
            scrumModel.AnswerList.Add(answers);

            answers = new Answers();
            answers.Answer = answer3.Text;
            answers.QuestionId = Convert.ToInt32(answer3.ID);
            answers.UserId = user.UserId;
            scrumModel.AnswerList.Add(answers);

            bool dataInserted = new ScrumController().InputNewScrum(scrumModel);
            if (dataInserted)
            {
                Session.Add("Message", "The scrum data was successfully entered.");
                Response.Redirect("~/Scrum/ViewScrumData.aspx");
            }
            else
            {
                Message.Text = "There was an error inserting the scrum data.";
            }
        }
Exemple #4
0
 public ScrumModel GetScrumDetails(int AnswerKey)
 {
     ScrumModel scrumModel = new ScrumModel();
     using (SqlConnection sqlConnection = new SqlConnection(Constants.DATABASE.CONNECTION_STRING))
     {
         sqlConnection.Open();
         using (SqlCommand sqlCommand = new SqlCommand("SELECT * FROM ScrumAnswers WHERE AnswerKey=" + AnswerKey, sqlConnection))
         {
             using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
             {
                 if (sqlDataReader.HasRows)
                 {
                     scrumModel.AnswerList = new System.Collections.ArrayList();
                     while (sqlDataReader.Read())
                     {
                         Answers answers = new Answers();
                         answers.QuestionId = Convert.ToInt32(sqlDataReader["QuestionId"]);
                         answers.Answer = Convert.ToString(sqlDataReader["Answer"]);
                         scrumModel.AnswerList.Add(answers);
                     }
                 }
                 sqlDataReader.Close();
             }
         }
         sqlConnection.Close();
     }
     return scrumModel;
 }
        public void TestInputNewScrum()
        {
            ScrumModel scrumModel = new ScrumModel();
            scrumModel.AnswerList = new System.Collections.ArrayList();

            Answers answers = new Answers();
            answers.Answer = "Worked on Unit Test Cases";
            answers.QuestionId = 1;
            answers.UserId = 1;
            scrumModel.AnswerList.Add(answers);

            answers = new Answers();
            answers.Answer = "Worked on Scrum Room";
            answers.QuestionId = 2;
            answers.UserId = 1;
            scrumModel.AnswerList.Add(answers);

            answers = new Answers();
            answers.Answer = "None";
            answers.QuestionId = 3;
            answers.UserId = 1;
            scrumModel.AnswerList.Add(answers);

            Assert.IsTrue(new ScrumController().InputNewScrum(scrumModel));
        }