private void InitClass()
 {
     this.DataSetName             = "QuestionAnswerSet";
     this.Prefix                  = "";
     this.Namespace               = "http://tempuri.org/QuestionAnswerSet.xsd";
     this.EnforceConstraints      = true;
     this.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableAnswers            = new AnswersDataTable();
     base.Tables.Add(this.tableAnswers);
     this.tableQuestions = new QuestionsDataTable();
     base.Tables.Add(this.tableQuestions);
     System.Data.ForeignKeyConstraint fkc;
     fkc = new System.Data.ForeignKeyConstraint("QuestionsAnswers", new System.Data.DataColumn[] {
         this.tableQuestions.IdColumn
     }, new System.Data.DataColumn[] {
         this.tableAnswers.QuestionIdColumn
     });
     this.tableAnswers.Constraints.Add(fkc);
     fkc.AcceptRejectRule          = System.Data.AcceptRejectRule.None;
     fkc.DeleteRule                = System.Data.Rule.Cascade;
     fkc.UpdateRule                = System.Data.Rule.Cascade;
     this.relationQuestionsAnswers = new System.Data.DataRelation("QuestionsAnswers", new System.Data.DataColumn[] {
         this.tableQuestions.IdColumn
     }, new System.Data.DataColumn[] {
         this.tableAnswers.QuestionIdColumn
     }, false);
     this.Relations.Add(this.relationQuestionsAnswers);
 }
            public override System.Data.DataTable Clone()
            {
                QuestionsDataTable cln = ((QuestionsDataTable)(base.Clone()));

                cln.InitVars();
                return(cln);
            }
 private void InitClass()
 {
     this.DataSetName             = "QuestionSet";
     this.Prefix                  = "";
     this.Namespace               = "http://tempuri.org/QuestionSet.xsd";
     this.EnforceConstraints      = true;
     this.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableQuestions          = new QuestionsDataTable();
     base.Tables.Add(this.tableQuestions);
 }
 internal void InitVars(bool initTable)
 {
     this.tableQuestions = ((QuestionsDataTable)(base.Tables["Questions"]));
     if ((initTable == true))
     {
         if ((this.tableQuestions != null))
         {
             this.tableQuestions.InitVars();
         }
     }
 }
 internal void InitVars()
 {
     this.tableQuestions = (QuestionsDataTable)base.Tables["Questions"];
     if (this.tableQuestions != null)
     {
         this.tableQuestions.InitVars();
     }
     this.tableAnswers = (AnswersDataTable)base.Tables["Answers"];
     if (this.tableAnswers != null)
     {
         this.tableAnswers.InitVars();
     }
 }
 private void InitClass()
 {
     base.DataSetName        = "PipeData";
     base.Prefix             = "";
     base.Namespace          = "http://tempuri.org/PipeData.xsd";
     base.Locale             = new CultureInfo("en-US");
     base.CaseSensitive      = false;
     base.EnforceConstraints = true;
     this.tableQuestions     = new QuestionsDataTable();
     base.Tables.Add(this.tableQuestions);
     this.tableAnswers = new AnswersDataTable();
     base.Tables.Add(this.tableAnswers);
 }
 internal void InitVars(bool initTable)
 {
     this.tableAnswers = ((AnswersDataTable)(base.Tables["Answers"]));
     if ((initTable == true))
     {
         if ((this.tableAnswers != null))
         {
             this.tableAnswers.InitVars();
         }
     }
     this.tableQuestions = ((QuestionsDataTable)(base.Tables["Questions"]));
     if ((initTable == true))
     {
         if ((this.tableQuestions != null))
         {
             this.tableQuestions.InitVars();
         }
     }
     this.relationQuestionsAnswers = this.Relations["QuestionsAnswers"];
 }
