protected void surveysControl_OnEditItem(object sender, GenericEventArgs <Guid> e) { var entity = DataContext.LP_Surveys.FirstOrDefault(n => n.ID == e.Value); if (entity == null) { return; } var converter = new SurveyEntityModelConverter(DataContext); var model = converter.Convert(entity); if (model.ParentID == null) { mainSurveyControl.Visible = true; subSurveyControl.Visible = false; } else { mainSurveyControl.Visible = false; subSurveyControl.Visible = true; } mainSurveyControl.Model = model; subSurveyControl.Model = model; mpeAddEdit.Show(); }
private void FillDataGrid() { var entities = (from n in DataContext.LP_Surveys where n.DateDeleted == null orderby n.OrderIndex, n.DateCreated select n).ToList(); var converter = new SurveyEntityModelConverter(DataContext); var models = (from n in entities let m = converter.Convert(n) select m).ToList(); var model = new SurveysModel(); model.List = models; surveysControl.Model = model; }
private void FillSurveys() { var parentID = DataConverter.ToNullableGuid(Request["ID"]); var currentLanguage = LanguageUtil.GetLanguage(); var query = from n in DataContext.LP_Surveys where n.DateDeleted == null && (n.Language == currentLanguage || n.Language == null || n.Language == "") select n; if (parentID == null) { query = from n in query where n.ParentID == null select n; } else { query = from n in query where n.ParentID == parentID select n; } query = from n in query orderby n.OrderIndex, n.DateCreated select n; var entities = query.ToList(); var converter = new SurveyEntityModelConverter(DataContext); var models = (from n in entities let m = converter.Convert(n) select m).ToList(); var model = new SurveysModel(); model.List = models; surveysControl.Model = model; }