Beispiel #1
0
        /// <summary>
        /// Retrieves a paged list of templates provided by Survey Monkey.
        /// Notes
        ///     If templates are returned that the user cannot access, the `upgrade_info` dictionary will be returned
        /// Endpoint : https://api.surveymonkey.net/v2/templates/get_template_list?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/templates/get_template_list?api_key=your_api_key --data-binary '{"page": 1, "page_size": 10, "language_id": 1, "category_id": "131", "fields" : ["title"]}'
        /// </summary>
        public GetTemplateListResponse GetTemplateList(BasicRequestData requestData)
        {
            JsonResponse = MakeApiRequest(GET_TEMPLATE_LIST, requestData);
            GetTemplateListResponse surveyList = JsonConvert.DeserializeObject <GetTemplateListResponse>(JsonResponse);

            return(surveyList);
        }
Beispiel #2
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
        /// Endpoint : 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>
        public GetSurveyDetailsResponse GetSurveyDetails(BasicRequestData requestData)
        {
            JsonResponse = MakeApiRequest(GET_SURVEY_DETAILS, requestData);
            GetSurveyDetailsResponse surveyList = JsonConvert.DeserializeObject <GetSurveyDetailsResponse>(JsonResponse);

            return(surveyList);
        }
Beispiel #3
0
        /// <summary>
        /// Takes a list of respondent ids and returns the responses that correlate to them.To be used with 'get_survey_details'
        /// Notes
        ///     Surveys with over 500,000 reponses are not available via the API currently
        ///     Text responses returned are truncated after 32,768 characters
        ///     Max number of respondents per call is 100
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_responses?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/get_responses/?api_key=your_api_key --data-binary '{"survey_id":"103994756", "respondent_ids": ["2503019027", "2500039028", "2500039029", "2503019064"]}'
        /// </summary>
        public GetResponsesResponse GetResponses(BasicRequestData requestData)
        {
            JsonResponse = MakeApiRequest(GET_RESPONSES, requestData);
            GetResponsesResponse surveyList = JsonConvert.DeserializeObject <GetResponsesResponse>(JsonResponse);

            return(surveyList);
        }
Beispiel #4
0
        /// <summary>
        /// Retrieves a paged list of surveys in a user's account with all template items filled.
        /// 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
        public GetSurveyListResponse GetSurveyListFull(BasicRequestData requestData)
        {
            string[] fData = { "title", "analysis_url", "preview_url", "date_created", "date_modified", "language_id", "question_count", "num_responses" };
            requestData.Fields = fData;

            return(GetSurveyList(requestData));
        }
Beispiel #5
0
        /// <summary>
        ///  Generic API request.  When only Basic Request Data is required.
        /// </summary>
        /// <returns></returns>
        private string MakeApiRequest(string endPoint, BasicRequestData data)
        {
            string url = BaseURL + endPoint;
            var    serializedParameters = JsonConvert.SerializeObject(data);

            return(MakeApiRequest(url, serializedParameters));
        }
Beispiel #6
0
        /// <summary>
        /// Retrieves a paged list of respondents for a given survey and optionally collector
        /// Notes
        ///     Surveys with over 500,000 respondents will not be returned
        ///     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 date passed in
        ///     Basic users will only have the first 100 responses returned and will have the upgrade\_info dictionary
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_respondent_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_respondent_list/?api_key=your_api_key --data-binary '{"survey_id": "100399456", "fields":["collector_id", "url", "open", "type", "name", "date_created", "date_modified"], "start_date":"2013-02-05 00:00:00", "end_date":"2013-04-16 22:47:00", "order_asc":true, "page_size":1, "page":2}'
        /// </summary>
        private void BtnGetRespondentList_Click(object sender, EventArgs e)
        {
            GetRespondentListResponse respondent;
            BasicRequestData          brd = GetRequestFields();

            if (brd.SurveyID == null)
            {
                MessageBox.Show("no survey id specified.  Going to get error back.");
            }

            if (chkFull.Checked)
            {
                respondent = SurveyRequest.GetRespondentListFull(brd);
            }
            else
            {
                respondent = SurveyRequest.GetRespondentList(brd);
            }

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

            try
            {
                dgvSurveyList.DataSource = respondent.RespondantListResult.RespondantList;
            }
            catch { } // do nothing
        }