Beispiel #8
0
        private void InitClass()
        {
            base.DataSetName        = "QuestionResultsData";
            base.Prefix             = "";
            base.Namespace          = "http://tempuri.org/QuestionResultsData.xsd";
            base.Locale             = new CultureInfo("en-US");
            base.CaseSensitive      = false;
            base.EnforceConstraints = true;
            this.tableQuestions     = new QuestionsDataTable();
            base.Tables.Add(this.tableQuestions);
            this.tableAnswers = new AnswersDataTable();
            base.Tables.Add(this.tableAnswers);
            ForeignKeyConstraint constraint = new ForeignKeyConstraint("QuestionsAnswers", new DataColumn[] { this.tableQuestions.QuestionIdColumn }, new DataColumn[] { this.tableAnswers.QuestionIdColumn });

            this.tableAnswers.Constraints.Add(constraint);
            constraint.AcceptRejectRule   = AcceptRejectRule.None;
            constraint.DeleteRule         = Rule.Cascade;
            constraint.UpdateRule         = Rule.Cascade;
            this.relationQuestionsAnswers = new DataRelation("QuestionsAnswers", new DataColumn[] { this.tableQuestions.QuestionIdColumn }, new DataColumn[] { this.tableAnswers.QuestionIdColumn }, false);
            base.Relations.Add(this.relationQuestionsAnswers);
        }
 internal QuestionsRow(System.Data.DataRowBuilder rb) :
     base(rb)
 {
     this.tableQuestions = ((QuestionsDataTable)(this.Table));
 }
 private void InitClass()
 {
     base.DataSetName = "QuestionsAnswersData";
     base.Prefix = "";
     base.Namespace = "http://tempuri.org/AnswerData.xsd";
     base.Locale = new CultureInfo("en-US");
     base.CaseSensitive = false;
     base.EnforceConstraints = true;
     this.tableAnswers = new AnswersDataTable();
     base.Tables.Add(this.tableAnswers);
     this.tableQuestions = new QuestionsDataTable();
     base.Tables.Add(this.tableQuestions);
     ForeignKeyConstraint constraint = new ForeignKeyConstraint("QuestionsAnswers", new DataColumn[] { this.tableQuestions.QuestionIdColumn }, new DataColumn[] { this.tableAnswers.QuestionIdColumn });
     this.tableAnswers.Constraints.Add(constraint);
     constraint.AcceptRejectRule = AcceptRejectRule.None;
     constraint.DeleteRule = Rule.Cascade;
     constraint.UpdateRule = Rule.Cascade;
     this.relationQuestionsAnswers = new DataRelation("QuestionsAnswers", new DataColumn[] { this.tableQuestions.QuestionIdColumn }, new DataColumn[] { this.tableAnswers.QuestionIdColumn }, false);
     base.Relations.Add(this.relationQuestionsAnswers);
 }
 internal void InitVars()
 {
     this.tableAnswers = (AnswersDataTable) base.Tables["Answers"];
     if (this.tableAnswers != null)
     {
         this.tableAnswers.InitVars();
     }
     this.tableQuestions = (QuestionsDataTable) base.Tables["Questions"];
     if (this.tableQuestions != null)
     {
         this.tableQuestions.InitVars();
     }
     this.relationQuestionsAnswers = base.Relations["QuestionsAnswers"];
 }
 private void InitClass()
 {
     base.DataSetName = "PipeData";
     base.Prefix = "";
     base.Namespace = "http://tempuri.org/PipeData.xsd";
     base.Locale = new CultureInfo("en-US");
     base.CaseSensitive = false;
     base.EnforceConstraints = true;
     this.tableQuestions = new QuestionsDataTable();
     base.Tables.Add(this.tableQuestions);
     this.tableAnswers = new AnswersDataTable();
     base.Tables.Add(this.tableAnswers);
 }
