File manager - Edit - G:/PleskVhosts/indiaminerals.in/tlt.INFOFIXDEVELOPERS.COM/Send Web/admin/examlist.aspx.cs
Back
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebApp.LIBS; using Business; namespace WebApp.students { public partial class examlist : BasePageClassStudent { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<Notifications> objss = new List<Notifications>(); DateTime dtdatetime = Common.DateTimeNow(); var obj = Global.Context.StudentExams.AsEnumerable().Where(p => p.IsActive == true && p.ExamDate.Value.Date == dtdatetime.Date && p.StudentId == SiteSession.Student.StudentID && p.IsAtten == false).Select(p => new { p.StudentExamId, p.ExamAllot.ExamDate, p.ExamAllot.Course.CourseName, p.ExamAllot.TotalQuestion, TimeDurationMentus = p.ExamAllot.TimeDurationMentus.Value.ToString() + " Minutes", GenrateQuations = (p.GenrateQuations.HasValue ? p.GenrateQuations.Value : false) }); Common.BindControl(todayexams, obj.ToList()); var objs= Global.Context.StudentExams.AsEnumerable().Where(p => p.IsActive == true && p.ExamDate.Value.Date < dtdatetime.Date && p.StudentId == SiteSession.Student.StudentID && p.IsAtten == false).ToList(); objs.ForEach(p=> { objss.Add(new Notifications() { Message = "You can't Attend Exam on " + p.ExamDate.Value.ToString("dd-MM-yyyy") + " , If you want Re-Atten Exam Please Submit Exam fees and if any please contact Administrator", Css = "color:red", }); }); var sv = Global.Context.StudentExams.AsEnumerable().Where(p => p.IsActive == true && p.ExamDate.Value.Date > dtdatetime.Date && p.StudentId == SiteSession.Student.StudentID && p.IsAtten == false).ToList(); sv.ForEach(p => { objss.Add(new Notifications() { Message = "upcomming Exam on " + p.ExamDate.Value.ToString("dd-MM-yyyy") + " for "+p.ExamAllot.Course.CourseName, Css = "color:green", }); }); Common.BindControl(Repeater1, objss.ToList()); } } protected void todayexams_ItemCommand(object source, RepeaterCommandEventArgs e) { try { if (e.CommandName == "sends") { int Id = Convert.ToInt32(e.CommandArgument); var obj = Global.Context.StudentExams.SingleOrDefault(T => T.StudentExamId == Id); if (obj.GenrateQuations.HasValue) { if (obj.GenrateQuations.Value == false) { int sn = 1; string str = ""; var obsj = Global.Context.Quotations.Where(p => p.CourseID == obj.ExamAllot.CourseId && p.IsActive.Value).ToList().OrderBy(p => p.QuotationsId).Select(c => new { sns = sn++, c.QuotationsId }).ToList(); var unique = Common.IntArrayWithSize(1, obsj.Count, obj.ExamAllot.TotalQuestion.Value); for (int i = 1; i <= obj.ExamAllot.TotalQuestion.Value; i++) { int IDValue = unique[i - 1]; str = str + "insert into StudentAskQuetions (QuetionsId,Answer,StudentExamId) values (" + obsj.SingleOrDefault(p => p.sns == IDValue).QuotationsId + ",0," + obj.StudentExamId + ");"; sn++; } Global.Context.ExcecuteQuery(str); obj.GenrateQuations = true; obj.Save(); Response.Redirect("takeexam.aspx?examid=" + Id + "", false); } } else { int sn = 1; string str = ""; var obsj = Global.Context.Quotations.Where(p => p.CourseID == obj.ExamAllot.CourseId && p.IsActive.Value).ToList().OrderBy(p => p.QuotationsId).Select(c => new { sns = sn++, c.QuotationsId }).ToList(); var unique = Common.IntArrayWithSize(1, obsj.Count, obj.ExamAllot.TotalQuestion.Value); for (int i = 1; i <= obj.ExamAllot.TotalQuestion.Value; i++) { int IDValue = unique[i - 1]; str = str + "insert into StudentAskQuetions (QuetionsId,Answer,StudentExamId) values (" + obsj.SingleOrDefault(p => p.sns == IDValue).QuotationsId + ",0," + obj.StudentExamId + ");"; sn++; } Global.Context.ExcecuteQuery(str); obj.GenrateQuations = true; obj.Save(); Response.Redirect("takeexam.aspx?examid=" + Id + "", false); } } } catch (Exception ex) { String Message = (ex.InnerException != null ? ex.InnerException.Message : ex.Message); if (Message.Contains("UNIQUE KEY")) { Message = "Record already exists. Please enter another."; } Message2.ShowMessage("Error", Message, SiteKey.MessageType.danger); } } } public partial class Notifications { public string Message { get; set; } public string Css { get; set; } } }
| ver. 1.4 |
Github
|
.
| PHP 7.3.33 | Generation time: 0.08 |
proxy
|
phpinfo
|
Settings