Beispiel #7
0
        /// <summary>
        /// Retrieves a paged list of collectors for a survey 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
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_collector_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_collector_list/?api_key=your_api_key --data-binary '{"survey_id": "100399456", "fields":["collector_id", "url", "open", "type", "name", "date_created", "date_modified"], "start_date":"2013-02-05 00:00:00", "end_date":"2013-04-16 22:47:00", "order_asc":true, "page_size":1, "page":2}'
        /// </summary>
        public GetCollectorListResponse GetCollectorList(BasicRequestData requestData)
        {
            JsonResponse = MakeApiRequest(GET_COLLECTOR_LIST, requestData);
            GetCollectorListResponse surveyList = JsonConvert.DeserializeObject <GetCollectorListResponse>(JsonResponse);

            return(surveyList);
        }
Beispiel #8
0
        /// <summary>
        /// Retrieves a paged list of collectors for a survey in a user's account with all template items filled
        /// 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
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_collector_list?api_key=your_api_key
        /// </summary>
        public GetCollectorListResponse GetCollectorListFull(BasicRequestData requestData)
        {
            // url, open, type, name, date_created, date_modified
            string[] fData = { "url", "open", "type", "name", "date_created", "date_modified" };
            requestData.Fields = fData;

            return(GetCollectorList(requestData));
        }
Beispiel #9
0
        /// <summary>
        /// Retrieves a paged list of templates with all template items filled out provided by Survey Monkey.
        /// Notes
        ///     If templates are returned that the user cannot access, the `upgrade_info` dictionary will be returned
        /// Endpoint : https://api.surveymonkey.net/v2/templates/get_template_list?api_key=your_api_key
        /// </summary>
        public GetTemplateListResponse GetTemplateListFull(BasicRequestData requestData)
        {
            string[] fData = { "title", "short_description", "preview_url",                  "date_created", "date_modified", "language_id", "question_count"
                               ,        "long_description",  "is_available_to_current_user", "is_featured",  "is_certified",  "page_count"
                               ,        "category_id",       "category_name",                "category_description" };
            requestData.Fields = fData;

            return(GetTemplateList(requestData));
        }
Beispiel #10
0
        /// <summary>
        /// Retrieves a paged list of respondents for a given survey and optionally collector with all template items filled
        /// Notes
        ///     Surveys with over 500,000 respondents will not be returned
        ///     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 date passed in
        ///     Basic users will only have the first 100 responses returned and will have the upgrade\_info dictionary
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_respondent_list?api_key=your_api_key
        /// </summary>
        public GetRespondentListResponse GetRespondentListFull(BasicRequestData requestData)
        {
            // url, open, type, name, date_created, date_modified
            string[] fData = { "date_start", "date_modified", "collector_id", "collection_mode", "custom_id", "email"
                               ,             "first_name",    "last_name",    "ip_address",      "status",    "analysis_url", "recipient_id" };
            requestData.Fields = fData;

            return(GetRespondentList(requestData));
        }
Beispiel #11
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>
        public GetSurveyListResponse GetSurveyList(BasicRequestData requestData)
        {
            if (requestData.SurveyTitle != null)
            {
                requestData.Title       = requestData.SurveyTitle;
                requestData.SurveyTitle = null;
            }
            JsonResponse = MakeApiRequest(GET_SURVEY_LIST, requestData);
            GetSurveyListResponse surveyList = JsonConvert.DeserializeObject <GetSurveyListResponse>(JsonResponse);

            return(surveyList);
        }
        public BasicTabViewModel(ValidationFacade validations)
        {
            /// Inject dependencies
            this.validations = validations;

            /// Initialize properties
            Status = new RenameStatus();
            Data   = new BasicRequestData("", 1, 1);
            Mode   = new BasicRequestMode(false, true, IndexPlacement.Prefix);

            RegisterValidations();
        }
Beispiel #13
0
        public List <string> GetNewFileNames(string directory, ObservableCollection <MyFile> currentFiles,
                                             BasicRequestData data, BasicRequestMode mode)
        {
            var newFileNames = new List <string>();
            int idx          = data.StartIndex;

            foreach (var file in currentFiles)
            {
                // Resolve new name
                string newFileName = resolver.GetNewName(file.Name, idx, data.Name, mode);
                // Add new file to collection
                newFileNames.Add(newFileName);
                idx += data.Step;
            }
            return(newFileNames);
        }
