コード例 #1
0
ファイル: SurveyEntry.cs プロジェクト: Eedz/ITCFrontEndReader
        public SurveyEntry(string surveyCode)
        {
            CurrentSurvey = DBAction.GetSurveyInfo(surveyCode);
            DBAction.FillQuestions(CurrentSurvey);

            if (CurrentSurvey.Questions == null)
            {
                MessageBox.Show("Error getting " + surveyCode + "'s questions. Ensure there is at least one question in this survey.");
                Close();
            }


            InitializeComponent();

            this.MouseWheel += SurveyEntry_OnMouseWheel;
            //txtPrePR.MouseWheel += SurveyEntry_OnMouseWheel;

            bs = new BindingSource
            {
                DataSource = CurrentSurvey.Questions
            };
            bs.PositionChanged += Bs_PositionChanged;

            navQuestions.BindingSource = bs;


            BindProperties();

            LockForm();

            ColorForm();
        }
コード例 #2
0
ファイル: SurveyEditor.cs プロジェクト: Eedz/ISISFrontEnd
        public void ChangeSurvey(string newSurvey)
        {
            CurrentSurvey = null;
            CurrentSurvey = DBAction.GetSurveyInfo(newSurvey);
            DBAction.FillQuestions(CurrentSurvey);

            bs.DataSource = CurrentSurvey.Questions;
            txtSurvey.DataBindings.Clear();
            txtSurvey.DataBindings.Add("Text", CurrentSurvey, "SurveyCode");

            CurrentQuestion = (SurveyQuestion)bs.Current;
        }
コード例 #3
0
ファイル: SurveyEntry.cs プロジェクト: Eedz/ISISFrontEnd
        public void ChangeSurvey(string newSurvey)
        {
            CurrentSurvey = null;
            CurrentSurvey = DBAction.GetSurveyInfo(newSurvey);
            DBAction.FillQuestions(CurrentSurvey);

            bs.DataSource = CurrentSurvey.Questions;
            txtSurvey.DataBindings.Clear();
            txtSurvey.DataBindings.Add("Text", CurrentSurvey, "SurveyCode");

            cmdUnlockSurvey.DataBindings.Clear();
            cmdUnlockSurvey.DataBindings.Add("Visible", CurrentSurvey, "Locked");

            LockForm();
        }
コード例 #4
0
ファイル: SurveyEntry.cs プロジェクト: Eedz/ISISFrontEnd
        public SurveyEntry(string surveyCode)
        {
            CurrentSurvey = DBAction.GetSurveyInfo(surveyCode);
            DBAction.FillQuestions(CurrentSurvey);

            if (CurrentSurvey.Questions == null)
            {
                MessageBox.Show("Error getting " + surveyCode + "'s questions. Ensure there is at least one question in this survey.");
                Close();
            }


            InitializeComponent();

            this.MouseWheel += SurveyEntry_OnMouseWheel;
            //txtPrePR.MouseWheel += SurveyEntry_OnMouseWheel;

            bs = new BindingSource
            {
                DataSource = CurrentSurvey.Questions
            };
            bs.PositionChanged    += Bs_PositionChanged;
            bs.CurrentItemChanged += Bs_CurrentItemChanged;

            bs.ListChanged += SurveyEntry_ListChanged;

            navQuestions.BindingSource = bs;


            // bind the comment bindingsource to the current item in the question bindingsource, but set the datamember to the comment list
            bsComments = new BindingSource
            {
                DataSource = bs.Current,
                DataMember = "Comments"
            };
            navComments.BindingSource = bsComments;


            BindProperties();

            LockForm();

            ColorForm();
        }
コード例 #5
0
        private void LoadSurvey()
        {
            if (CurrentSurvey == null)
            {
                return;
            }

            DBAction.FillQuestions(CurrentSurvey, true);
            lstReport.Items.Clear();
            lstReport.View = View.Details;

            foreach (SurveyQuestion sq in CurrentSurvey.Questions)
            {
                ListViewItem li = new ListViewItem(new string[] { sq.Qnum, sq.AltQnum, sq.VarName, sq.VarLabel, sq.RespName, sq.CorrectedFlag.ToString(), sq.TableFormat.ToString() });
                li.Tag = sq;
                lstReport.Items.Add(li);
                FormatListItem(li, GetQuestionType(li));
            }
        }
