Ejemplo n.º 1
0
        /// <summary>
        /// POSTs the Content of the Bird Survey to the Database
        /// </summary>
        /// <param name="birdSurvey">An object formatted for the Submission</param>
        public void SubmitBirdSurvey(BirdSurvey birdSurvey)
        {
            Uri uri = new Uri(BIRD_SURVEY_POST_URL);

            client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
            string json = JsonConvert.SerializeObject(birdSurvey);

            var returned = client.UploadString(uri, json);

            Console.WriteLine(returned);
        }
        /// <summary>
        /// if the Survey is vaild it
        /// Packages up the infomation into Bird Survey object, That can then be Transformed into a API readable format and then Posts the API Readable format
        /// and Goes back to the main menu
        /// </summary>

        public void SubmitSurvey()
        {
            var newSurvey = new BirdSurvey((DateTime)BADatePicker.Date, (DateTime)BAStartTImePicker.Date,
                                           (DateTime)BAEndTimePicker.Date, SiteMod.GetItem(SiteMod.Selectedindex), Sightings.ToArray(), BACommentText.Text);

            if (newSurvey.VaildforBirdSurvey())
            {
                ServerServices services = new ServerServices();

                services.SubmitBirdSurvey(newSurvey);

                this.NavigationController.PopViewController(true);
            }
        }