예제 #1
0
 public async Task <HttpResponseMessage> getLayerResource()
 {
     try
     {
         return(Request.CreateResponse(HttpStatusCode.OK, await BasicInfoFunc.getLayerResourceList()));
     }
     catch (Exception SqlException)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Internal Server Error"));
     }
 }
예제 #2
0
 public async Task <HttpResponseMessage> getGPSDataList(GPSInputData parms)
 {
     try
     {
         return(Request.CreateResponse(HttpStatusCode.OK, await BasicInfoFunc.getGPSbyID(parms)));
     }
     catch (Exception SqlException)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Internal Server Error"));
     }
 }
예제 #3
0
 public async Task <HttpResponseMessage> getGPSStationList(Keyword keyword)
 {
     try
     {
         return(Request.CreateResponse(HttpStatusCode.OK, await BasicInfoFunc.getGPSList(keyword)));
     }
     catch (Exception SqlException)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Internal Server Error"));
     }
 }
예제 #4
0
        public async Task <HttpResponseMessage> getUserDrawCase()
        {
            string token  = authFunc.parseTokenFromHeader(this.Request);
            string userid = authFunc.getUserNameByToken_true(token);


            try
            {
                return(Request.CreateResponse(HttpStatusCode.OK, await BasicInfoFunc.getUserDrawCaseList(userid)));
            }
            catch (Exception SqlException)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Internal Server Error"));
            }
        }
예제 #5
0
        public async Task <HttpResponseMessage> UserDrawFeatures_SQL(UserDrawInput UserDraw)
        {
            bool isValidJson = authFunc.IsValidJson(UserDraw);

            string token  = authFunc.parseTokenFromHeader(this.Request);
            string userid = authFunc.getUserNameByToken_true(token);

            if (!isValidJson)
            {
                string message = "非法JSON格式";
                HttpResponseMessage response = Request.CreateErrorResponse(HttpStatusCode.BadRequest, message);
                return(response);
            }

            if (string.IsNullOrEmpty(UserDraw.SQLtype))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Bad Request"));
            }
            else
            {
                UserDraw = authFunc.translateNullIntoEmpty(UserDraw);

                try
                {
                    DateTime myDate     = DateTime.Now;
                    Random   rnd        = new Random();
                    string   drawsaveid = UserDraw.drawsaveid == "" ? "G-" + myDate.ToString("yyyyMMddHHmmss") + "-" + rnd.Next(0, 10).ToString() : UserDraw.drawsaveid;
                    if (UserDraw.features.Count != 0)
                    {
                        for (int i = 0; i < UserDraw.features.Count - 1; i++)
                        {
                            await BasicInfoFunc.UserDrawFeaturesSQL(UserDraw.features[i], userid, UserDraw.SQLtype, UserDraw.title, UserDraw.info, drawsaveid);
                        }
                        return(Request.CreateResponse(HttpStatusCode.OK, await BasicInfoFunc.UserDrawFeaturesSQL(UserDraw.features[UserDraw.features.Count - 1], userid, UserDraw.SQLtype, UserDraw.title, UserDraw.info, drawsaveid)));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, await BasicInfoFunc.UserDrawFeaturesSQL(null, userid, UserDraw.SQLtype, UserDraw.title, UserDraw.info, drawsaveid)));
                    }
                }
                catch (Exception SqlException)
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Internal Server Error"));
                }
            }
        }