Beispiel #14
0
 /// <summary>
 /// Adds new ResponseResults to the existing list
 /// </summary>
 /// <param name="responses">batch of responses to a survey</param>
 /// <param name="brd"></param>
 /// <param name="isProcessed">Whether the first hundred responses have been processed</param>
 /// <returns></returns>
 private GetResponsesResponse GetRespondenses(GetResponsesResponse responses, BasicRequestData brd, bool isProcessed)
 {
     if (!isProcessed)
     {
         return(SurveyRequest.GetResponses(brd));
     }
     else
     {
         GetResponsesResponse      temp = SurveyRequest.GetResponses(brd);
         List <GetResponsesResult> newResponsesResultList = new List <GetResponsesResult>();
         newResponsesResultList.AddRange(responses.ResponseResultList);
         newResponsesResultList.AddRange(temp.ResponseResultList);
         responses.ResponseResultList = newResponsesResultList.ToArray();
         return(responses);
     }
 }
Beispiel #15
0
        /// <summary>
        /// Takes a list of respondent ids and returns the responses that correlate to them.To be used with 'get_survey_details'
        /// Notes
        ///     Surveys with over 500,000 reponses are not available via the API currently
        ///     Text responses returned are truncated after 32,768 characters
        ///     Max number of respondents per call is 100
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_responses?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/get_responses/?api_key=your_api_key --data-binary '{"survey_id":"103994756", "respondent_ids": ["2503019027", "2500039028", "2500039029", "2503019064"]}'
        /// </summary>
        private void BtnGetResponses_Click(object sender, EventArgs e)
        {
            GetSurveyDetailsResponse  surveyDetails;
            GetResponsesResponse      responses;
            GetRespondentListResponse respondent;

            BasicRequestData   brd          = GetRequestFields();
            SurveyQuestionView surveyView   = new SurveyQuestionView();
            ResponseView       responseView = new ResponseView();

            if (brd.SurveyID == null)
            {
                MessageBox.Show("no survey id specified.  Going to get error back.");
            }

            try
            {
                if ((brd.RespondentIDList == null) && (brd.RespondentIDList.Length == 0))
                {
                    MessageBox.Show("no respondants specified.  May be error, or empty return.");
                }

                surveyDetails = SurveyRequest.GetSurveyDetails(brd);
                respondent    = SurveyRequest.GetRespondentListFull(brd);
                responses     = SurveyRequest.GetResponses(brd);
                surveyView.LoadSurvey(surveyDetails);

                responseView.Flatten(responses.ResponseResultList, respondent.RespondantListResult.RespondantList, surveyView);

                //List<ResponseWithAnswer> ResponseAnswerList { get; set; }


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

                try
                {
                    dgvSurveyList.DataSource = responseView.ResponseAnswerList; //respondent.ResponseResultList;
                }
                catch { } // do nothing
            }
            catch
            {
                MessageBox.Show("ERROR with respondants specified.  No data submitted to SurveyMonkey");
            }
        }
Beispiel #16
0
        /// <summary>
        /// Returns basic information about the logged-in user
        /// Endpoint : https://api.surveymonkey.net/v2/user/get_user_details?api_key=your_api_key
        /// Example Request
        ///     curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/user/get_user_details/?api_key=your_api_key
        /// </summary>
        private void BtnGetUserDetails_Click(object sender, EventArgs e)
        {
            GetUserDetailsResponse surveyDetails;
            BasicRequestData       brd = new BasicRequestData();

            surveyDetails = SurveyRequest.GetUserDetails(brd);

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

            try
            {
                List <GetUserDetailsResult> sdrList = new List <GetUserDetailsResult>();
                sdrList.Add(surveyDetails.UserDetailsResult);
                dgvSurveyList.DataSource = sdrList;
            }
            catch { } // do nothing
        }
