Example #1
0
        public List <string> GetDemographicsWhereThereIsAssociation()
        {
            List <string> demographicsWithAssociation = new List <string>();
            List <int>    FOT = new FunctionalOrganizationTypesServices().GetByCompany(Test.Company_Id).Select(fot => fot.Id).ToList();
            //List<int> countriesId = new CountriesServices().GetCountriesByTest(Test);
            CountriesServices countryService = new CountriesServices();
            FunctionalOrganizationTypesServices FOTService = new FunctionalOrganizationTypesServices();
            ChiSquare cs;

            foreach (string demographic in DemographicNames.Keys) //recorro los demograficos
            {
                if (demographic == "FunctionalOrganizationType")  //si el demografico actual es una estructura funcional
                {
                    foreach (int type in FOT)
                    {
                        cs = new ChiSquare(Test, demographic, null, null, null, null, type, 0.05, country, state, region);
                        GetConclusion(demographicsWithAssociation, cs, demographic, FOTService.GetById(type).Name);
                    }
                }
                else
                {
                    cs = new ChiSquare(Test, demographic, null, null, null, 0.05, country, state, region);
                    GetConclusion(demographicsWithAssociation, cs, demographic, "");
                }
            }
            if (demographicsWithAssociation.Count > 0)
            {
                return(demographicsWithAssociation);
            }
            else
            {
                return(null);
            }
        }
        public ActionResult ClimateStateMap(int country_id, int?test_id)
        {
            Country c = new CountriesServices().GetById(country_id);

            Session["test_id"]      = test_id;
            Session["country_id"]   = country_id;
            Session["country_name"] = c.Name;
            Session["urlMap"]       = c.Map;
            return(View());
        }
Example #3
0
        private void PointProperties(ref DataPoint point, KeyValuePair <string, double> value)
        {
            //demographic != "General" &&
            bool   SetColorPoint = !(demographic == "Comparative" && compare_id == 0) && demographic != "Bivariate"; //para saber si le voy a cambiar el color
            double num           = (double)value.Value;                                                              //se pasa a numerico porque se necesita hacer un porcentaje
            double numShow       = (new TestsServices().GetById(test_id).ResultBasedOn100&& chartType != "Bar" && chartType != "Pie" &&
                                    !(demographic == "Comparative" && compare_id == 0)) ? (num * 100 / options) : num;

            //point.YValues = new double[] { double.Parse(value.Value.ToString()) };
            point.YValues = new double[] { numShow };
            if (compare_id != 0 && value.Key == new TestsServices().GetById(test_id).Name)//en vez de colocar el nombre que trae el diccionario coloque General
            {
                point.AxisLabel  = "General";
                point.LegendText = "General";
            }
            else if (demographic == "" && chartType == "Pie")
            {
                string viewres = "";
                if (value.Key == "Received")
                {
                    viewres = ViewRes.Classes.Services.EvaluationsReceived;
                }
                else
                {
                    viewres = ViewRes.Classes.Services.EvaluationsNoReceived;
                }
                point.AxisLabel  = viewres;
                point.LegendText = viewres;
            }
            else if (demographic == "Gender" && chartType == "Pie")
            {
                string viewres = "";
                if (value.Key == "Female")
                {
                    viewres = ViewRes.Views.Shared.Shared.Female;
                }
                else
                {
                    viewres = ViewRes.Views.Shared.Shared.Male;
                }
                point.AxisLabel  = viewres;
                point.LegendText = viewres;
                point.Color      = value.Key == "Female" ? Color.HotPink : Color.DeepSkyBlue;
            }
            else
            {
                point.AxisLabel  = value.Key;
                point.LegendText = value.Key.ToString();
            }
            double pct;

            if (series == 1)//si series == 1 es porque es una torta o pie
            {
                pct = num * 100 / total;
                if (num > 0)
                {
                    point.Label = pct.ToString("f2") + "% (" + num + ")";
                }
                else
                {
                    point.Label = " ";
                }
            }
            else
            {
                if (num > 0)
                {
                    //double numShow = (new TestsServices().GetById(test_id).ResultBasedOn100 && chartType != "Bar"
                    //                    && !(demographic == "Comparative" && compare_id == 0)) ? (num * 100 / options) : num;
                    point.Label = chartType != "Bar" && !(demographic == "Comparative" && compare_id == 0) ? numShow.ToString("f2") : numShow.ToString("f0");
                }
                else
                {
                    point.Label = "";
                }
            }
            point.Font = new Font("Verdana,Arial,Helvetica,sans-serif", 7F - minus, FontStyle.Bold);
            if (SetColorPoint && options > 0)//si se le cambia el color a los colores del semanforo,del demografico
            {
                if (!first)
                {
                    point.BackHatchStyle = ChartHatchStyle.BackwardDiagonal;
                }
                point.Color = GetColorPoint(num);
            }

            Country country = new CountriesServices().GetByName(value.Key.ToString());

            if (country != null)
            {
                string tooltip;
                if (series == 1)
                {
                    tooltip   = "<img src=/ChartReports/StatesPercentageChart?chartSize=Tooltip&chartType=Pie&graphic_id=24&country_id=" + country.Id + "&test_id=" + test_id + " />";
                    point.Url = "/ChartReports/StatesPercentageChart?chartSize=Screen&chartType=Pie&graphic_id=24&country_id=" + country.Id + "&test_id=" + test_id;
                }
                else
                {
                    string report = chartType == "Bar" ? "Frequency" : "UniVariate";
                    if (compare_id != 0 && !countryTooltip)
                    {
                        countryTooltip = true;
                        tooltip        = "<img src=/ChartReports/UniVariateChartByState?chartSize=Tooltip&chartType=Column&graphic_id=25&country_id=" + country.Id + "&test_id=" + compare_id + " />";
                    }
                    else
                    {
                        tooltip = "<img src=/ChartReports/" + report + "ChartByState?chartSize=Tooltip&chartType=" + chartType + "&graphic_id=25&country_id=" + country.Id + "&test_id=" + test_id + " />";
                    }
                    point.Url = "/ChartReports/" + report + "ChartByState?chartSize=Screen&chartType=" + chartType + "&graphic_id=25&country_id=" + country.Id + "&test_id=" + test_id;
                }
                point.MapAreaAttributes = "onmouseover=\"DisplayTooltip('" + tooltip + "');\" onmouseout=\"DisplayTooltip('');\"";
            }
        }
Example #4
0
        public IEnumerable <string> Get()
        {
            CountriesServices app = new CountriesServices();

            return(new string[] { "value1", app.getCountry() });
        }
 public CountriesController(CountriesServices _countryService)
 {
     this._countryService = _countryService;
 }
 public CountriesController()
 {
     _countryService = new CountriesServices();
 }