public static ResponseSet GenerateResponseSet(ResponseSetType type, Survey survey) { ResponseSet set = new ResponseSet(); set.ID = rand.Next(0, 1000); set.SurveyID = survey.ID; set.SystemID = LoginViewModelTest.SERVER_PATH; set.Name = rand.Next(0, 1000).ToString(); switch (type) { case ResponseSetType.Completed: set.IsCompleted = true; break; case ResponseSetType.InProgress: set.IsCompleted = false; set.IsSubmitted = false; break; case ResponseSetType.Submitted: set.IsSubmitted = true; break; default: break; } set.UserID = Membership.CurrentUser.ID; return set; }
public static Survey GenerateSurvey(int id) { Survey survey = new Survey(); survey.Name = SURVEY_NAME; survey.DateReceived = DateTime.Now; survey.ID = id; survey.UserID = Membership.CurrentUser.ID; survey.SystemID = LoginViewModelTest.SERVER_PATH; return survey; }
private void DeleteSurveyExecute(Survey selectedSurvey) { if (_surveyRepository.DeleteSurvey(selectedSurvey.ID)) { MessageBox.Show((Application.Current.Resources["LanguageStrings"] as LanguageStrings).SURVEY_DELETED); this.allSurveyses = new ObservableCollection<Survey>(_surveyRepository.GetAllUserSurveys(Membership.CurrentUser.ID)); this.TopSurveys = new ObservableCollection<Survey>(_surveyRepository.GetUserTopSurveys(TOP_SURVYES_COUNT, Membership.CurrentUser.ID)); this.DisplayedSurveyses.Remove(selectedSurvey); Locator.SubmittedResponsesStatic.RefresheExecute(); Locator.SavedResponsesStatic.RefresheExecute(); } else { MessageBox.Show((Application.Current.Resources["LanguageStrings"] as LanguageStrings).ERROR_SURVEY_DELETE); } }
partial void DeleteSurvey(Survey instance);
partial void UpdateSurvey(Survey instance);
partial void InsertSurvey(Survey instance);
private void detach_Survey(Survey entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_Survey(Survey entity) { this.SendPropertyChanging(); entity.User = this; }
public static ResponseSet GenerateAndSaveResponseSet(ResponseSetType type, Survey survey) { var responseSet = GenerateResponseSet(type, survey); repository.AddResponseSetToDB(responseSet); return responseSet; }