void InitSurveyState() { current_panel = 0; SurveyPanel.ResetAllSurveyPanels(); saved_results.Clear(); ShowPanel(current_panel); SetPanelName("Описание почвы (для определения уровня потенциального плодородия и доступности элементов питания):"); SetQuestionNumber(); //OnQuestionBeforeSwitch(); }
/// <summary> /// /// </summary> /// <param name="surveyId"></param> private void PopulateSurvey(int surveyId) { Survey surveyRecord = new Survey(); surveyRecord.Get(surveyId); // get current type surveyType = surveyRecord[Survey.SurveyType].ToString(); // build edit link BuildEditSurveyLink(surveyId, surveyType); // Set Survey Values based on Label's with Survey FieldNames as ID foreach (string colName in surveyRecord.FieldNames) { Label fieldLabel = SurveyPanel.FindControl(colName) as Label; if (fieldLabel != null) { object colVal = surveyRecord[colName]; if (colVal != null && colVal is DateTime) { DateTime colDate = (DateTime)colVal; fieldLabel.Text = colDate.ToShortDateString(); } else { fieldLabel.Text = colVal.ToString(); } } } // set title SurveyTypeLabel.InnerText = surveyType; // determine which type of view to build if (!string.IsNullOrEmpty(QueryView) && QueryView.Equals("advanced", StringComparison.CurrentCultureIgnoreCase)) { // attempt to build complex page, section, question view BuildPages(surveyId, surveyType); } else { // build normal list of all survey items BindSurveyItems(surveyId); } }