예제 #1
0
        public void create_docuchecks()
        {
            CaseStudy case_study = this.CaseStudy;
            List<CaseStudyDocket> case_study_dockets = case_study.CaseStudyDockets.ToList();
            List<Docket> dockets = new List<Docket>();
            List<Document> documents = new List<Document>();
            foreach (CaseStudyDocket csd in case_study_dockets)
            {
                dockets.Add(csd.Docket);
            }
            foreach (Docket d in dockets)
            {
                foreach (DocketDocument dd in d.DocketDocuments.ToList())
                {
                    Docucheck dchk = new Docucheck();
                    dchk.assignment_id = this.id;
                    dchk.document_id = dd.document_id;
                    dchk.docket_id = dd.docket_id;
                    List<ReferenceSet> reference_sets = d.SuperSet.ReferenceSets.ToList();
                    if (reference_sets.Count(a => a.correct == true) != 0)
                    {
                        Random r_id = new Random();
                        dchk.reference_set_id = reference_sets[r_id.Next(reference_sets.Count)].id;
                    }
                    else
                    {
                        dchk.reference_set_id = reference_sets.First().id;
                    }
                    DocumentorDBM.Docuchecks.InsertOnSubmit(dchk);
                    DocumentorDBM.SubmitChanges();
                    dchk.create_filled_section();

                }
            }
        }
 public ActionResult Create(Docucheck dc)
 {
     try
     {
         // TODO: Add insert logic here
         DocumentorDB.Docuchecks.InsertOnSubmit(dc);
         DocumentorDB.SubmitChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Delete(int id, Docucheck dc)
 {
     try
     {
         // TODO: Add delete logic here
         DocumentorDB.Docuchecks.DeleteOnSubmit(dc);
         DocumentorDB.SubmitChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
예제 #4
0
 public void create_docuchecks(int document_id, int docket_id)
 {
     Docket docket = DocumentorDBM.Dockets.Where(dkt => dkt.id == docket_id).First();
     foreach (DocketDocument dd in docket.DocketDocuments.Where(x => x.reference_document == true || x.document_id == document_id).ToList())
     {
         Docucheck dchk = new Docucheck();
         dchk.assignment_id = this.id;
         dchk.document_id = dd.document_id;
         dchk.docket_id = dd.docket_id;
         List<ReferenceSet> reference_sets = docket.SuperSet.ReferenceSets.ToList();
         if (reference_sets.Count(a => a.correct == true) > 1)
         {
             Random r_id = new Random();
             dchk.reference_set_id = reference_sets[r_id.Next(reference_sets.Count)].id;
         }
         else
         {
             dchk.reference_set_id = reference_sets.Where(a => a.correct == true).First().id;
         }
         DocumentorDBM.Docuchecks.InsertOnSubmit(dchk);
         DocumentorDBM.SubmitChanges();
         dchk.create_filled_section();
     }
 }
 public ActionResult Edit(int id, Docucheck dc)
 {
     try
     {
         // TODO: Add update logic here
         Docucheck old = DocumentorDB.Docuchecks.Where(a => a.id == id).First();
         //old.assignment_id = dc.assignment_id;
         old.document_id = dc.document_id;
         old.reference_set_id = dc.reference_set_id;
         DocumentorDB.SubmitChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
		private void detach_Docuchecks(Docucheck entity)
		{
			this.SendPropertyChanging();
			entity.Assignment = null;
		}
		private void detach_Docuchecks(Docucheck entity)
		{
			this.SendPropertyChanging();
			entity.ReferenceSet = null;
		}
		private void attach_Docuchecks(Docucheck entity)
		{
			this.SendPropertyChanging();
			entity.Docket = this;
		}
 partial void DeleteDocucheck(Docucheck instance);
 partial void UpdateDocucheck(Docucheck instance);
 partial void InsertDocucheck(Docucheck instance);