Exemplo n.º 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); }
        }
Exemplo n.º 2
0
 partial void DeleteDapAn(DapAn instance);
Exemplo n.º 3
0
 partial void UpdateDapAn(DapAn instance);
Exemplo n.º 4
0
 partial void InsertDapAn(DapAn instance);
Exemplo n.º 5
0
 private void detach_DapAns(DapAn entity)
 {
     this.SendPropertyChanging();
     entity.CauHoi = null;
 }
Exemplo n.º 6
0
 private void attach_DapAns(DapAn entity)
 {
     this.SendPropertyChanging();
     entity.CauHoi = this;
 }
Exemplo n.º 7
0
        public DapAn getDapAnDung(int mach)
        {
            DapAn dapans = tnth.DapAns.Where(t => t.MaCH == mach && t.DungSai == true).FirstOrDefault();

            return(dapans);
        }