Пример #1
0
        // this method get's the question answers and creates the full form entry
        public bool addFormEntry(List <string> list)
        {
            System.Diagnostics.Debug.WriteLine(list[0]);

            if (fID.Length == 0)
            {
                return(false);
            }
            else
            {
                // create the form entry and assign form id (FK) then persist
                cFormEntry fe = new cFormEntry();
                fe.FormID = fID;
                if (!fe.persist())
                {
                    return(false);
                }
                var j = 0;

                // now iterate the question answers
                foreach (var i in list)
                {
                    // create the question entry and assign form entry id and question id
                    cQuestionEntry qe = new cQuestionEntry();
                    qe.QuestionID  = Questions[j].ID;
                    qe.FormEntryID = fe.ID;
                    qe.Text        = i;
                    if (!qe.persist())
                    {
                        return(false);
                    }
                    j++;
                }
                return(true);
            }
        }
Пример #2
0
        // this method get's the question answers and creates the full form entry
        public bool addFormEntry(List<string> list)
        {
            System.Diagnostics.Debug.WriteLine(list[0]);

            if (fID.Length == 0) return false;
            else {
                // create the form entry and assign form id (FK) then persist
                cFormEntry fe = new cFormEntry();
                fe.FormID = fID;
                if (!fe.persist()) return false;
                var j = 0;

                // now iterate the question answers
                foreach (var i in list) {
                    // create the question entry and assign form entry id and question id
                    cQuestionEntry qe = new cQuestionEntry();
                    qe.QuestionID = Questions[j].ID;
                    qe.FormEntryID = fe.ID;
                    qe.Text = i;
                    if (!qe.persist()) return false;
                    j++;
                }
                return true;
            }
        }