Пример #1
0
        /***
         * 删除Event接口
         */
        public static async Task <bool> deleteEvent(String token, String id)
        {
            String jsonStr = JsonConvert.SerializeObject(new { token, id });
            var    res     = await BasicService.postRequestJSON("deleteEvent", jsonStr);

            return(res != null);
        }
Пример #2
0
        /***
         * 登陆接口
         */
        public static async Task <JObject> Login(String account, String password)
        {
            string jsonStr      = JsonConvert.SerializeObject(new { account, password });
            string responseText = await BasicService.postRequestJSON("login", jsonStr);

            return((responseText == null) ? null : (JObject)JsonConvert.DeserializeObject(responseText));
        }
Пример #3
0
        /***
         * 获取Place详情
         */
        public static async Task <PlaceDetailClass> getPlaceDetail(String token, String id)
        {
            string jsonStr   = JsonConvert.SerializeObject(new { token, id });
            var    json      = JsonSerializer.Create();
            String eventsStr = await BasicService.postRequestJSON("getDetailPlace", jsonStr);

            return((eventsStr == null) ? null : json.Deserialize <PlaceDetailClass>(new JsonTextReader(new StringReader(eventsStr))));
        }
Пример #4
0
        /***
         * 获取所有用户拥有的地点
         */
        public static async Task <Places> getAllOwnedPlace(String token)
        {
            string jsonStr   = JsonConvert.SerializeObject(new { token });
            var    json      = JsonSerializer.Create();
            String placesStr = await BasicService.postRequestJSON("getAllOwnedPlaces", jsonStr);

            return(json.Deserialize <Places>(new JsonTextReader(new StringReader(placesStr))));
        }
Пример #5
0
        /***
         * 根据Id获取单个PlaceItem
         */
        public static async Task <PlaceItem> getSingleEvent(String id)
        {
            String jsonStr  = JsonConvert.SerializeObject(new { id });
            String placeStr = await BasicService.postRequestJSON("getSinglePlace", jsonStr);

            var json = JsonSerializer.Create();

            return((placeStr == null) ? null : json.Deserialize <PlaceItem>(new JsonTextReader(new StringReader(placeStr))));
        }
Пример #6
0
        /***
         * 根据Id获取单个EventItem
         */
        public static async Task <EventItem> getSingleEvent(String id)
        {
            String jsonStr  = JsonConvert.SerializeObject(new { id });
            String eventStr = await BasicService.postRequestJSON("getSingleEvent", jsonStr);

            var json = JsonSerializer.Create();

            if (eventStr == null)
            {
                return(null);
            }
            var eventItem = json.Deserialize <EventItem>(new JsonTextReader(new StringReader(eventStr)));

            eventItem.startTime = eventItem.startTime.ToLocalTime();
            eventItem.endTime   = eventItem.endTime.ToLocalTime();
            return(eventItem);
        }
Пример #7
0
        /***
         * 获取Event详情
         */
        public static async Task <EventDetail> getEventDetail(String token, String id)
        {
            string jsonStr   = JsonConvert.SerializeObject(new { token, id });
            var    json      = JsonSerializer.Create();
            String eventsStr = await BasicService.postRequestJSON("getDetailEvent", jsonStr);

            if (eventsStr == null)
            {
                return(null);
            }
            EventDetail eventDetail = json.Deserialize <EventDetail>(new JsonTextReader(new StringReader(eventsStr)));

            eventDetail.detail.startTime = eventDetail.detail.startTime.ToLocalTime();
            eventDetail.detail.endTime   = eventDetail.detail.endTime.ToLocalTime();

            return(eventDetail);
        }
Пример #8
0
        /***
         * 获取所有自己创建的Event
         */
        public static async Task <Events> getAllOwnedEvents(String token)
        {
            string jsonStr   = JsonConvert.SerializeObject(new { token });
            var    json      = JsonSerializer.Create();
            String eventsStr = await BasicService.postRequestJSON("getAllOwnedEvents", jsonStr);

            if (eventsStr == null)
            {
                return(null);
            }
            Events events = json.Deserialize <Events>(new JsonTextReader(new StringReader(eventsStr)));

            foreach (var eventItem in events.events)
            {
                eventItem.startTime = eventItem.startTime.ToLocalTime();
                eventItem.endTime   = eventItem.endTime.ToLocalTime();
            }

            return(events);
        }