public ActionResult DeleteConfirmed(int id) { EvaluationForm evaluationForm = db.EvaluationForm.Find(id); db.EvaluationForm.Remove(evaluationForm); db.SaveChanges(); return(RedirectToAction("Index")); }
public void PostPublishedformsTest() { // TODO: add unit test for the method 'PostPublishedforms' EvaluationForm body = null; // TODO: replace null with proper value var response = instance.PostPublishedforms(body); Assert.IsInstanceOf <EvaluationForm> (response, "response is EvaluationForm"); }
public void PutFormsFormIdTest() { // TODO: add unit test for the method 'PutFormsFormId' string formId = null; // TODO: replace null with proper value EvaluationForm body = null; // TODO: replace null with proper value var response = instance.PutFormsFormId(formId, body); Assert.IsInstanceOf <EvaluationForm> (response, "response is EvaluationForm"); }
public ActionResult Create([Bind(Include = "id,year,iscurent")] EvaluationForm evaluationForm) { if (ModelState.IsValid) { db.EvaluationForm.Add(evaluationForm); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(evaluationForm)); }
public void FillInfo() { QuestionInfoMan_Business questionInfoMan = new QuestionInfoMan_Business(); if (Request[RequestMSG.PaperID] != null) { int paperID = Convert.ToInt32(Request[RequestMSG.PaperID]); evaluation = questionInfoMan.GetEvaluationFormForPaper(paperID); } else { Response.Redirect(ServerDirectory.Host + "Dashboard.aspx"); } }
// GET: EvaluationForms/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EvaluationForm evaluationForm = db.EvaluationForm.Find(id); if (evaluationForm == null) { return(HttpNotFound()); } return(View(evaluationForm)); }
// GET: EvaluationForms/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EvaluationForm evaluationForm = db.EvaluationForm.Find(id); if (evaluationForm == null) { return(HttpNotFound()); } var R = from b in db.Sections select new { b.Id, b.SectionName, b.Description, b.TotalPoints, Checked = ((from ab in db.EvaluaationFormtoSections where (ab.EvaluationFormID == id) & (ab.SectionsID == b.Id) select ab).Count() > 0) }; var Myviewmodel = new EvaluationFormViewModel(); Myviewmodel.id = id.Value; Myviewmodel.year = evaluationForm.year; Myviewmodel.iscurent = evaluationForm.iscurent; var Myviewmodel2 = new List <CheckSectionsViewModel>(); foreach (var item in R) { Myviewmodel2.Add(new CheckSectionsViewModel { Id = item.Id, SectionName = item.SectionName, Description = item.Description, TotalPoints = item.TotalPoints, Checked = item.Checked }); } Myviewmodel.Sections = Myviewmodel2; return(View(Myviewmodel)); }
protected void btnFinish_Click(object sender, EventArgs e) { string txtbDescriptiveQuestionTitle = ""; string txtbAnswerTitle = ""; string txtbNumQuestionTitle = ""; string txtbMin = ""; string txtbMax = ""; string txtbOptionalQuestionTitle = ""; string txtbOptions = ""; string[] Options; // Multiple_ChoiceQuestions multiChoice = null; NumericQuestion numeric = null; WrittenQuestions written = null; QuestionInfoMan_Business business = new QuestionInfoMan_Business(); EvaluationForm evaluationForm = new EvaluationForm(); evaluationForm.Title = txtbEvaTitle.Text; // for (int i = 0; i < 100; i++) { txtbDescriptiveQuestionTitle = Request.Form["txtbDescriptiveQuestionTitle" + (i + 1)]; txtbAnswerTitle = Request.Form["txtbAnswerTitle" + (i + 1)]; txtbNumQuestionTitle = Request.Form["txtbNumQuestionTitle" + (i + 1)]; txtbMin = Request.Form["txtbMinScore" + (i + 1)]; txtbMax = Request.Form["txtbmaxScore" + (i + 1)]; txtbOptionalQuestionTitle = Request.Form["txtbOptionalQuestionTitle" + (i + 1)]; txtbOptions = Request.Form["txtbOptions" + (i + 1)]; // if (txtbDescriptiveQuestionTitle != null && txtbAnswerTitle != null && txtbDescriptiveQuestionTitle != string.Empty && txtbAnswerTitle != string.Empty) { written = new WrittenQuestions(); written.Title = txtbDescriptiveQuestionTitle; written.AnswerTilte = txtbAnswerTitle; evaluationForm.Add(written); } else if (txtbNumQuestionTitle != null && txtbMin != null && txtbMax != null && txtbNumQuestionTitle != string.Empty && txtbMin != string.Empty && txtbMax != string.Empty) { numeric = new NumericQuestion(); numeric.Title = txtbNumQuestionTitle; numeric.Min = float.Parse(txtbMin); numeric.Max = float.Parse(txtbMax); evaluationForm.Add(numeric); } else if (txtbOptionalQuestionTitle != null && txtbOptions != null && txtbOptionalQuestionTitle != string.Empty && txtbOptions != string.Empty) { multiChoice = new Multiple_ChoiceQuestions(); multiChoice.Title = txtbOptionalQuestionTitle; Options = txtbOptions.Split(';'); for (int j = 0; j < Options.Length; j++) { multiChoice.Add(new AnswerOption() { Title = Options[j] }); } evaluationForm.Add(multiChoice); } else { break; } } DBmessage dbm = business.RegisterEvaluationForm(txtbEvaTitle.Text, evaluationForm); ShowNotify(dbm); }
public void Init() { instance = new EvaluationForm(); }
public ActionResult into(int?id) { if (id == null) { return(HttpNotFound()); } EvaluationForm evaluationForm = db.EvaluationForm.Find(id); //var R = from b in db.EvaluaationFormtoSections // select new // { // b.EvaluationFormID, // b.SectionsID, // }; var te = db.TopicEVs.Where(a => a.EvaluationFormId == evaluationForm.id); if (evaluationForm.iscurent == true && te.Count() <= 0) { var R = db.EvaluaationFormtoSections.Where(a => a.EvaluationFormID == evaluationForm.id); var R2 = from b in db.SectionstoTopics select new { b.TopicsID, b.SectionsID, }; var R3 = from b in db.Teachers select new { b.Id, b.Vacation }; var lasit = new List <TopicEV>(); var lasit2 = new List <EvaluaationFormtoSections>(); var lasit3 = new List <SectionstoTopics>(); foreach (var item in R) { lasit2.Add(new EvaluaationFormtoSections { EvaluationFormID = item.EvaluationFormID, SectionsID = item.SectionsID }); } foreach (var item in R2) { lasit3.Add(new SectionstoTopics { SectionsID = item.SectionsID, TopicsID = item.TopicsID }); } foreach (var item in lasit2) { if (item.EvaluationFormID == id) { foreach (var item2 in lasit3) { if (item2.SectionsID == item.SectionsID) { var top = db.Topics.Find(item2.TopicsID); if (top.isActivate == false) { foreach (var item3 in R3) { if (item3.Vacation == false) { // lasit.Add(new TopicEV { EvaluationFormId = item.EvaluationFormID, SectionsId = item.SectionsID, TopicsId = item2.TopicsID, TeacherId = item3.Id }); db.TopicEVs.Add(new TopicEV { EvaluationFormId = item.EvaluationFormID, SectionsId = item.SectionsID, TopicsId = item2.TopicsID, TeacherId = item3.Id }); } } } } } } } db.SaveChanges(); Session["message"] = "تم تفعيل الاستماره"; return(RedirectToAction("Index")); } else { Session["message"] = " هذا الاستماره مفعله سابقا ذا كنت تريد تفعيل نفس الاستماره يجب ان تعمل نسخه لها وتفعيلها"; } return(RedirectToAction("Index")); }