コード例 #6
0
        private void Generate_Click(object sender, EventArgs e)
        {
            if (lstSurveys.SelectedItems.Count == 0)
            {
                MessageBox.Show("Select at least one survey.");
                return;
            }
            // check field info is complete



            for (int i = 0; i < lstSurveys.SelectedItems.Count; i++)
            {
                ReportSurvey s = (ReportSurvey)DBAction.GetSurveyInfo(lstSurveys.GetItemText(lstSurveys.SelectedItems[i]));
                DBAction.FillQuestions(s);


                SR.CreateSyntax(s, SyntaxFormat.EpiData);
            }
        }
コード例 #7
0
        private void SetReferenceSurvey(Survey survey)
        {
            // set reference survey
            double wave = survey.Wave;
            string previousWaveCode;

            if (wave > 1 && wave % 1 == 0)
            {
                previousWaveCode = survey.SurveyCodePrefix + (wave - 1);
            }
            else if (wave % 1 == 0.5)
            {
                previousWaveCode = survey.SurveyCodePrefix + (wave - 0.5);
            }
            else
            {
                previousWaveCode = survey.SurveyCode;
            }

            CurrentTiming.ReferenceSurvey = DBAction.GetSurveyInfo(previousWaveCode);
            DBAction.FillQuestions(CurrentTiming.ReferenceSurvey);
        }
コード例 #8
0
        /// <summary>
        /// For each survey in the report, fill the question list, comments and translations as needed.
        /// </summary>
        private void PopulateSurveys()
        {
            // populate the survey and extra fields
            foreach (ReportSurvey rs in SR.Surveys)
            {
                if (filterBy == 1)
                {
                    rs.QRangeHigh = questionFilters.QRangeHigh;
                    rs.QRangeLow  = questionFilters.QRangeLow;
                    rs.Prefixes   = null;
                    rs.Headings   = null;
                }
                else if (filterBy == 2)
                {
                    rs.QRangeHigh = 0;
                    rs.QRangeLow  = 0;
                    rs.Prefixes   = questionFilters.Prefixes;
                    rs.Headings   = null;
                }
                else if (filterBy == 3)
                {
                    rs.QRangeHigh = 0;
                    rs.QRangeLow  = 0;
                    rs.Prefixes   = null;
                    rs.Headings   = questionFilters.Headings;
                }

                rs.Varnames = questionFilters.Varnames;

                rs.Questions.Clear();
                rs.SurveyNotes.Clear();
                rs.VarChanges.Clear();

                // questions
                if (rs.Backend.Date != DateTime.Today)
                {
                    rs.AddQuestions(new BindingList <SurveyQuestion>(DBAction.GetBackupQuestions(rs, rs.Backend)));
                }
                else
                {
                    DBAction.FillQuestions(rs);
                }

                // correct questions // TODO should we only get corrected for current data?
                if (rs.Corrected)
                {
                    DBAction.FillCorrectedQuestions(rs);
                    rs.CorrectWordings();
                }

                // previous names (for Var column)
                DBAction.FillPreviousNames(rs, SR.ExcludeTempChanges);

                if (compare.MatchOnRename && rs.Backend.Date != DateTime.Today)
                {
                    foreach (SurveyQuestion sq in rs.Questions)
                    {
                        sq.VarName = new VariableName(DBAction.GetCurrentName(rs.SurveyCode, sq.VarName.FullVarName, rs.Backend));
                    }
                }
                // survey notes
                if (SR.SurvNotes)
                {
                    rs.SurveyNotes = DBAction.GetSurvCommentsBySurvey(rs.SID);
                }

                // comments
                if (rs.CommentFields.Count > 0)
                {
                    DBAction.FillCommentsBySurvey(rs);
                }

                // translations
                foreach (string language in rs.TransFields)
                {
                    DBAction.FillTranslationsBySurvey(rs, language);
                }

                // filters
                if (rs.FilterCol)
                {
                    rs.MakeFilterList();
                }

                // varchanges (for appendix)
                if (SR.VarChangesApp)
                {
                    rs.VarChanges = DBAction.GetVarNameChangeBySurvey(rs.SurveyCode, SR.ExcludeTempChanges);
                }
            }
        }