Beispiel #17
0
        /// <summary>
        /// Create a survey based on template or existing survey.
        /// Notes
        ///     You cannot specify both template\_id and from\_survey\_id
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/create_survey?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/create_survey?api_key=your_api_key --data-binary '{"template_id": "568", "survey_title": "Ice and Fire Event"}'
        /// </summary>
        private void BtnCreateSurvey_Click(object sender, EventArgs e)
        {
            CreateSurveyResponse survey;
            BasicRequestData     brd = GetRequestFields();

            survey = SurveyRequest.CreateSurvey(brd);

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

            List <SurveyInfo> sInfoList = new List <SurveyInfo>();

            try
            {
                sInfoList.Add(survey.Survey);
                dgvSurveyList.DataSource = sInfoList;
            }
            catch { } // do nothing
        }
Beispiel #18
0
        /// <summary>
        /// Create a survey based on template or existing survey.
        /// Notes
        ///     You cannot specify both template\_id and from\_survey\_id
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/create_survey?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/create_survey?api_key=your_api_key --data-binary '{"template_id": "568", "survey_title": "Ice and Fire Event"}'
        /// </summary>
        public CreateSurveyResponse CreateSurvey(BasicRequestData requestData)
        {
            CreateSurveyResponse surveyList;
            BasicRequestData     thisRequest = new BasicRequestData();

            // This request expects a from_survey_id not the standard survey_id
            if (requestData.SurveyID != null)
            {
                requestData.FromSurveyID = requestData.SurveyID;
                requestData.SurveyID     = null;
            }

            // This request can only take one of FromSurveyID or TemplateID not both
            if ((requestData.FromSurveyID != null) && (requestData.TemplateID != null))
            {
                surveyList              = new CreateSurveyResponse();
                surveyList.Status       = -2;
                surveyList.ErrorMessage = "Specify either from_survey_id or template_id, not both.";
            }
            else if (requestData.SurveyTitle == null)
            {
                surveyList              = new CreateSurveyResponse();
                surveyList.Status       = -3;
                surveyList.ErrorMessage = "Survey Title (survey_title) is required for this call.";
            }
            else if ((requestData.FromSurveyID == null) && (requestData.TemplateID == null))
            {
                surveyList              = new CreateSurveyResponse();
                surveyList.Status       = -4;
                surveyList.ErrorMessage = "One of from_survey_id or template_id must be specified for this call.";
            }
            else
            {
                thisRequest.FromSurveyID = requestData.FromSurveyID;
                thisRequest.TemplateID   = requestData.TemplateID;
                thisRequest.SurveyTitle  = requestData.SurveyTitle;
                JsonResponse             = MakeApiRequest(CREATE_SURVEY, requestData);
                surveyList = JsonConvert.DeserializeObject <CreateSurveyResponse>(JsonResponse);
            }

            return(surveyList);
        }
Beispiel #19
0
        /// <summary>
        /// Retrieve a given survey's metadata.
        /// Notes
        ///     •Surveys with over 200 survey pages will not be returned
        ///     •Surveys with over 1000 questions will not be returned
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_survey_details?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_details/?api_key=your_api_key --data-binary '{"survey_id":"100399456"}'
        /// </summary>
        private void BtnGetSurveyDetails_Click(object sender, EventArgs e)
        {
            GetSurveyDetailsResponse surveyDetails;
            BasicRequestData         brd        = new BasicRequestData();
            SurveyQuestionView       surveyView = new SurveyQuestionView();

            if (txtSurveyID.Text.Trim().Length > 0)
            {
                brd.SurveyID = txtSurveyID.Text;
            }
            else
            {
                brd.SurveyID = null;
            }

            if (brd.SurveyID == null)
            {
                MessageBox.Show("no survey id specified.  Going to get error back.");
            }

            surveyDetails = SurveyRequest.GetSurveyDetails(brd);

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

            try
            {
                if (chkSurveyAnswers.Checked)
                {
                    surveyView.LoadSurvey(surveyDetails);
                    dgvSurveyList.DataSource = surveyView.SurveyWithAnswers;
                }
                else
                {
                    List <SurveyTInfo> sdrList = new List <SurveyTInfo>();
                    sdrList.Add(surveyDetails.SurveyDetailsResult);
                    dgvSurveyList.DataSource = sdrList;
                }
            }
            catch { } // do nothing
        }
