Beispiel #1
0
        public void ProcessRequest(HttpContext context)
        {
            JsonRet jsonRet            = new JsonRet();
            JavaScriptSerializer gjson = new JavaScriptSerializer();

            string method = string.Empty;

            try
            {
                method = context.Request.Params["method"];
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["statisticsCore"].ToString();

                if (method == "IS_INSIDE")
                {
                    string wktToValidate = context.Request.Params["wkt"];
                    string idScope       = context.Request.Params["idScope"];

                    UtilsGeoDAO dao    = new UtilsGeoDAO(connectionString);
                    string      result = dao.IsInsideGeometry(wktToValidate, idScope);

                    jsonRet.Code = 100;
                    jsonRet.Msg  = "OK";
                    jsonRet.Obj  = result;
                }
                else if (method == "GET_SCOPE_GEOMETRY")
                {
                    string scope   = context.Request.Params["scope"];
                    string idScope = context.Request.Params["idScope"];

                    UtilsGeoDAO dao      = new UtilsGeoDAO(connectionString);
                    GeometryWKT geometry = dao.GetGeometryWKT(scope, idScope);

                    jsonRet.Code = 100;
                    jsonRet.Msg  = "OK";
                    jsonRet.Obj  = geometry;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                var json = gjson.Serialize(jsonRet);
                context.Response.ContentType = "text/json";
                context.Response.Write(json);
            }
        }
Beispiel #2
0
        public string CourseListAjax(string text)
        {
            List <JsonRet> output = new List <JsonRet>();

            var selectedList = db.Clients.Where(x => x.NIC.StartsWith(text)).ToList();

            foreach (var VARIABLE in selectedList)
            {
                JsonRet ttt = new JsonRet();
                ttt.value = VARIABLE.Id.ToString();
                ttt.label = VARIABLE.Name;

                output.Add(ttt);
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            return(js.Serialize(output));
        }