Exemplo n.º 1
0
        public ActionResult IndexHome(string schoolsubmitButton, string awardsubmitButton)
        {
            //var eGeneralSettings = ACCDataStore.Core.Helper.ConvertHelper.XmlFile2Object(HttpContext.Server.MapPath("~/Config/GeneralSettings.xml"), typeof(GeneralCounter)) as GeneralCounter;
            //eGeneralSettings.CurriculumpgCounter++;
            //TS.Core.Helper.ConvertHelper.Object2XmlFile(eGeneralSettings, HttpContext.Server.MapPath("~/Config/GeneralSettings.xml"));
            var vmWiderAchievement = new WiderAchievementViewModel();

            return(View("Home", vmWiderAchievement));
        }
Exemplo n.º 2
0
        public ActionResult Index(string schoolsubmitButton, string awardsubmitButton, string scqfsubmitButton, string searchButton)
        {
            //var eGeneralSettings = ACCDataStore.Core.Helper.ConvertHelper.XmlFile2Object(HttpContext.Server.MapPath("~/Config/GeneralSettings.xml"), typeof(GeneralCounter)) as GeneralCounter;
            //eGeneralSettings.CurriculumpgCounter++;
            //TS.Core.Helper.ConvertHelper.Object2XmlFile(eGeneralSettings, HttpContext.Server.MapPath("~/Config/GeneralSettings.xml"));
            var vmWiderAchievement = new WiderAchievementViewModel();

            vmWiderAchievement.Listschoolname  = GetListschoolname(this.rpGeneric);
            vmWiderAchievement.Listawardname   = GetListAwardname(this.rpGeneric);
            vmWiderAchievement.Listscqf_rating = GetListSCQFRating(this.rpGeneric);

            List <WiderAchievementObj> temp = new List <WiderAchievementObj>();

            //if (schoolsubmitButton != null)
            //{
            //    var sSchoolname = Request["selectedschoolname"];
            //    vmWiderAchievement.selectedschoolname = sSchoolname;
            //    if (sSchoolname != null)
            //    {
            //        List<WiderAchievementObj> listdata = this.rpGeneric.FindAll<WiderAchievementObj>().ToList();
            //        if (sSchoolname.Equals("Citywide"))
            //        {
            //            if (listdata != null)
            //            {
            //                //temp = (from a in listdata where a.schoolname.Equals(sSchoolname) select a).ToList();
            //                temp = listdata.GroupBy(a => new { a.age_range, a.awardname }).Select(x => new WiderAchievementObj
            //                {
            //                    age_range = x.Key.age_range,
            //                    awardname = x.Key.awardname,
            //                    award2013 = x.Sum(y => y.award2013),
            //                    award2014 = x.Sum(y => y.award2014),
            //                    award2015 = x.Sum(y => y.award2015),
            //                }).ToList();

            //            }

            //            temp = temp.OrderByDescending(x => x.age_range).ThenBy(x => x.awardname).ToList();
            //        }
            //        else
            //        {
            //            if (listdata != null)
            //            {
            //                temp = (from a in listdata where a.centre.Equals(sSchoolname) select a).ToList();

            //            }
            //        }

            //    }
            //}
            //if (awardsubmitButton != null)
            //{
            //    var sAwardname = Request["selectedawardname"];
            //    vmWiderAchievement.selectedawardname = sAwardname;
            //    if (sAwardname != null)
            //    {
            //        List<WiderAchievementObj> listdata = this.rpGeneric.FindAll<WiderAchievementObj>().ToList();
            //        if (listdata != null)
            //        {
            //            temp = (from a in listdata where a.awardname.Equals(sAwardname) select a).ToList();

            //        }

            //    }
            //}
            //if (scqfsubmitButton != null)
            //{
            //    var sScqFname = Request["selectescqf_rating"];
            //    vmWiderAchievement.selectescqf_rating = sScqFname;
            //    if (sScqFname != null)
            //    {
            //        List<WiderAchievementObj> listdata = this.rpGeneric.FindAll<WiderAchievementObj>().ToList();
            //        if (listdata != null)
            //        {
            //            temp = (from a in listdata where a.scqf_rating.Equals(sScqFname) select a).ToList();

            //        }

            //    }
            //}
            if (searchButton != null)
            {
                var sSchoolname = Request["selectedschoolname"];
                vmWiderAchievement.selectedschoolname = sSchoolname;

                var sAwardname = Request["selectedawardname"];
                vmWiderAchievement.selectedawardname = sAwardname;

                var sScqFname = Request["selectescqf_rating"];
                vmWiderAchievement.selectescqf_rating = sScqFname;

                List <WiderAchievementObj> listdata = this.rpGeneric.FindAll <WiderAchievementObj>().ToList();
                if (!sSchoolname.Equals(""))
                {
                    if (sSchoolname.Equals("Aberdeen City"))
                    {
                        if (listdata != null)
                        {
                            //temp = (from a in listdata where a.schoolname.Equals(sSchoolname) select a).ToList();
                            temp = listdata.GroupBy(a => new { a.age_range, a.awardname, a.scqf_rating }).Select(x => new WiderAchievementObj
                            {
                                age_range   = x.Key.age_range,
                                awardname   = x.Key.awardname,
                                scqf_rating = x.Key.scqf_rating,
                                award2013   = x.Sum(y => y.award2013),
                                award2014   = x.Sum(y => y.award2014),
                                award2015   = x.Sum(y => y.award2015),
                                award2016   = x.Sum(y => y.award2016),
                            }).ToList();
                        }

                        temp = temp.OrderByDescending(x => x.age_range).ThenBy(x => x.awardname).ToList();
                    }
                    else
                    {
                        if (listdata != null)
                        {
                            temp = (from a in listdata where a.centre.Equals(sSchoolname) select a).ToList();
                        }
                    }
                }
                if (!sAwardname.Equals(""))
                {
                    if (temp.Count != 0)
                    {
                        temp = (from a in temp where a.awardname.Equals(sAwardname) select a).ToList();
                    }
                    else
                    {
                        temp = (from a in listdata where a.awardname.Equals(sAwardname) select a).ToList();
                    }
                }
                if (!sScqFname.Equals(""))
                {
                    if (temp.Count != 0)
                    {
                        temp = (from a in temp where a.scqf_rating.Equals(sScqFname) select a).ToList();
                    }
                    else
                    {
                        temp = (from a in listdata where a.scqf_rating.Equals(sScqFname) select a).ToList();
                    }
                }
            }



            vmWiderAchievement.Listresults         = temp;
            Session["SessionWiderAchievementData"] = temp;
            Session["sSchoolName"] = vmWiderAchievement.selectedschoolname;

            return(View("index", vmWiderAchievement));
        }