Beispiel #20
0
        public CommittedChange Rename(string directory, ObservableCollection <MyFile> currentFiles,
                                      BasicRequestData data, BasicRequestMode mode)
        {
            var currentFileNames = currentFiles.Select(file => file.Name).ToList();
            // Process request
            var newFileNames = GetNewFileNames(directory, currentFiles, data, mode);

            // Perform rename
            renamer.Rename(directory, currentFiles.Select(file => file.Name), newFileNames);
            // Update current files
            currentFiles.Clear();
            foreach (var newFileName in newFileNames)
            {
                var newFile = fileInfoService.GetMyFile(Path.Combine(directory, newFileName));
                currentFiles.Add(newFile);
            }
            // ReturUserControl1.xamln committed change
            var change = new CommittedChange(directory, currentFileNames, newFileNames, data.GetCopy(), mode.GetCopy());

            return(change);
        }
Beispiel #21
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
        }
Beispiel #22
0
        /// <summary>
        /// Retrieves a paged list of templates provided by Survey Monkey.
        /// Notes
        ///     If templates are returned that the user cannot access, the `upgrade_info` dictionary will be returned
        /// Endpoint : https://api.surveymonkey.net/v2/templates/get_template_list?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/templates/get_template_list?api_key=your_api_key --data-binary '{"page": 1, "page_size": 10, "language_id": 1, "category_id": "131", "fields" : ["title"]}'
        /// </summary>
        private void BtnGetTemplateList_Click(object sender, EventArgs e)
        {
            GetTemplateListResponse templates;
            BasicRequestData        brd = GetRequestFields();

            if (chkFull.Checked)
            {
                templates = SurveyRequest.GetTemplateListFull(brd);
            }
            else
            {
                templates = SurveyRequest.GetTemplateList(brd);
            }

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

            try
            {
                dgvSurveyList.DataSource = templates.TemplateListResult.TemplateInfoList;
            }
            catch { } // do nothing
        }
Beispiel #23
0
        /// <summary>
        /// Returns how many respondents have started and/or completed the survey for the given collector.
        /// Endpoint : https://api.surveymonkey.net/v2/surveys/get_response_counts?api_key=your_api_key
        /// Example Request
        /// curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/surveys/get_response_counts/?api_key=your_api_key --data-binary '{"collector_id": "23907195"}'
        /// </summary>
        private void BtnGetResponseCounts_Click(object sender, EventArgs e)
        {
            GetResponseCountsResponse respondent;
            BasicRequestData          brd = GetRequestFields();

            if (brd.CollectorID == null)
            {
                MessageBox.Show("no collector id specified.  Going to get error back.");
            }

            try
            {
                respondent = SurveyRequest.GetResponseCounts(brd);

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


                List <GetResponseCountsResult> rList = new List <GetResponseCountsResult>();
                rList.Add(respondent.ResponseCountResult);
                dgvSurveyList.DataSource = rList;
            }
            catch { } // do nothing
        }
Beispiel #24
0
        /// <summary>
        /// Returns a summary of how respondents answered each question, including counts and average ratings
        /// </summary>
        private void BtnGetResponseSummary_Click(object sender, EventArgs e)
        {
            GetSurveyDetailsResponse  surveyDetails;
            GetResponsesResponse      responses;
            GetRespondentListResponse respondent;

            BasicRequestData brd = GetRequestFields();

            brd.PageSize = 1000; // get all respondents
            SurveyQuestionView surveyView   = new SurveyQuestionView();
            ResponseView       responseView = new ResponseView();

            if (brd.SurveyID == null)
            {
                MessageBox.Show("no survey id specified.  Going to get error back.");
            }

            try
            {
                surveyDetails = SurveyRequest.GetSurveyDetails(brd);
                respondent    = SurveyRequest.GetRespondentListFull(brd);

                List <string> respondantID = new List <string>();
                bool          isProcessed  = false;
                responses = new GetResponsesResponse();
                foreach (RespondentInfo rInfo in respondent.RespondantListResult.RespondantList)
                {
                    respondantID.Add(rInfo.RespondentID);
                    // maximum number of respondents that can be processed is 100
                    if (respondantID.Count == 100)
                    {
                        brd.RespondentIDList = respondantID.ToArray();
                        responses            = GetRespondenses(responses, brd, isProcessed);
                        isProcessed          = true;
                        respondantID.Clear();
                    }
                }
                if (respondantID.Count > 0)
                {
                    brd.RespondentIDList = respondantID.ToArray();
                }

                responses = GetRespondenses(responses, brd, isProcessed);
                surveyView.LoadSurvey(surveyDetails);
                responseView.LoadResponseSummary(responses.ResponseResultList, surveyView);

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

                try
                {
                    dgvSurveyList.DataSource = responseView.SurveyWithAnswers; //respondent.ResponseResultList;

                    // update database with survey results
                }
                catch { } // do nothing
            }
            catch
            {
                MessageBox.Show("ERROR with respondants specified.  No data submitted to SurveyMonkey");
            }
        }
