Exemple #1
0
        public bool themCauHoi(string noiDungCH, int doKho, List <DapAn> lstDA)
        {
            CauHoi ch = new CauHoi();
            DapAn  da;

            ch.NoiDungCH  = noiDungCH;
            ch.DoKho      = doKho;
            ch.HinhThucCH = null;

            try
            {
                tnth.CauHois.InsertOnSubmit(ch);
                tnth.SubmitChanges();
                for (int i = 0; i < lstDA.Count; i++)
                {
                    da           = new DapAn();
                    da.MaCH      = ch.MaCH;
                    da.NoiDungDA = lstDA[i].NoiDungDA;
                    da.DungSai   = lstDA[i].DungSai;
                    tnth.DapAns.InsertOnSubmit(da);
                }

                tnth.SubmitChanges();
                return(true);
            }
            catch { return(false); }
        }
Exemple #2
0
 partial void DeleteDapAn(DapAn instance);
Exemple #3
0
 partial void UpdateDapAn(DapAn instance);
Exemple #4
0
 partial void InsertDapAn(DapAn instance);
Exemple #5
0
 private void detach_DapAns(DapAn entity)
 {
     this.SendPropertyChanging();
     entity.CauHoi = null;
 }
Exemple #6
0
 private void attach_DapAns(DapAn entity)
 {
     this.SendPropertyChanging();
     entity.CauHoi = this;
 }
Exemple #7
0
        public DapAn getDapAnDung(int mach)
        {
            DapAn dapans = tnth.DapAns.Where(t => t.MaCH == mach && t.DungSai == true).FirstOrDefault();

            return(dapans);
        }