private static SurveyResponse FromReader(IDataReader reader) { SurveyResponse response = null; try { if (reader.Read()) { response = new SurveyResponse(); response.ResponseGuid = new Guid(reader["ResponseGuid"].ToString()); response.SurveyGuid = new Guid(reader["SurveyGuid"].ToString()); response.UserGuid = new Guid(reader["UserGuid"].ToString()); if (reader["SubmissionDate"] != DBNull.Value) { response.SubmissionDate = Convert.ToDateTime(reader["SubmissionDate"], CultureInfo.InvariantCulture); } response.Annonymous = Convert.ToBoolean(reader["Annonymous"], CultureInfo.InvariantCulture); response.Complete = Convert.ToBoolean(reader["Complete"], CultureInfo.InvariantCulture); } } finally { reader.Close(); } return(response); }
void btnStartSurvey_Click(object sender, EventArgs e) { Guid currentResponseGuid = GetCurrentResponseGuid(); if (!chkUseOldResponses.Checked) { if (currentResponseGuid != Guid.Empty) { SurveyResponse.Delete(currentResponseGuid); } SiteUser siteUser = SiteUtils.GetCurrentSiteUser(); SurveyResponse response = new SurveyResponse(); response.Complete = false; response.SurveyGuid = survey.SurveyGuid; if (siteUser != null) response.UserGuid = siteUser.UserGuid; response.Save(); currentResponseGuid = response.ResponseGuid; } SetCookie(currentResponseGuid); WebUtils.SetupRedirect(this, SiteRoot + "/Survey/CompleteSurvey.aspx?SurveyGuid=" + surveyGuid.ToString() + "&pageid=" + PageId.ToInvariantString() + "&mid=" + ModuleId.ToInvariantString() + "&SurveyPageGuid=" + surveyPageGuid.ToString()); }
private static List <SurveyResponse> LoadFromReader(IDataReader reader) { List <SurveyResponse> surveyResponseList = new List <SurveyResponse>(); try { while (reader.Read()) { SurveyResponse surveyResponse = new SurveyResponse(); surveyResponse.ResponseGuid = new Guid(reader["ResponseGuid"].ToString()); surveyResponse.SurveyGuid = new Guid(reader["SurveyGuid"].ToString()); surveyResponse.UserGuid = new Guid(reader["UserGuid"].ToString()); if (reader["SubmissionDate"] != DBNull.Value) { surveyResponse.SubmissionDate = Convert.ToDateTime(reader["SubmissionDate"], CultureInfo.InvariantCulture); } surveyResponse.Annonymous = Convert.ToBoolean(reader["Annonymous"], CultureInfo.InvariantCulture); surveyResponse.Complete = Convert.ToBoolean(reader["Complete"], CultureInfo.InvariantCulture); surveyResponseList.Add(surveyResponse); } } finally { reader.Close(); } return(surveyResponseList); }
private void LoadSettings() { surveyGuid = WebUtils.ParseGuidFromQueryString("SurveyGuid", Guid.Empty); pageId = WebUtils.ParseInt32FromQueryString("pageid", -1); moduleId = WebUtils.ParseInt32FromQueryString("mid", -1); responseGuid = WebUtils.ParseGuidFromQueryString("ResponseGuid", Guid.Empty); if (surveyGuid == Guid.Empty) return; if (responseGuid == Guid.Empty) { SurveyResponse response = SurveyResponse.GetFirst(surveyGuid); if (response == null) { WebUtils.SetupRedirect(this, SiteRoot + "/Survey/Surveys.aspx?pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString()); } else { WebUtils.SetupRedirect(this, SiteRoot + "/Survey/Results.aspx?SurveyGuid=" + surveyGuid.ToString() + "&ResponseGuid=" + response.ResponseGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString()); } } else { currentResponse = new SurveyResponse(responseGuid); previousResponse = SurveyResponse.GetPrevious(responseGuid); nextResponse = SurveyResponse.GetNext(responseGuid); } if (surveyGuid != Guid.Empty) { survey = new Survey(surveyGuid); if (survey.SiteGuid != siteSettings.SiteGuid) { surveyGuid = Guid.Empty; survey = null; responseGuid = Guid.Empty; currentResponse = null; previousResponse = null; nextResponse = null; } } AddClassToBody("surveyresults"); }
private void SubmitResponse() { SurveyResponse response = new SurveyResponse(GetCurrentResponseGuid()); response.SubmissionDate = DateTime.UtcNow; response.Complete = true; SiteUser siteUser = SiteUtils.GetCurrentSiteUser(); if (siteUser != null) { response.UserGuid = siteUser.UserGuid; } response.Save(); SetCookie(Guid.Empty); }
private static List<SurveyResponse> LoadFromReader(IDataReader reader) { List<SurveyResponse> surveyResponseList = new List<SurveyResponse>(); try { while (reader.Read()) { SurveyResponse surveyResponse = new SurveyResponse(); surveyResponse.responseGuid = new Guid(reader["ResponseGuid"].ToString()); surveyResponse.surveyGuid = new Guid(reader["SurveyGuid"].ToString()); surveyResponse.userGuid = new Guid(reader["UserGuid"].ToString()); if (reader["SubmissionDate"] != DBNull.Value) surveyResponse.submissionDate = Convert.ToDateTime(reader["SubmissionDate"], CultureInfo.InvariantCulture); surveyResponse.annonymous = Convert.ToBoolean(reader["Annonymous"], CultureInfo.InvariantCulture); surveyResponse.complete = Convert.ToBoolean(reader["Complete"], CultureInfo.InvariantCulture); surveyResponseList.Add(surveyResponse); } } finally { reader.Close(); } return surveyResponseList; }
private static SurveyResponse FromReader(IDataReader reader) { SurveyResponse response = null; try { if (reader.Read()) { response = new SurveyResponse(); response.responseGuid = new Guid(reader["ResponseGuid"].ToString()); response.surveyGuid = new Guid(reader["SurveyGuid"].ToString()); response.userGuid = new Guid(reader["UserGuid"].ToString()); if (reader["SubmissionDate"] != DBNull.Value) response.submissionDate = Convert.ToDateTime(reader["SubmissionDate"], CultureInfo.InvariantCulture); response.annonymous = Convert.ToBoolean(reader["Annonymous"], CultureInfo.InvariantCulture); response.complete = Convert.ToBoolean(reader["Complete"], CultureInfo.InvariantCulture); } } finally { reader.Close(); } return response; }