Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int     id     = int.Parse(Request["id"]);
            MMTools mm     = new MMTools(Context);
            string  region = mm.GetRegionName(id);

            regionID = mm.GetRegionID(region);

            v1 = Request["v1"];
            v2 = Request["v2"];

            try
            {
                chartFrameSrc = "chart.aspx?id=" + Request["id"] + "&v1=" + v1 + "&v2=" + v2;


                dynamic ideas = mm.ReadIdeas(Context);

                if (v1 != null && v1 != "")
                {
                    var1 = mm.GetVariable(ideas, v1, Context);
                    if (var1 == null)
                    {
                        Response.End();
                        return;
                    }
                }

                if (v2 != null && v2 != "")
                {
                    chartFrameSrc = "loading.aspx";
                    var2          = mm.GetVariable(ideas, v2, Context);
                    if (var2 == null)
                    {
                        Response.End();
                        return;
                    }
                }
            }
            catch (Exception err)
            {
                Response.Write(err.Message.Replace("editbew123", "******"));
                Response.End();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Request["id"]);

            MMTools mm     = new MMTools(Context);
            string  region = mm.GetRegionName(id);

            regionID = mm.GetRegionID(region);

            String url = "http://app01.saeon.ac.za/nccrdapi/api/projects/GetAllFiltered?titlePart=&statusId=0&sectorId=0&typologyId=0&regionId=" + regionID;

            using (WebClient wc = new WebClient())
            {
                results = wc.DownloadString(url);
                JavaScriptSerializer js = new JavaScriptSerializer();
                records = js.DeserializeObject(results);
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request["id"];
            v1 = Request["v1"];
            v2 = Request["v2"];

            GSTool gs = new GSTool(Context);

            feature = gs.GetFeatureDB(Context, int.Parse(id));



            MMTools mm     = new MMTools(Context);
            string  region = mm.GetRegionName(int.Parse(id));

            regionID = mm.GetRegionID(region);
            if (regionID != 0)
            {
                using (HttpClient client = new HttpClient())
                {
                    Uri baseAddress = new Uri("http://app01.saeon.ac.za/nccrdapi/");
                    client.BaseAddress = baseAddress;

                    //Setup post body
                    var postBody = new { polygon = feature.wkt };

                    //Get response
                    var response = client.PostAsync("odata/Projects/Extensions.ByPolygon?$expand=ProjectLocations($expand=Location($select=LatCalculated,LonCalculated))&$select=ProjectId,ProjectTitle,ProjectDescription", new StringContent(new JavaScriptSerializer().Serialize(postBody), Encoding.UTF8, "application/json")).Result;

                    /*
                     * if (!response.IsSuccessStatusCode)
                     * {
                     *  String url = baseAddress + "api/Projects/GetByPolygonPost";
                     *  throw new HttpRequestException(url + "\nPost body:" + postBody);
                     * }
                     */
                    features = response.Content.ReadAsStringAsync().Result;
                }
            }

            dynamic ideas = mm.ReadIdeas(Context);

            if (v1 != null && v1 != "")
            {
                var1 = mm.GetVariable(ideas, v1, Context);
                if (var1 == null)
                {
                    Response.End();
                    return;
                }
            }

            if (v2 != null && v2 != "")
            {
                var2 = mm.GetVariable(ideas, v2, Context);
                if (var2 == null)
                {
                    Response.End();
                    return;
                }
            }
        }