Exemple #1
0
        //int[] scenarios
        //for Edit get //top 1/3 to edit Votes
        public ScenarioListForVotes populateScenatioListVotes(long projectID)
        {
            var vmodel = ScenarioViewModel.CreateTopThird(scenarioRepository, projectID);
            var slist = new ScenarioListForVotes();
            slist.ScenariosForVotes = new List<ScenarioForVotes>();
            slist.projectID = projectID;
            var sToAdd = new ScenarioForUtil();

            //add items from view model
            foreach (var s in vmodel.ScenariosList)
            {
                slist.ScenariosForVotes.Add(new ScenarioForVotes
                {
                    scenarioID = s.ID,
                    Name = s.Name,
                    Description = s.Description,
                    Votes = s.Votes == null ? 0 : s.Votes
                });
            }
            return slist;
        }
Exemple #2
0
        //int[] scenarios
        //Get: /Utility/Edit?projID=1     top 1/3 to add util descriptions-
        public ScenarioList populateScenatioList(long projectID)
        {
            var slist = new ScenarioList();
            var vmodel = ScenarioViewModel.CreateTopThird(scenarioRepository, projectID);
            slist.ScenariosForUtilUpdate = new List<ScenarioForUtil>();
            slist.projectID = projectID;
            var sToAdd = new ScenarioForUtil();

            //add items from view model
            foreach (var s in vmodel.ScenariosList)
            {
                slist.ScenariosForUtilUpdate.Add(new ScenarioForUtil
                {
                    scenarioID = s.ID,
                    Name = s.Name,
                    Description = s.Description,
                    utilities = new List<util>(),
                });
                //order utilities according to QualityAttribute order
                var utils = s.Utilities.OrderBy(x => x.QualityAttributeResponseType.Order);
                foreach (var u in utils)
                {//Utilities to Scenario
                    //add utilities to last added scenario in ScenariosForUtilUpdate list
                    slist.ScenariosForUtilUpdate[slist.ScenariosForUtilUpdate.Count - 1].utilities.Add(new util
                    {
                        ID = u.ID,
                        Description = u.Description,
                        QualityAttributeResponseTypeType = u.QualityAttributeResponseType.Type
                    });
                }//end util for loop
            }//end scenario for

            return slist;
        }