Exemplo n.º 1
0
        /// <summary>
        /// Retrieves a paged list of surveys in a user's account.
        /// Notes
        ///     •DateStrings must be in the format YYYY-MM-DD HH:MM:SS.All DateStrings are implicitly in UTC.
        ///     •All start dates are greater than or equal to the date passed in
        ///     •All end dates are strictly less than the date passed in
        /// Endpoints : https://api.surveymonkey.net/v2/surveys/get_survey_list?api_key=your_api_key
        /// Example Request
        ///     curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/get_survey_list/?api_key=your_api_key --data-binary '{"fields":["title","analysis_url","date_created","date_modified"], "start_date":"2013-02-02 00:00:00", "end_date":"2013-04-12 22:43:01", "order_asc":false, "title":"test3"}'
        /// </summary>
        private void BtnGetSurveyList_Click(object sender, EventArgs e)
        {
            GetSurveyListResponse surveys        = null;
            BasicRequestData      brd            = GetRequestFields();
            List <SurveyInfo>     orderedDisplay = null;

            if (chkFull.Checked)
            {
                surveys = SurveyRequest.GetSurveyListFull(brd);
            }
            else
            {
                surveys = SurveyRequest.GetSurveyList(brd);
            }

            lblStatus.Text   = surveys.Status.ToString();
            lblErrorMsg.Text = surveys.ErrorMessage;

            try
            {
                if (rbCreate.Checked)
                {
                    orderedDisplay = surveys.SurveyListResult.SurveyList.OrderBy(dd => dd.DateCreated).ToList <SurveyInfo>();
                }
                else if (rbModify.Checked)
                {
                    orderedDisplay = surveys.SurveyListResult.SurveyList.OrderBy(dd => dd.DateModified).ToList <SurveyInfo>();
                }
                else if (rbTitle.Checked)
                {
                    orderedDisplay = surveys.SurveyListResult.SurveyList.OrderBy(dd => dd.Title).ToList <SurveyInfo>();
                }
                else
                {
                    orderedDisplay = surveys.SurveyListResult.SurveyList.ToList <SurveyInfo>();
                }
                dgvSurveyList.DataSource = orderedDisplay;
            }
            catch { } // do nothing
        }