public void SetNames() { using (var helper = new DbHelper.Exam()) { var type = helper.GetExamType(Convert.ToInt32(cmbExamType.SelectedValue)); if (type != null) { txtName.Text = type.Name; txtWeight.Text = type.Weight == null ? "" : type.Weight.ToString(); ddlWeight.SelectedIndex = (type.IsPercent) ? 0 : 1; CKEditor1.Text = type.Notice; } } }
protected void Page_Load(object sender, EventArgs e) { var user = Page.User as CustomPrincipal; if (user != null) { using (var helper = new DbHelper.Exam()) { var list = helper.ListExamTypes(user.SchoolId); DataList1.DataSource = list; DataList1.DataBind(); } } }
void SaveExamType() { if (Page.IsValid) { var user = Page.User as CustomPrincipal; if (user != null) { try { var ispercent = ddlWeight.SelectedIndex == 0; var eType = new Academic.DbEntities.Exams.ExamType() { Id = ExamTypeId , Name = txtName.Text , Description = txtDescription.Text , IsPercent = ispercent , SchoolId = user.SchoolId , Notice = CKEditor1.Text }; if (txtFullmarks.Text != "") { eType.FullMarks = Convert.ToInt32(txtFullmarks.Text); } if (txtPassmarks.Text != "") { eType.PassMarks = Convert.ToInt32(txtPassmarks.Text); } eType.Weight = (float)Convert.ToDecimal(txtWeight.Text); using (var helper = new DbHelper.Exam()) { var saved = helper.AddOrUpdateExamType(eType); if (saved != null) { Response.Redirect("~/Views/Exam/ExamType/ExamTypeList.aspx"); } } } catch { } } } }
private void LoadExams() { using (var helper = new DbHelper.Exam()) { var acaId = Convert.ToInt32(cmbAcademicYear.SelectedValue == "" ? "0" : cmbAcademicYear.SelectedValue); var sessId = Convert.ToInt32(cmbSession.SelectedValue == "" ? "0" : cmbSession.SelectedValue); var exams = helper.GetExamList(SchoolId, acaId, sessId); foreach (var exam in exams) { ItemsOfListUc item = (ItemsOfListUc)Page.LoadControl("~/Views/Exam/Exam/ExamList/ItemsOfListUc.ascx"); item.SetFields(exam.Id, exam.Name, exam.ExamType.Name, exam.ResultDate, exam.UpdatedDate , exam.Weight ?? 0, exam.NoticeContent); pnlExamList.Controls.Add(item); } } }
public void SetExams(int schoolId, int acaId, int sesId, string combinedName, bool completed) { if (completed) { btnNewExam.Visible = false; } else if (Manager) { btnNewExam.Visible = true; btnNewExam.NavigateUrl = "~/Views/Exam/Exam/CreateExam.aspx?aId=" + acaId + "&sId=" + sesId; } using (var helper = new DbHelper.Exam()) { var exams = helper.GetExamList(schoolId, acaId, sesId); dlistExam.DataSource = exams; dlistExam.DataBind(); } //both name combined lblAcaSesName.Text = combinedName; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //examOfClass var eoc = Request.QueryString["eocId"]; if (eoc != null) { try { hidExamOfClassId.Value = eoc; using (var ehelper = new DbHelper.Exam()) using (var shelper = new DbHelper.Subject()) using (var bhelper = new DbHelper.Batch()) { var examClass = ehelper.GetExamOfClass(ExamOfClassId); if (examClass != null) { //UI title and other controls lblExamName.Text = examClass.Exam.Name; lblClassName.Text = examClass.RunningClass.ProgramBatch.NameFromBatch; //Courses in this exam var lst = shelper.ListExamCourses(examClass.Id); var i = 1; foreach (var es in lst) { pnlSubjects.Controls.Add(new HyperLink() { Text = i + ". " + es.SubjectClass.SubjectStructure.Subject.FullName + "<br/>" , CssClass = "margin-top-bottom-little" }); i++; } //students in the exam i = 1; var stds = bhelper.ListStudentsOfProgramBatch(examClass.RunningClass.ProgramBatch.Id); foreach (var s in stds) { pnlStudents.Controls.Add(new HiddenField() { Value = s.UserId.ToString() }); pnlStudents.Controls.Add(new Label() { Text = i + ". " }); pnlStudents.Controls.Add(new Image() { ImageUrl = s.ImageUrl , Width = 40 , Height = 40 , BorderColor = Color.LightSlateGray , BorderWidth = 1 , BorderStyle = BorderStyle.Solid , //CssClass = "margin-top-bottom-little" }); pnlStudents.Controls.Add(new HyperLink() { Text = " " + s.CRN + " " + s.Name + "<br/>" , CssClass = "margin-top-bottom-little" }); i++; } } } } catch { } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { var eId = Request.QueryString["eId"]; if (eId != null) { using (var helper = new DbHelper.Exam()) { hidExamId.Value = eId; var examId = ExamId; var exam = helper.GetExam(examId); if (exam.ExamTypeId != null) { lblName.Text = exam.ExamType.Name; //noticeDiv.InnerText = exam.Notice; lblWeight.Text = exam.ExamType.Weight.ToString() + ((exam.IsPercent ?? false) ? " %" : " Marks"); if (exam.NoticeContent == "") { exam.NoticeContent = exam.ExamType.Notice; } } else { lblName.Text = exam.Name; lblWeight.Text = exam.Weight.ToString() + ((exam.IsPercent ?? false) ? " %" : " Marks"); } //noticeDiv.InnerText = Server.HtmlDecode(exam.Notice); var notice = exam.NoticeContent; notice = notice.Replace("@Start_Date", exam.StartDate == null ? "_ _ _" : exam.StartDate.Value.ToShortDateString()); notice = notice.Replace("@Result_Date", exam.ResultDate == null ? "_ _ _" : exam.ResultDate.Value.ToShortDateString()); notice = notice.Replace("@Name", exam.Name); notice = notice.Replace("@Weight", exam.Weight == null ? "_ _ _" : exam.Weight + (exam.IsPercent ?? false ? " %" : " Marks")); Literal1.Text = notice; //Label1.Text = exam.Notice; lblResultDate.Text = exam.ResultDate == null ? "" : exam.ResultDate.Value.ToShortDateString(); lblStartDate.Text = exam.StartDate == null ? "" : exam.StartDate.Value.ToShortDateString(); //exam classes var classes = helper.ListExamClasses(examId); var progs = classes.GroupBy(x => x.RunningClass.Year.Program).OrderBy(y => y.Key.Name); foreach (var p in progs) { var label1 = new Label() { Text = "<div style=\"text-align: left;\">● " + p.Key.Name + "</div>" }; pnlClasses.Controls.Add(label1); var years = p.GroupBy(x => x.RunningClass.Year).OrderBy(y => y.Key.Position); foreach (var y in years) { var label2 = new HyperLink() { Text = " " + y.Key.Name , CssClass = "link" , Font = { Underline = false } }; pnlClasses.Controls.Add(label2); foreach (var s in y) { if (s.RunningClass.SubYearId != null) { label2.Text += " , " + s.RunningClass.SubYear.Name; } label2.Text += (s.RunningClass == null ? "" : " | " + s.RunningClass.ProgramBatch.NameFromBatch) + "<br/>"; label2.NavigateUrl = "~/Views/Exam/Exam/ExamClass.aspx?eocId=" + s.Id; } } } } } } catch { } } }
protected void btnSaveExam_Click(object sender, EventArgs e) { var user = User as CustomPrincipal; //var text = txtNotice.Text; //if (text.Contains("script")) //{ // return; //} if (Page.IsValid && user != null) { var exam = new Academic.DbEntities.Exams.Exam(); if (cmbExamType.SelectedValue == "0") { //then exam will be custom exam.Id = ExamId; exam.AcademicYearId = AcademicYearId; //exam.ExamCoordinatorId = Convert.ToInt32(cor) exam.Name = txtName.Text; exam.Weight = (float)Convert.ToDecimal(txtWeight.Text == "" ? "0" : txtWeight.Text); exam.CreatedDate = DateTime.Now; exam.NoticeContent = CKEditor1.Text; exam.SchoolId = user.SchoolId; exam.CreatedBy = user.Id; exam.IsPercent = (ddlWeight.SelectedIndex == 0) ? true : false; exam.PublishNoticeToNoticeBoard = chkPublish.Checked; if (!String.IsNullOrEmpty(txtStartDate.Text)) { exam.StartDate = Convert.ToDateTime(txtStartDate.Text); } if (!String.IsNullOrEmpty(txtResultDate.Text)) { exam.ResultDate = Convert.ToDateTime(txtResultDate.Text); } if (SessionId > 0) { exam.SessionId = SessionId; } //not needed to insert examTypeId since its now custom if (ExamTypeId == 0) { exam.ExamTypeId = null; } //if (ExamTypeId > 0) // exam.ExamTypeId = ExamTypeId; if (ExamId > 0) { exam.Id = ExamId; } } else { //then exam will be refrencing examType exam.Id = ExamId; exam.AcademicYearId = AcademicYearId; //exam.ExamCoordinatorId = Convert.ToInt32(cor) //exam.Name = txtName.Text //exam.Weight = (float)Convert.ToDecimal(txtWeight.Text == "" ? "0" : txtWeight.Text) exam.CreatedDate = DateTime.Now; exam.NoticeContent = CKEditor1.Text; exam.SchoolId = user.SchoolId; exam.CreatedBy = user.Id; exam.PublishNoticeToNoticeBoard = chkPublish.Checked; //IsPercent = (ddlWeight.SelectedIndex == 0) ? true : false //, if (!String.IsNullOrEmpty(txtStartDate.Text)) { exam.StartDate = Convert.ToDateTime(txtStartDate.Text); } if (!String.IsNullOrEmpty(txtResultDate.Text)) { exam.ResultDate = Convert.ToDateTime(txtResultDate.Text); } if (SessionId > 0) { exam.SessionId = SessionId; } if (ExamTypeId > 0) { exam.ExamTypeId = ExamTypeId; } if (ExamId > 0) { exam.Id = ExamId; } } using (var helper = new DbHelper.Exam()) { //uncomment this //var saved = helper.AddOrUpdateExam(exam, user.Id, ProgramSelection1.GetData(),txtTitleOfNotice.Text); //if (saved != null) //{ // Response.Redirect("~/Views/Exam/Exam/ExamsList.aspx?aId=" + saved.AcademicYearId + "&sId=" + // (saved.SessionId ?? 0)); //} //else //{ // lblError.Visible = true; //} } } }
protected void Page_Load(object sender, EventArgs e) { lblError.Visible = false; if (!IsPostBack) { //Page.ValidateRequestMode = ValidateRequestMode.Disabled; var aId = Request.QueryString["aId"]; var sId = Request.QueryString["sId"]; var eId = Request.QueryString["eId"]; try { if (aId != null) { if (sId != null) { SessionId = Convert.ToInt32(sId.ToString()); } AcademicYearId = Convert.ToInt32(aId.ToString()); } if (eId != null) { //edit ExamTypeId = Convert.ToInt32(eId.ToString()); } } catch { Response.Redirect("~/Views/Exam/Exam/ExamsList.aspx"); } var user = Page.User as CustomPrincipal; if (user != null) { hidSchoolId.Value = user.SchoolId.ToString(); using (var helper = new DbHelper.Exam()) { var et = helper.ListExamTypes(user.SchoolId); et.Insert(0, new Academic.DbEntities.Exams.ExamType() { Id = 0 , Name = "Custom..." }); cmbExamType.DataSource = et; cmbExamType.DataBind(); } } } LoadPrograms(); //string parameter = Request["__EVENTARGUMENT"]; //if (parameter == "visible") //{ // //pnlCoordinator.Visible = true; //} //else if (parameter == "invisible") //{ // pnlCoordinator.Visible = false; //} }