public ActionResult Survey() { SurveyFactory SF = new SurveyFactory(); List <SurveyEntity> SurveyList = SF.GetSurvey().ToList(); return(View(SurveyList)); }
// GET: Survey private void GetSurveyAnswerType() { SurveyFactory UF = new SurveyFactory(); List <SurveyAnswerTypeEntity> SurveyAnswerTypeList = UF.GetSurveyAnswerType().ToList(); ViewBag.SurveyAnswerTypes = new SelectList(SurveyAnswerTypeList, "AnsTypeId", "AnswerType"); }
public ActionResult DeleteSurvey(long id, FormCollection collection) { try { SurveyFactory DeleteSurvey = new SurveyFactory(); SurveyEntity Survey = new SurveyEntity(); Survey = DeleteSurvey.GetSurveyById(id); DataLayer.tblSurvey NewSurvey = new DataLayer.tblSurvey(); NewSurvey.SurveyId = id; NewSurvey.AnsTypeId = Survey.AnsTypeId; NewSurvey.SurveyName = Survey.SurveyName; NewSurvey.SurveyDescription = Survey.SurveyDescription; NewSurvey.CompletionText = Survey.CompletionText; NewSurvey.IsNeverExpire = Survey.IsNeverExpire; NewSurvey.ExpiryDate = Survey.ExpiryDate; NewSurvey.CreatedDate = Survey.CreatedDate; NewSurvey.CreatedBy = Survey.CreatedBy; NewSurvey.UpdatedDate = DateTime.Now; NewSurvey.UpdatedBy = null; NewSurvey.IsActive = false; // IsActive will be false in delete record DeleteSurvey.SaveSurvey(NewSurvey); return(RedirectToAction("Survey")); } catch { return(View()); } }
/// <summary> /// Adds a new survey to the database /// </summary> /// <param name="newSurvey">Survey object with information about what to add. Only Id must be ommited</param> public void AddSurvey(SurveyData newSurvey) { if (newSurvey.Surveys.Rows.Count > 0) { SurveyFactory.Create().AddSurvey(newSurvey); } }
/// <summary> /// Import the given surveys into the DB /// </summary> public void ImportSurveys(NSurveyForm importSurveys, int userId, int folderId) { ISurvey survey = SurveyFactory.Create(); this.TurnOverPrimaryKeys(importSurveys); survey.ImportSurveys(importSurveys, userId, folderId); }
// GET: Survey/Delete/5 public ActionResult DeleteSurvey(long id) { SurveyFactory EditSurvey = new SurveyFactory(); SurveyEntity topic = new SurveyEntity(); topic = EditSurvey.GetSurveyById(id); return(View(topic)); }
/// <summary> /// Move a page break Down /// </summary> /// <param name="surveyId">ID of the survey to which we add the page break</param> /// <param name="PageNumber">Page break to move down</param> public void MovePageBreakDown(int surveyId, int pageNumber) { if (pageNumber == 0) { pageNumber = 1; } SurveyFactory.Create().MovePageBreakDown(surveyId, pageNumber); }
public ActionResult EmailSurvey([FromBody] EmailSurveyRequest req) { ISurvey emailSurvey = SurveyFactory.Build(SurveyTypes.EmailSurvey); var survey = _context.Survey.Find(req.SurveyId); emailSurvey.LoadSurvey(survey); emailSurvey.execute(); return Ok(); }
/// <summary> /// Get the actions that is set for the given survey /// </summary> public int GetSurveyUnAuthentifiedUserAction(int surveyId) { int surveyUnAuthentifiedUserAction = SurveyFactory.Create().GetSurveyUnAuthentifiedUserAction(surveyId); if (surveyUnAuthentifiedUserAction == -1) { return(1); } return(surveyUnAuthentifiedUserAction); }
/// <summary> /// Return a survey object that reflects the database poll /// </summary> /// <param name="surveyId">Id of the survey you need</param> /// <returns>A SurveyData dataset object with the current database values</returns> public SurveyData GetSurveyById(int surveyId, string languageCode) { SurveyData surveyById = SurveyFactory.Create().GetSurveyById(surveyId, languageCode); if (surveyById.Surveys.Rows.Count == 0) { throw new SurveyNotFoundException(); } return(surveyById); }
public ActionResult CreateSurvey(SurveyEntity Survey) { try { if (ModelState.IsValid) { ValidationFactory VF = new ValidationFactory(); SurveyFactory AddSurvey = new SurveyFactory(); DataLayer.tblSurvey NewSurvey = new DataLayer.tblSurvey(); DataLayer.tblChannel NewChannel = new DataLayer.tblChannel(); string Message = VF.SurveyValidity(Survey.SurveyName, null); if (Message != "Success") { ModelState.AddModelError("SurveyName", Message); GetSurveyAnswerType(); return(View(Survey)); } else { NewSurvey.AnsTypeId = Survey.AnsTypeId; NewSurvey.SurveyName = Survey.SurveyName; NewSurvey.SurveyDescription = Survey.SurveyDescription; NewSurvey.CompletionText = Survey.CompletionText; NewSurvey.IsNeverExpire = Survey.IsNeverExpire; NewSurvey.ExpiryDate = Survey.ExpiryDate; NewSurvey.CreatedDate = DateTime.Now; NewSurvey.CreatedBy = null; NewSurvey.UpdatedDate = null; NewSurvey.UpdatedBy = null; NewSurvey.IsActive = true; AddSurvey.SaveSurvey(NewSurvey); return(RedirectToAction("Survey")); } } else { GetSurveyAnswerType(); return(View(Survey)); } } catch (Exception Ex) { GetSurveyAnswerType(); return(View()); } finally { GetSurveyAnswerType(); } }
/// <summary> /// Returns all the survey, questions, answers /// for a survey /// </summary> public NSurveyForm GetFormForExport(int surveyId) { NSurveyForm formForExport = SurveyFactory.Create().GetFormForExport(surveyId); if (formForExport.Survey.Rows.Count > 0) { formForExport.Survey[0].SurveyID = 1; int num = 1; foreach (NSurveyForm.QuestionRow row in formForExport.Survey[0].GetQuestionRows()) { row.QuestionId = num; num++; } } return(formForExport); }
// GET: Survey/Edit/5 public ActionResult EditSurvey(long id) { try { SurveyFactory EditSurvey = new SurveyFactory(); SurveyEntity topic = new SurveyEntity(); topic = EditSurvey.GetSurveyById(id); return(View(topic)); } catch { return(View()); } finally { GetSurveyAnswerType(); } }
/// <summary> /// Get a survey list with only the survey id and title /// </summary> /// <returns></returns> public SurveyData GetAllSurveysList() { return(SurveyFactory.Create().GetAllSurveysList()); }
public void SetFriendlyName(int surveyId, string friendlyName) { SurveyFactory.Create().SetFriendlyName(surveyId, friendlyName); }
public void SetFolderId(int?folderId, int surveyId) { SurveyFactory.Create().SetFolderId(folderId, surveyId); }
/// <summary> /// Returns the total of surveys stored in the database /// </summary> /// <returns>Total of surveys</returns> public int TotalOfSurveys() { return(SurveyFactory.Create().TotalOfSurveys()); }
/// <summary> /// Check if the survey allows multiple submission /// for the same nsurvey username /// </summary> public bool NSurveyAllowsMultipleSubmissions(int surveyId) { return(SurveyFactory.Create().NSurveyAllowsMultipleSubmissions(surveyId)); }
/// <summary> /// Check if survey has been set to be scored /// </summary> public bool IsSurveyScored(int surveyId) { return(SurveyFactory.Create().IsSurveyScored(surveyId)); }
/// <summary> /// Check if the survey sAves Token User Data /// /// </summary> public bool IsSurveySaveTokenUserData(int surveyId) { return(SurveyFactory.Create().IsSurveySaveTokenUserData(surveyId)); }
/// <summary> /// Get a survey list assigned to the user /// </summary> /// <returns></returns> public SurveyData GetAssignedSurveysList(int userId) { return(SurveyFactory.Create().GetAssignedSurveysList(userId)); }
/// <summary> /// Retrieves all archived surveys from the database /// </summary> /// <returns>A SurveyData dataset of all archived surveys</returns> public int GetSurveyIdFromGuid(Guid guid) { return(SurveyFactory.Create().GetSurveyIdFromGuid(guid)); }
/// <summary> /// Returns a list of available resume modes /// </summary> public ResumeModeData GetSurveyResumeModes() { return(SurveyFactory.Create().GetSurveyResumeModes()); }
/// <summary> /// Get a survey list with only the survey id and title filtered by title /// </summary> /// <returns></returns> public SurveyData GetAllSurveysByTitle(string title, int?folderID, int userID) { return(SurveyFactory.Create().GetAllSurveysByTitle(title, folderID, userID)); }
/// <summary> /// Retrieves all archived surveys from the database /// </summary> /// <returns>A SurveyData dataset of all archived surveys</returns> public SurveyData GetArchivedSurveys() { return(SurveyFactory.Create().GetArchivedSurveys()); }
/// <summary> /// Check if the given password is valid for the survey /// </summary> /// <param name="surveyId">Id of the protected survey</param> /// <param name="password">the password to check for</param> public bool IsSurveyPasswordValid(int surveyId, string password) { return(SurveyFactory.Create().IsSurveyPasswordValid(surveyId, password)); }
public int GetSurveyIdFromFriendlyName(string name) { return(SurveyFactory.Create().GetSurveyIdFromFriendlyName(name)); }
/// <summary> /// Returns true if the page has any branching rule /// associated with it /// </summary> public bool HasPageBranching(int surveyId, int pageNumber) { return(SurveyFactory.Create().HasPageBranching(surveyId, pageNumber)); }
/// <summary> /// Get the number of minutes after which the security cookie /// expires /// </summary> public int GetCookieExpiration(int surveyId) { return(SurveyFactory.Create().GetCookieExpiration(surveyId)); }
/// <summary> /// Check if the survey only accept entries from /// users with email codes /// </summary> public bool IsSurveyOnlyInvited(int surveyId) { return(SurveyFactory.Create().IsSurveyEmailInviteOnly(surveyId)); }