protected void Button15_Click(object sender, EventArgs e) { var x = Request.QueryString["id"].ToString(); int y = int.Parse(x); Tbl_chapter rr = db.Tbl_chapter.First(u => u.Chapter_ID == y); db.Tbl_chapter.Remove(rr); db.SaveChanges(); var x1 = Request.QueryString["pr"].ToString(); int y1 = int.Parse(x1); Response.Redirect("ProfEditChapters.aspx?id=" + y1); }
protected void Button1_Click(object sender, EventArgs e) { var ch = new Tbl_chapter { Name_En = LevelEn.Text, Name_Ar = " ", Subject_ID = int.Parse(DropDownList3.SelectedValue.ToString()), }; db.Tbl_chapter.Add(ch); db.SaveChanges(); LevelEn.Text = ""; //LevelAr.Text = ""; }
protected void Button32_Click(object sender, EventArgs e) { var x = Request.QueryString["id"].ToString(); int y = int.Parse(x); Tbl_chapter rr = db.Tbl_chapter.First(u => u.Chapter_ID == y); rr.Subject_ID = int.Parse(DropDownList15.SelectedValue.ToString()); rr.Name_Ar = TextBox24.Text; rr.Name_En = TextBox23.Text; db.SaveChanges(); var x1 = Request.QueryString["pr"].ToString(); int y1 = int.Parse(x1); Response.Redirect("ProfEditChapters.aspx?id=" + y1); }
protected void Timer1_Tick(object sender, EventArgs e) { //var x = Request.QueryString["st"].ToString(); //int y = int.Parse(x); //Response.Redirect("StudentChoseExam.aspx?id=" + y); var chap = Request.QueryString["id"].ToString(); int ch = int.Parse(chap); Tbl_ExamStructure rr = db.Tbl_ExamStructure.First(u => u.Chapter_ID == ch); int MCQA = rr.Num_Ques_Mcq_A; int MCQB = rr.Num_Ques_Mcq_B; int MCQC = rr.Num_Ques_Mcq_C; int TFA = rr.Num_Ques_TF_A; int TFB = rr.Num_Ques_TF_B; int TFC = rr.Num_Ques_TF_C; int ques = MCQA + MCQB + MCQC + TFA + TFB + TFC; var x = Request.QueryString["st"].ToString(); int y = int.Parse(x); Tbl_chapter rr1 = db.Tbl_chapter.First(u => u.Chapter_ID == ch); int sub = rr1.Subject_ID; var re = new Tbl_Result { Student_ID = y, Chapter_ID = ch, Result = int.Parse(Label8.Text), Subject_ID = sub, }; db.Tbl_Result.Add(re); db.SaveChanges(); Label1.Text = "your result " + Label8.Text + " from " + ques.ToString(); Label9.Text = "الدرجة" + Label8.Text + " من" + ques.ToString(); RadioButtonList1.Visible = false; RadioButtonList2.Visible = false; Button1.Visible = false; Button2.Visible = true; }
protected void Button1_Click(object sender, EventArgs e) { int mark = int.Parse(RadioButtonList1.SelectedValue.ToString()); int final_mark = int.Parse(Label8.Text); final_mark += mark; Label8.Text = final_mark.ToString(); var chap = Request.QueryString["id"].ToString(); int ch = int.Parse(chap); Tbl_ExamStructure rr = db.Tbl_ExamStructure.First(u => u.Chapter_ID == ch); int MCQA = rr.Num_Ques_Mcq_A; int MCQB = rr.Num_Ques_Mcq_B; int MCQC = rr.Num_Ques_Mcq_C; int TFA = rr.Num_Ques_TF_A; int TFB = rr.Num_Ques_TF_B; int TFC = rr.Num_Ques_TF_C; int ques = MCQA + MCQB + MCQC + TFA + TFB + TFC; int y1 = int.Parse(Label2.Text); int y2 = int.Parse(Label3.Text); int y3 = int.Parse(Label4.Text); int y4 = int.Parse(Label5.Text); int y5 = int.Parse(Label6.Text); int y6 = int.Parse(Label7.Text); int num = y1 + y2 + y3 + y4 + y5 + y6; if (y1 < MCQA) { var rrA = db.Tbl_Question.Where(u => u.Chapter_ID == ch && u.Question_Level == "A" && u.Type == "MCQ").OrderBy(u => u.Question_ID).Skip(y1); foreach (var item in rrA) { Label1.Text = item.Question_En.ToString(); y1 += 1; Label2.Text = y1.ToString(); int qA = item.Question_ID; var stateidA = from Tbl_Answer in db.Tbl_Answer where Tbl_Answer.Question_ID == qA select new { Tbl_Answer.Answer_En, Tbl_Answer.Correct_Answer }; var statenameA = stateidA.ToList(); if (statenameA.Count > 0) { RadioButtonList1.DataSource = statenameA.ToList(); RadioButtonList1.DataTextField = "Answer_En"; RadioButtonList1.DataValueField = "Correct_Answer"; RadioButtonList1.DataBind(); } break; } } else if (y2 < MCQB) { var rrA = db.Tbl_Question.Where(u => u.Chapter_ID == ch && u.Question_Level == "B" && u.Type == "MCQ").OrderBy(u => u.Question_ID).Skip(y2); foreach (var item in rrA) { Label1.Text = item.Question_En.ToString(); y2 += 1; Label3.Text = y2.ToString(); int qA = item.Question_ID; var stateidA = from Tbl_Answer in db.Tbl_Answer where Tbl_Answer.Question_ID == qA select new { Tbl_Answer.Answer_En, Tbl_Answer.Correct_Answer }; var statenameA = stateidA.ToList(); if (statenameA.Count > 0) { RadioButtonList1.DataSource = statenameA.ToList(); RadioButtonList1.DataTextField = "Answer_En"; RadioButtonList1.DataValueField = "Correct_Answer"; RadioButtonList1.DataBind(); } break; } } else if (y3 < MCQC) { var rrA = db.Tbl_Question.Where(u => u.Chapter_ID == ch && u.Question_Level == "C" && u.Type == "MCQ").OrderBy(u => u.Question_ID).Skip(y3); foreach (var item in rrA) { Label1.Text = item.Question_En.ToString(); y3 += 1; Label4.Text = y3.ToString(); int qA = item.Question_ID; var stateidA = from Tbl_Answer in db.Tbl_Answer where Tbl_Answer.Question_ID == qA select new { Tbl_Answer.Answer_En, Tbl_Answer.Correct_Answer }; var statenameA = stateidA.ToList(); if (statenameA.Count > 0) { RadioButtonList1.DataSource = statenameA.ToList(); RadioButtonList1.DataTextField = "Answer_En"; RadioButtonList1.DataValueField = "Correct_Answer"; RadioButtonList1.DataBind(); } break; } } else if (y4 < TFA) { var rrA = db.Tbl_Question.Where(u => u.Chapter_ID == ch && u.Question_Level == "A" && u.Type == "T/F").OrderBy(u => u.Question_ID).Skip(y4); foreach (var item in rrA) { Label1.Text = item.Question_En.ToString(); y4 += 1; Label5.Text = y4.ToString(); int qA = item.Question_ID; var stateidA = from Tbl_Answer in db.Tbl_Answer where Tbl_Answer.Question_ID == qA select new { Tbl_Answer.Answer_En, Tbl_Answer.Correct_Answer }; var statenameA = stateidA.ToList(); if (statenameA.Count > 0) { RadioButtonList1.DataSource = statenameA.ToList(); RadioButtonList1.DataTextField = "Answer_En"; RadioButtonList1.DataValueField = "Correct_Answer"; RadioButtonList1.DataBind(); } break; } } else if (y5 < TFB) { var rrA = db.Tbl_Question.Where(u => u.Chapter_ID == ch && u.Question_Level == "B" && u.Type == "T/F").OrderBy(u => u.Question_ID).Skip(y5); foreach (var item in rrA) { Label1.Text = item.Question_En.ToString(); y5 += 1; Label6.Text = y5.ToString(); int qA = item.Question_ID; var stateidA = from Tbl_Answer in db.Tbl_Answer where Tbl_Answer.Question_ID == qA select new { Tbl_Answer.Answer_En, Tbl_Answer.Correct_Answer }; var statenameA = stateidA.ToList(); if (statenameA.Count > 0) { RadioButtonList1.DataSource = statenameA.ToList(); RadioButtonList1.DataTextField = "Answer_En"; RadioButtonList1.DataValueField = "Correct_Answer"; RadioButtonList1.DataBind(); } break; } } else if (y6 < TFC) { var rrA = db.Tbl_Question.Where(u => u.Chapter_ID == ch && u.Question_Level == "C" && u.Type == "T/F").OrderBy(u => u.Question_ID).Skip(y6); foreach (var item in rrA) { Label1.Text = item.Question_En.ToString(); y6 += 1; Label7.Text = y6.ToString(); int qA = item.Question_ID; var stateidA = from Tbl_Answer in db.Tbl_Answer where Tbl_Answer.Question_ID == qA select new { Tbl_Answer.Answer_En, Tbl_Answer.Correct_Answer }; var statenameA = stateidA.ToList(); if (statenameA.Count > 0) { RadioButtonList1.DataSource = statenameA.ToList(); RadioButtonList1.DataTextField = "Answer_En"; RadioButtonList1.DataValueField = "Correct_Answer"; RadioButtonList1.DataBind(); } break; } } else if (num == ques) { var x = Request.QueryString["st"].ToString(); int y = int.Parse(x); Tbl_chapter rr1 = db.Tbl_chapter.First(u => u.Chapter_ID == ch); int sub = rr1.Subject_ID; var re = new Tbl_Result { Student_ID = y, Chapter_ID = ch, Result = int.Parse(Label8.Text), Subject_ID = sub, }; db.Tbl_Result.Add(re); db.SaveChanges(); Label1.Text = "your result " + Label8.Text + " from " + ques.ToString(); RadioButtonList1.Visible = false; Button1.Visible = false; Button2.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var x = Request.QueryString["page"].ToString(); int y = int.Parse(x); if (y == 1) { Panel2.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_department rr = db.Tbl_department.First(u => u.Department_ID == y1); int dep = Convert.ToInt32(rr.Level_ID); var stateid = from Tbl_Level in db.Tbl_Level where Tbl_Level.Level_ID.Equals(dep) select new { Tbl_Level.Name_Ar, Tbl_Level.Name_Er, Tbl_Level.Level_ID }; var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar }; DropDownList1.DataSource = le.ToList(); DropDownList1.DataValueField = "Level_ID"; DropDownList1.DataTextField = "Name_Er"; DropDownList1.DataBind(); DropDownList1.SelectedValue = dep.ToString(); name_ar_dep.Text = rr.Name_Ar; name_en_dep.Text = rr.Name_En; } else if (y == 112) { Panel7.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_department rr = db.Tbl_department.First(u => u.Department_ID == y1); int dep = Convert.ToInt32(rr.Level_ID); var stateid = from Tbl_Level in db.Tbl_Level where Tbl_Level.Level_ID.Equals(dep) select new { Tbl_Level.Name_Ar, Tbl_Level.Name_Er, Tbl_Level.Level_ID }; var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar }; DropDownList9.DataSource = le.ToList(); DropDownList9.DataValueField = "Level_ID"; DropDownList9.DataTextField = "Name_Ar"; DropDownList9.DataBind(); DropDownList9.SelectedValue = dep.ToString(); TextBox14.Text = rr.Name_Ar; TextBox13.Text = rr.Name_En; } else if (y == 21) { Panel8.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Subject rr = db.Tbl_Subject.First(u => u.Subject_ID == y1); int pro = Convert.ToInt32(rr.Prof_ID); var stateid = from Tbl_Prof in db.Tbl_Prof where Tbl_Prof.Approval.Equals("1") select new { Tbl_Prof.Prof_ID, Tbl_Prof.Name }; //var pr = from Tbl_Prof in db.Tbl_Prof select new { Tbl_Prof.Name, Tbl_Prof.Prof_ID }; DropDownList10.DataSource = stateid.ToList(); DropDownList10.DataValueField = "Prof_ID"; DropDownList10.DataTextField = "Name"; DropDownList10.DataBind(); DropDownList10.SelectedValue = pro.ToString(); int dep = Convert.ToInt32(rr.Department_ID); Tbl_department de = db.Tbl_department.First(d => d.Department_ID == dep); int lev = Convert.ToInt32(de.Level_ID); var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar }; DropDownList11.DataSource = le.ToList(); DropDownList11.DataValueField = "Level_ID"; DropDownList11.DataTextField = "Name_Ar"; DropDownList11.DataBind(); DropDownList11.SelectedValue = lev.ToString(); var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En, Tbl_department.Name_Ar }; var statename = stateidDep.ToList(); if (statename.Count > 0) { DropDownList12.DataSource = statename; DropDownList12.DataValueField = "Department_ID"; DropDownList12.DataTextField = "Name_Ar"; DropDownList12.DataBind(); DropDownList12.SelectedValue = dep.ToString(); } TextBox15.Text = rr.Name_Er; TextBox16.Text = rr.Name_Ar; } else if (y == 2) { Panel3.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Subject rr = db.Tbl_Subject.First(u => u.Subject_ID == y1); int pro = Convert.ToInt32(rr.Prof_ID); var stateid = from Tbl_Prof in db.Tbl_Prof where Tbl_Prof.Approval.Equals("1") select new { Tbl_Prof.Prof_ID, Tbl_Prof.Name }; //var pr = from Tbl_Prof in db.Tbl_Prof select new { Tbl_Prof.Name, Tbl_Prof.Prof_ID }; DropDownList4.DataSource = stateid.ToList(); DropDownList4.DataValueField = "Prof_ID"; DropDownList4.DataTextField = "Name"; DropDownList4.DataBind(); DropDownList4.SelectedValue = pro.ToString(); int dep = Convert.ToInt32(rr.Department_ID); Tbl_department de = db.Tbl_department.First(d => d.Department_ID == dep); int lev = Convert.ToInt32(de.Level_ID); var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID }; DropDownList2.DataSource = le.ToList(); DropDownList2.DataValueField = "Level_ID"; DropDownList2.DataTextField = "Name_Er"; DropDownList2.DataBind(); DropDownList2.SelectedValue = lev.ToString(); var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En }; var statename = stateidDep.ToList(); if (statename.Count > 0) { DropDownList3.DataSource = statename; DropDownList3.DataValueField = "Department_ID"; DropDownList3.DataTextField = "Name_En"; DropDownList3.DataBind(); DropDownList3.SelectedValue = dep.ToString(); } TextBox1.Text = rr.Name_Er; TextBox2.Text = rr.Name_Ar; } else if (y == 31) { Panel9.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Prof rr = db.Tbl_Prof.First(u => u.Prof_ID == y1); TextBox17.Text = rr.Name.ToString(); TextBox18.Text = rr.Password.ToString(); TextBox19.Text = rr.Email.ToString(); } else if (y == 3) { Panel1.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Prof rr = db.Tbl_Prof.First(u => u.Prof_ID == y1); TextBox4.Text = rr.Name.ToString(); TextBox5.Text = rr.Password.ToString(); TextBox6.Text = rr.Email.ToString(); } else if (y == 41) { Panel10.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Student rr = db.Tbl_Student.First(u => u.Student_ID == y1); TextBox20.Text = rr.Name.ToString(); TextBox21.Text = rr.Password.ToString(); TextBox22.Text = rr.Email.ToString(); var lev = rr.Level_ID; var dep = rr.Department_ID; var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar }; DropDownList13.DataSource = le.ToList(); DropDownList13.DataValueField = "Level_ID"; DropDownList13.DataTextField = "Name_Ar"; DropDownList13.DataBind(); DropDownList13.SelectedValue = lev.ToString(); var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En, Tbl_department.Name_Ar }; var statename = stateidDep.ToList(); if (statename.Count > 0) { DropDownList14.DataSource = statename; DropDownList14.DataValueField = "Department_ID"; DropDownList14.DataTextField = "Name_Ar"; DropDownList14.DataBind(); DropDownList14.SelectedValue = dep.ToString(); } } else if (y == 4) { Panel4.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Student rr = db.Tbl_Student.First(u => u.Student_ID == y1); TextBox3.Text = rr.Name.ToString(); TextBox7.Text = rr.Password.ToString(); TextBox8.Text = rr.Email.ToString(); var lev = rr.Level_ID; var dep = rr.Department_ID; var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID }; DropDownList5.DataSource = le.ToList(); DropDownList5.DataValueField = "Level_ID"; DropDownList5.DataTextField = "Name_Er"; DropDownList5.DataBind(); DropDownList5.SelectedValue = lev.ToString(); var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En }; var statename = stateidDep.ToList(); if (statename.Count > 0) { DropDownList6.DataSource = statename; DropDownList6.DataValueField = "Department_ID"; DropDownList6.DataTextField = "Name_En"; DropDownList6.DataBind(); DropDownList6.SelectedValue = dep.ToString(); } } else if (y == 61) { Panel11.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_chapter rr = db.Tbl_chapter.First(u => u.Chapter_ID == y1); int dep = Convert.ToInt32(rr.Subject_ID); var x2 = Request.QueryString["pr"].ToString(); int y2 = int.Parse(x2); var stateid = from Tbl_Subject in db.Tbl_Subject where Tbl_Subject.Prof_ID.Equals(y2) select new { Tbl_Subject.Subject_ID, Tbl_Subject.Name_Ar }; var statename = stateid.ToList(); if (statename.Count > 0) { DropDownList15.DataValueField = "Subject_ID"; DropDownList15.DataTextField = "Name_Ar"; DropDownList15.DataSource = statename; DropDownList15.DataBind(); DropDownList15.Items.Insert(0, "--- select sub----"); } DropDownList15.SelectedValue = dep.ToString(); TextBox24.Text = rr.Name_Ar; TextBox23.Text = rr.Name_En; } else if (y == 6) { Panel5.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_chapter rr = db.Tbl_chapter.First(u => u.Chapter_ID == y1); int dep = Convert.ToInt32(rr.Subject_ID); var x2 = Request.QueryString["pr"].ToString(); int y2 = int.Parse(x2); var stateid = from Tbl_Subject in db.Tbl_Subject where Tbl_Subject.Prof_ID.Equals(y2) select new { Tbl_Subject.Subject_ID, Tbl_Subject.Name_Er }; var statename = stateid.ToList(); if (statename.Count > 0) { DropDownList7.DataValueField = "Subject_ID"; DropDownList7.DataTextField = "Name_Er"; DropDownList7.DataSource = statename; DropDownList7.DataBind(); DropDownList7.Items.Insert(0, "--- select sub----"); } DropDownList7.SelectedValue = dep.ToString(); TextBox10.Text = rr.Name_Ar; TextBox9.Text = rr.Name_En; } else if (y == 71) { Panel12.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Question rr = db.Tbl_Question.First(u => u.Question_ID == y1); TextBox26.Text = rr.Question_Ar.ToString(); TextBox25.Text = rr.Question_En.ToString(); DropDownList16.SelectedValue = rr.Question_Level.ToString(); var x2 = Request.QueryString["pr"].ToString(); int y2 = int.Parse(x2); } else if (y == 7) { Panel6.Visible = true; var x1 = Request.QueryString["id"].ToString(); int y1 = int.Parse(x1); Tbl_Question rr = db.Tbl_Question.First(u => u.Question_ID == y1); TextBox12.Text = rr.Question_Ar.ToString(); TextBox11.Text = rr.Question_En.ToString(); DropDownList8.SelectedValue = rr.Question_Level.ToString(); var x2 = Request.QueryString["pr"].ToString(); int y2 = int.Parse(x2); } } }