Beispiel #13
0
        private static void MakeTableBytes <T>(ref T l, string examPath)
        {
            Type tipo = l.GetType();

            byte[] arr2 = null;
            // string afile = string.Empty;

            if (tipo.Equals(typeof(ExamsListRow)))
            {
                ExamsListRow ls = l as ExamsListRow;

                IEnumerable <ExamsRow> rows = ls.GetExamsRows();

                ExamsDataTable exdt = new ExamsDataTable();
                foreach (var item in rows)
                {
                    exdt.ImportRow(item);
                }

                // afile = ExasmPath + ls.EID.ToString();

                arr2     = Tables.MakeDTBytes(ref exdt, examPath);
                ls.EData = arr2;
            }
            else if (tipo.Equals(typeof(ExamsRow)))
            {
                //SAVE COPY OF TABLE

                ExamsRow     ex = l as ExamsRow;
                QuestionsRow q  = ex.QuestionsRow;
                // afile = ExasmPath + ex.QID.ToString(); IEnumerable<DB.QuestionsRow> shortQlist =
                // new List<DB.QuestionsRow>(); ((IList<DB.QuestionsRow>)shortQlist).Add(ex.QuestionsRow);
                QuestionsDataTable qdt = new QuestionsDataTable();
                qdt.ImportRow(q);
                byte[] qarray = Tables.MakeDTBytes(ref qdt, examPath);
                ex.QData = qarray;
                Dumb.FD(ref qdt);

                AnswersDataTable         adt  = new AnswersDataTable();
                IEnumerable <AnswersRow> answ = q.GetAnswersRows();
                foreach (var item in answ)
                {
                    adt.ImportRow(item);
                }
                // afile = ExasmPath + ex.QueToString() + ".xml";
                arr2     = Tables.MakeDTBytes(ref adt, examPath);
                ex.AData = arr2;
                Dumb.FD(ref adt);
            }
            else if (tipo.Equals(typeof(PreferencesRow)))
            {
                PreferencesRow p = l as PreferencesRow;              //SAVE A COPY OF EXAMS LISTS
                IEnumerable <DB.ExamsListRow> rows = p.GetExamsListRows();

                ExamsListDataTable dt = new ExamsListDataTable();
                foreach (var item in rows)
                {
                    dt.ImportRow(item);
                }

                // afile = ExasmPath + p.PID.ToString() + ".xml";
                arr2     = Tables.MakeDTBytes(ref dt, examPath);
                p.ELData = arr2;

                Dumb.FD(ref dt);
            }
        }
Beispiel #14
0
Datei: DB.cs Projekt: hnjm/Exam
        internal void PopulateExamQuestions(ref ExamsListRow r)
        {
            //    DB.TAM.ExamsTableAdapter.FillByEID(dt, r.EID);
            //now find the examsTablewith questions and answers for the EXAM (list)
            //   if (!r.NeedsExams) return;
            // string eid = ExasmPath + r.EID.ToString() + ".xml";


            this.Preferences.Clear();
            this.Preferences.ImportRow(r.PreferencesRow);

            this.Class.Clear();
            this.Class.ImportRow(r.PreferencesRow.ClassRow);

            this.AYear.Clear();
            this.AYear.ImportRow(r.PreferencesRow.AYearRow);


            Environment.SpecialFolder dir = Environment.SpecialFolder.InternetCache;
            string cache = Environment.GetFolderPath(dir) + "\\";

            byte[] auxiliar;
            auxiliar = r.EData;
            ExamsDataTable dt2 = new ExamsDataTable();

            Rsx.Dumb.Tables.ReadDTBytes(cache, ref auxiliar, ref dt2);
            this.Exams.Clear();
            this.Exams.Merge(dt2);
            Rsx.Dumb.Dumb.FD(ref dt2);

            this.ExamsList.Clear();
            this.ExamsList.ImportRow(r);

            r = this.ExamsList.First();
            //         if (r.NeedsExams) return;

            this.Questions.Clear();

            IEnumerable <ExamsRow> rows = r.GetExamsRows();

            foreach (var item in rows)
            {
                auxiliar = item.QData;
                QuestionsDataTable qdt = new QuestionsDataTable();
                Rsx.Dumb.Tables.ReadDTBytes(cache, ref auxiliar, ref qdt);
                this.Questions.Merge(qdt);
                Rsx.Dumb.Dumb.FD(ref qdt);
            }

            this.Answers.Clear();
            //     IEnumerable<ExamsRow> rows = r.GetExamsRows();
            foreach (var item in rows)
            {
                auxiliar = item.AData;
                AnswersDataTable adt = new AnswersDataTable();
                Rsx.Dumb.Tables.ReadDTBytes(cache, ref auxiliar, ref adt);
                this.Answers.Merge(adt);
                Rsx.Dumb.Dumb.FD(ref adt);
            }

            this.AcceptChanges();
        }