public ActionResult KetquathiTungGVBM() { var tk = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; var giaovien = new Bode().danhsachgiaovienbm(tk.TaiKhoan1); return(View(giaovien)); }
public ActionResult xemde(long id) { var khoch = new Bode().listkhocauhoi(id); ViewBag.linkpdf = xuatpdf(id, Request["tenmon"]); var de = new TracNghiemOnlineDB().Bo_De.Where(x => x.Ma_BoDe == id).FirstOrDefault(); ViewBag.TenDe = de.NoiDung; ViewBag.MonThi = de.MonHoc.TenMon; ViewBag.ThoiGianThi = de.ThoiGianThi; return(View(khoch)); }
public JsonResult guide(long maDe) { var admin = new TracNghiemOnlineDB().TaiKhoans.SingleOrDefault(x => x.ChưcVu.Equals("Admin")); var tk = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; // var bomon = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; TracNghiemOnlineDB db = new TracNghiemOnlineDB(); var Bode = db.Bo_De.Find(maDe); // var bomon = db.BoMons.Find(tk.TaiKhoan1); Bode.TrangThai = false; Bode.Ma_NguoiTao = tk.TaiKhoan1; DateTime dateTime = (DateTime)Session["Gio"]; Bode.PheDuyet = "Đang xử lý"; Bode.ThoiGianMo = dateTime; Bode.NguoiDuyet = admin.TaiKhoan1; db.SaveChanges(); List <Bo_De> bo_Des = new Bode().ListALLChapterBM(tk.TaiKhoan1); var bode1 = (from n in bo_Des select new { Ten = n.NoiDung, MaDe = n.Ma_BoDe, SoCau = n.CauHois.Count, ThoiGian = n.ThoiGianThi, TenMon = n.MonHoc.TenMon, Giaovien = n.GiaoVien.TenGV, Pheduyet = n.PheDuyet, Trangthai = n.TrangThai, }).ToList(); return(Json(new { Bode = bode1 }, JsonRequestBehavior.AllowGet));; }
private void ShowBodedWindow() { if (_bode_window == null) { _bode_window = new Bode(); } else if (_bode_window.Visibility == System.Windows.Visibility.Hidden) { _bode_window = new Bode(); } else if (_bode_window.Visibility == System.Windows.Visibility.Visible) { _bode_window.Activate(); } if (_bode_window.WindowState == System.Windows.WindowState.Minimized) { _bode_window.WindowState = System.Windows.WindowState.Normal; } _bode_window.Visibility = System.Windows.Visibility.Visible; }
public string xuatpdf(long id, string tenmon) { Document doc = new Document(); Section section = doc.AddSection(); section.PageSetup.Borders.BorderType = BorderStyle.DoubleWave; section.PageSetup.Borders.Color = Color.Black; section.PageSetup.Borders.Left.Space = 50; section.PageSetup.Borders.Right.Space = 50; section.PageSetup.Borders.Top.Space = 20; section.PageSetup.Borders.Bottom.Space = 20; //title Paragraph paratitle = section.AddParagraph(); paratitle.Format.HorizontalAlignment = HorizontalAlignment.Center; paratitle.AppendText("TRƯỜNG ĐẠI HỌC GIAO THÔNG VẬN TẢI PHÂN HIỆU TẠI TP HỒ CHÍ MINH"); ParagraphStyle styletitle = new ParagraphStyle(doc); styletitle.Name = "titleStyle"; styletitle.CharacterFormat.Bold = true; styletitle.CharacterFormat.TextColor = Color.Black; styletitle.CharacterFormat.FontName = "Arial"; styletitle.CharacterFormat.FontSize = 16f; doc.Styles.Add(styletitle); paratitle.ApplyStyle("titleStyle"); // tne mon de thi Paragraph paratenmon = section.AddParagraph(); paratenmon.Format.HorizontalAlignment = HorizontalAlignment.Left; paratenmon.AppendText("\n\nĐề thi môn:" + tenmon); ParagraphStyle styleleft = new ParagraphStyle(doc); styleleft.Name = "left"; styleleft.CharacterFormat.Bold = true; styleleft.CharacterFormat.TextColor = Color.Black; styleleft.CharacterFormat.FontName = "Arial"; styleleft.CharacterFormat.FontSize = 12f; doc.Styles.Add(styleleft); paratenmon.ApplyStyle("left"); // ma de thi Paragraph paramade = section.AddParagraph(); paramade.Format.HorizontalAlignment = HorizontalAlignment.Right; paramade.AppendText("\tMã đề:" + id + "\n\n\n"); ParagraphStyle styleright = new ParagraphStyle(doc); styleright.Name = "right"; styleright.CharacterFormat.Bold = true; styleright.CharacterFormat.TextColor = Color.Black; styleright.CharacterFormat.FontName = "Arial"; styleright.CharacterFormat.FontSize = 12f; doc.Styles.Add(styleright); paramade.ApplyStyle("right"); int slcau = 0; var khoch = new Bode().listkhocauhoi(id); foreach (var item in khoch) { Paragraph para1 = section.AddParagraph(); slcau++; int slda = 0; var s = tachcongthuc(item.NoiDung); para1.AppendText("\n"); para1.AppendText("Câu " + slcau + ":"); foreach (var item2 in s) { if (item2.Contains("<mml:math")) { try { OfficeMath officeMath; officeMath = new OfficeMath(doc); officeMath.FromMathMLCode(item2); para1.Items.Add(officeMath); } catch { } } else { para1.AppendHTML(item2); } } para1.AppendText("\n\n"); if (item.HinhAnh.Length > 0) { try { Image image = Image.FromFile(Server.MapPath(item.HinhAnh)); DocPicture pic = para1.AppendPicture(image); pic.Height = pic.Height; if (pic.Height > pic.Width) { pic.Height = 180; pic.Width = 120; } else if (pic.Height < pic.Width) { pic.Height = 120; pic.Width = 150; } else if (pic.Height == pic.Width) { pic.Height = 150; pic.Width = 150; } para1.AppendText("\n"); } catch { } } foreach (var da in item.Dap_AN) { var s1 = tachcongthuc(da.NoiDung); para1.AppendText("\n"); if (da.TrangThai == true) { para1.AppendText("*"); } else { para1.AppendText(""); } slda++; foreach (var item2 in s1) { if (item2.Contains("<mml:math")) { try { OfficeMath officeMath; officeMath = new OfficeMath(doc); officeMath.FromMathMLCode(item2); para1.Items.Add(officeMath); } catch { } } else { para1.AppendHTML(item2); } } if (da.HinhAnh.Length > 0) { try { para1.AppendText("\n\n"); Image image = Image.FromFile(Server.MapPath(da.HinhAnh)); DocPicture pic = para1.AppendPicture(image); if (pic.Height > pic.Width) { pic.Height = 120; pic.Width = 100; } else if (pic.Height < pic.Width) { pic.Height = 100; pic.Width = 120; } else if (pic.Height == pic.Width) { pic.Height = 120; pic.Width = 120; } para1.AppendText("\n"); } catch { } } } } Paragraph paragraph = section.Paragraphs[section.Count - 1]; Footnote footnote = paragraph.AppendFootnote(FootnoteType.Footnote); TextRange text = footnote.TextBody.AddParagraph().AppendText("HẾT"); text.CharacterFormat.FontName = "Arial Black"; text.CharacterFormat.FontSize = 12; text.CharacterFormat.TextColor = Color.SlateGray; doc.SaveToFile(Server.MapPath("~/Content/" + "De_" + id + ".docx")); doc.SaveToFile(Server.MapPath("~/Content/" + "De_" + id + ".pdf")); return("/Content/" + "De_" + id + ".pdf"); }