예제 #1
0
        public ActionResult Compareable()
        {
            // counter for paage visit
            var eGeneralSettings = ACCDataStore.Core.Helper.ConvertHelper.XmlFile2Object(HttpContext.Server.MapPath("~/Config/GeneralSettings.xml"), typeof(GeneralCounter)) as GeneralCounter;

            eGeneralSettings.EthinicBGpgCounter++;
            ACCDataStore.Core.Helper.ConvertHelper.Object2XmlFile(eGeneralSettings, HttpContext.Server.MapPath("~/Config/GeneralSettings.xml"));

            var vmEthnicbackground2 = new EthnicBgViewModel2();

            var schoolname = new List <string>();

            var sethnicityCriteria = new List <string>();
            var setGenderCriteria  = new List <string>();


            List <EthnicObj> ListEthnicData  = new List <EthnicObj>();
            List <EthnicObj> ListEthnicData2 = new List <EthnicObj>();
            List <EthnicObj> temp            = new List <EthnicObj>();

            var listResult = this.rpGeneric.FindSingleColumnByNativeSQL("SELECT DISTINCTROW Name FROM test_3 group by Name");

            List <string> fooList = listResult.OfType <string>().ToList();

            vmEthnicbackground2.ListSchoolNameData  = fooList;
            vmEthnicbackground2.ListSchoolNameData2 = fooList;


            listResult = this.rpGeneric.FindSingleColumnByNativeSQL("SELECT DISTINCTROW EthnicBackground FROM test_3 group by EthnicBackground");

            fooList = listResult.OfType <string>().ToList();

            vmEthnicbackground2.ListEthnicCode = fooList;
            vmEthnicbackground2.DicEthnicBG    = GetDicEhtnicBG();

            listResult = this.rpGeneric.FindSingleColumnByNativeSQL("SELECT DISTINCTROW Gender FROM test_3 group by Gender");

            fooList = listResult.OfType <string>().ToList();
            fooList.Add("T");
            vmEthnicbackground2.ListGenderCode = fooList;
            vmEthnicbackground2.DicGender      = GetDicGender();


            //vmEthnicbackground2.listGender = new List<GenderObj> { new GenderObj("1", "F", "Female"), new GenderObj("2", "M", "Male"), new GenderObj("3", "T", "Total") };
            //vmEthnicbackground2.listSelectedGender = new List<GenderObj> { new GenderObj("1", "F", "Female"), new GenderObj("2", "M", "Male") };

            var sSchoolName1 = Request["selectedschoolname"];

            var sSchoolName2 = Request["selectedschoolname2"];

            if (sSchoolName1 == null && sSchoolName2 == null)
            {
                sSchoolName1 = vmEthnicbackground2.ListSchoolNameData[0];  //set default schoolname
                sSchoolName2 = vmEthnicbackground2.ListSchoolNameData2[1]; //set default schoolname
            }

            vmEthnicbackground2.selectedschoolname  = sSchoolName1;
            vmEthnicbackground2.selectedschoolname2 = sSchoolName2;

            Session["sSchoolName"]  = vmEthnicbackground2.selectedschoolname;
            Session["sSchoolName2"] = vmEthnicbackground2.selectedschoolname2;


            if (Request["ethnicity"] != null)
            {
                sethnicityCriteria = Request["ethnicity"].Split(',').ToList();
            }
            else
            {
                sethnicityCriteria = null;
            }
            if (Request["gender"] != null)
            {
                vmEthnicbackground2.ListSelectedGender = Request["gender"].Split(',').ToList();
                //vmEthnicbackground2.listSelectedGender = new List<GenderObj> { new GenderObj("1", "F", "Female"), new GenderObj("2", "M", "Male") };
            }
            else
            {
                vmEthnicbackground2.ListSelectedGender = vmEthnicbackground2.ListGenderCode;
                //vmEthnicbackground2.listSelectedGender = new List<GenderObj> { new GenderObj("1", "F", "Female"), new GenderObj("2", "M", "Male"), new GenderObj("3", "T", "Total") };
            }

            vmEthnicbackground2.ListSelectedEthnicBg = sethnicityCriteria;
            Session["ListSelectedGender"]            = vmEthnicbackground2.ListSelectedGender;
            // get parameter from Request object


            vmEthnicbackground2.DicGenderWithSelected = GetDicGenderWithSelected(vmEthnicbackground2.ListSelectedGender);

            //calculate number of selectedschool
            if (sSchoolName1.Equals("") && sSchoolName2.Equals(""))
            {
                vmEthnicbackground2.NoSelectedSchool = 0;
            }
            else if (sSchoolName1.Equals(sSchoolName2))
            {
                vmEthnicbackground2.NoSelectedSchool = 1;
            }
            else if (sSchoolName1.Equals("") || sSchoolName2.Equals(""))
            {
                vmEthnicbackground2.NoSelectedSchool = 1;
            }
            else
            {
                vmEthnicbackground2.NoSelectedSchool = 2;
            }

            // process data
            if (sSchoolName1.Equals("") && sSchoolName2.Equals(""))
            {
                vmEthnicbackground2.IsShowData = false;
            }
            else if (sSchoolName1 != null && sSchoolName2 != null)
            {
                ListEthnicData  = GetEthnicityDatabySchoolname(rpGeneric, sSchoolName1);
                ListEthnicData2 = GetEthnicityDatabySchoolname(rpGeneric, sSchoolName2);
                if (sethnicityCriteria == null)
                {
                    vmEthnicbackground2.IsShowData = false;
                }
                else if (sethnicityCriteria.Count != 0 && sethnicityCriteria != null)
                {
                    vmEthnicbackground2.IsShowData      = true;
                    vmEthnicbackground2.ListEthnicData  = ListEthnicData.Where(x => sethnicityCriteria.Contains(x.EthinicCode)).ToList();
                    vmEthnicbackground2.ListEthnicData2 = ListEthnicData2.Where(x => sethnicityCriteria.Contains(x.EthinicCode)).ToList();
                }
                else
                {
                    vmEthnicbackground2.IsShowData      = true;
                    vmEthnicbackground2.ListEthnicData  = ListEthnicData;
                    vmEthnicbackground2.ListEthnicData2 = ListEthnicData2;
                }
                Session["SessionListEthnicData"]  = vmEthnicbackground2.ListEthnicData;
                Session["SessionListEthnicData2"] = vmEthnicbackground2.ListEthnicData2;
            }


            return(View("index2", vmEthnicbackground2));
        }
예제 #2
0
        public ActionResult Index2()
        {
            var vmEthnicBg2 = new EthnicBgViewModel2();

            return(View("index2", vmEthnicBg2));
        }