Beispiel #25
0
 public string deleteAdminFile(int id)
 {
     // delete admin file
     BasicRequestData bData = new BasicRequestData();
     bData.token = Token;
     bData.output = OutPut;
     bData.id = id.ToString();
     Request objrequest = new Request();
     objrequest.method = "DELETE";
     objrequest.module = "admin.files";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
     //return $this->setRequest(
     //    array(
     //        'module' => 'admin.file',
     //        'method' => 'DELETE',
     //        'id' => $id
     //    )
     //);
 }
Beispiel #26
0
 public string updateShift(int id, string[] shift_details)
 {
     // update shift details
     BasicRequestData bData = new BasicRequestData();
     bData.token = Token;
     bData.output = OutPut;
     bData.id = id.ToString();
     Request objrequest = new Request();
     objrequest.method = "UPDATE";
     objrequest.module = "schedule.shifts";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Beispiel #27
0
 public string getVacationScheduleDetails(int id)
 {
     // get vacation schedule details
     BasicRequestData bData = new BasicRequestData();
     bData.token = Token;
     bData.output = OutPut;
     bData.id = id.ToString();
     Request objrequest = new Request();
     objrequest.method = "GET";
     objrequest.module = "schedule.vacations";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Beispiel #28
0
 public string deleteStaffSkill(int id)
 {
     // delete staff skill
     BasicRequestData bData = new BasicRequestData();
     bData.token = Token;
     bData.output = OutPut;
     bData.id = id.ToString();
     Request objrequest = new Request();
     objrequest.method = "DELETE";
     objrequest.module = "staff.skills";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Beispiel #29
0
        /// <summary>
        /// Get information from the pop-up forms
        /// </summary>
        /// <returns></returns>
        private BasicRequestData GetRequestFields()
        {
            BasicRequestData brd = new BasicRequestData();

            try
            {
                brd.Page = int.Parse(txtPage.Text);
            }
            catch
            {
                brd.Page = 1;
            }

            try
            {
                brd.PageSize = int.Parse(txtPageSize.Text);
            }
            catch
            {
                brd.PageSize = 20;
            }

            if (txtSurveyID.Text.Trim().Length > 0)
            {
                brd.SurveyID = txtSurveyID.Text;
            }
            else
            {
                brd.SurveyID = null;
            }

            if (txtTemplateID.Text.Trim().Length > 0)
            {
                brd.TemplateID = txtTemplateID.Text;
            }
            else
            {
                brd.TemplateID = null;
            }

            if (txtCollectorID.Text.Trim().Length > 0)
            {
                brd.CollectorID = txtCollectorID.Text;
            }
            else
            {
                brd.CollectorID = null;
            }

            if (txtSurveyName.Text.Trim().Length > 0)
            {
                brd.SurveyTitle = txtSurveyName.Text;
            }

            List <string> respondantID = new List <string>();

            if (txtResID1.Text.Trim().Length > 0)
            {
                respondantID.Add(txtResID1.Text);
            }
            if (txtResID2.Text.Trim().Length > 0)
            {
                respondantID.Add(txtResID2.Text);
            }
            if (txtResID3.Text.Trim().Length > 0)
            {
                respondantID.Add(txtResID3.Text);
            }
            if (txtResID4.Text.Trim().Length > 0)
            {
                respondantID.Add(txtResID4.Text);
            }

            if (respondantID.Count > 0)
            {
                brd.RespondentIDList = respondantID.ToArray();
            }

            return(brd);
        }
 public CommittedChange Rename(string directory, ObservableCollection <MyFile> currentFiles,
                               BasicRequestData data, BasicRequestMode mode)
 {
     return(RenameService.Rename(directory, currentFiles, data, mode));
 }