protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadDDLs(); if (CurrentActiveStudent != 0) { //BindData(); DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetStudent(CurrentActiveStudent); if (ds.Tables[0].Rows.Count > 0) { uiGridViewStudentResults.DataSource = db.GetResultByStudentIDAndSchoolYearForAdmin(CurrentActiveStudent, Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue)); uiGridViewStudentResults.DataBind(); uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ArStudentName"].ToString() + ds.Tables[0].Rows[0]["ArFatherName"].ToString(); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); } uiPanelCurrentStudents.Visible = false; uiPanelCurrent.Visible = true; } else { uiPanelCurrentStudents.Visible = true; uiPanelCurrent.Visible = false; BindStudentData(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadDDLs(); if (CurrentCheckedStudent != 0) { //BindData(); DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetStudent(CurrentCheckedStudent); if (ds.Tables[0].Rows.Count > 0) { uiGridViewStudentsAbsence.DataSource = db.GetMonthlyAttendanceReportByStudentID(CurrentCheckedStudent); uiGridViewStudentsAbsence.DataBind(); uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ArStudentName"].ToString() + ds.Tables[0].Rows[0]["ArFatherName"].ToString(); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); } uiPanelCurrentStudents.Visible = false; uiPanelCurrent.Visible = true; } else { uiPanelCurrentStudents.Visible = true; uiPanelCurrent.Visible = false; BindStudentData(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadDDLs(); if (CurrentClass != 0) { //BindData(); DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetClass(CurrentClass); if (ds.Tables[0].Rows.Count > 0) { uiTextBoxEnName.Text = ds.Tables[0].Rows[0]["EnName"].ToString(); uiTextBoxArName.Text = ds.Tables[0].Rows[0]["ArName"].ToString(); if (ds.Tables[0].Rows[0]["ClassTypeID"] != null) { uiDropDownListClassType.SelectedValue = ds.Tables[0].Rows[0]["ClassTypeID"].ToString(); } } uiPanelCurrentClasses.Visible = false; uiPanelCurrent.Visible = true; } else { uiPanelCurrentClasses.Visible = true; uiPanelCurrent.Visible = false; BindData(); } } }
protected void uiButtonViewResult_Click(object sender, EventArgs e) { DBLayer db = new DBLayer(); DataSet Student= new DataSet(); Student = db.GetStudent(Convert.ToInt32(Session["CurrentLoggedInStudent"].ToString())); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(Student.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); DataSet ClassType = new DataSet(); ClassType = db.GetClassType(Convert.ToInt32(StudentClass.Tables[0].Rows[0]["ClassTypeID"].ToString())); DataSet CoursesInTotal = new DataSet(); DataSet CoursesRemaining = new DataSet(); CoursesInTotal = db.GetAllCoursesByClassAndInTotal(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString()), true); CoursesRemaining = db.GetAllCoursesByClassAndInTotal(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString()), false); switch (StudentClass.Tables[0].Rows[0]["ClassTypeID"].ToString()) { case "1": uiDataListKidResults.DataSource = db.GetResultByStudentIDAndSchoolYear(Convert.ToInt32(Session["CurrentLoggedInStudent"].ToString()), Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue),FHMT, FHF, SHMT, SHF); uiDataListKidResults.DataBind(); uiLabelKidName.Text = Student.Tables[0].Rows[0]["ArStudentname"].ToString() + " " + Student.Tables[0].Rows[0]["Arfathername"].ToString(); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); uiPanelKids.Visible = true; uiPanelPrepratory.Visible = false; uiPanelPrimary.Visible = false; break; case "2": DataSet AllCoursesPrimary = db.GetResultByStudentIDAndSchoolYear(Convert.ToInt32(Session["CurrentLoggedInStudent"].ToString()), Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue), FHMT, FHF, SHMT, SHF); /*DataRow[] InTotalCourses = AllCoursesPrimary.Tables[0].Select("InTotal = 1"); */ uiDataListCourseInTotalPrimary.DataSource = AllCoursesPrimary; uiDataListCourseInTotalPrimary.DataBind(); uiLabelStudentName.Text = Student.Tables[0].Rows[0]["ArStudentname"].ToString() + " " + Student.Tables[0].Rows[0]["Arfathername"].ToString(); uiLabelClassPrim.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); uiLabelClassPrimary.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); uiPanelKids.Visible = false; uiPanelPrepratory.Visible = false; uiPanelPrimary.Visible = true; break; case "3": DataSet AllCoursesPrep = db.GetResultByStudentIDAndSchoolYear(Convert.ToInt32(Session["CurrentLoggedInStudent"].ToString()), Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue), FHMT, FHF, SHMT, SHF); uiDataListPrep.DataSource = AllCoursesPrep; uiDataListPrep.DataBind(); uiLabelStudentNamePrep.Text = Student.Tables[0].Rows[0]["ArStudentname"].ToString() + " " + Student.Tables[0].Rows[0]["Arfathername"].ToString(); uiLabelClassPrep.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); uiLabelClassPreparatory.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); uiPanelKids.Visible = false; uiPanelPrepratory.Visible = true; uiPanelPrimary.Visible = false; break; default: break; } }
protected void uiGridViewStudents_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditFees") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentStudentActive = id; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetStudent(CurrentStudentActive); if (ds.Tables[0].Rows.Count > 0) { uiGridViewStudentsFees.DataSource = db.GetFeesByClassAndClassRoomAndSchoolYear(Convert.ToInt32(uiDropDownListClasses.SelectedValue), Convert.ToInt32(uiDropDownListClassRooms.SelectedValue), Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue)); uiGridViewStudentsFees.DataBind(); uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ARStudentName"].ToString() + " " + ds.Tables[0].Rows[0]["ArFatherName"].ToString(); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); } uiPanelCurrentFees.Visible = false; uiPanelCurrent.Visible = true; } }
protected void uiGridViewSchoolYears_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditSchoolYear") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentSchoolYear = id; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetClass(id); if (ds.Tables[0].Rows.Count > 0) { uiTextBoxEnName.Text = ds.Tables[0].Rows[0]["EnName"].ToString(); uiTextBoxArName.Text = ds.Tables[0].Rows[0]["ArName"].ToString(); uiCheckBoxCurrentYear.Checked = (bool)ds.Tables[0].Rows[0]["CurrentYear"]; } uiPanelCurrentSchoolYear.Visible = false; uiPanelCurrent.Visible = true; } else if (e.CommandName == "DeleteSchoolYear") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentSchoolYear = id; DBLayer db = new DBLayer(); db.DeleteSchoolYear(id); uiPanelCurrentSchoolYear.Visible = true; uiPanelCurrent.Visible = false; BindData(); } }
private void BindData() { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetStudent(CurrentCheckedStudent); if (ds.Tables[0].Rows.Count > 0) { uiGridViewStudentsAbsence.DataSource = db.GetMonthlyAttendanceReportByStudentID(CurrentCheckedStudent); uiGridViewStudentsAbsence.DataBind(); uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ARStudentName"].ToString() + " " + ds.Tables[0].Rows[0]["ArFatherName"].ToString(); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); } uiPanelCurrentStudents.Visible = false; uiPanelCurrent.Visible = true; }
protected void uiGridViewStudents_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditReports") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentCheckedStudent = id; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetStudent(CurrentCheckedStudent); if (ds.Tables[0].Rows.Count > 0) { uiGridViewStudentsAbsence.DataSource = db.GetMonthlyAttendanceReportByStudentID(CurrentCheckedStudent); uiGridViewStudentsAbsence.DataBind(); uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ARStudentName"].ToString() + " " + ds.Tables[0].Rows[0]["ArFatherName"].ToString(); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); } uiPanelCurrentStudents.Visible = false; uiPanelCurrent.Visible = true; } }
private void BindData() { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetStudent(CurrentActiveStudent); if (ds.Tables[0].Rows.Count > 0) { uiGridViewStudentResults.DataSource = db.GetResultByStudentIDAndSchoolYearForAdmin(CurrentActiveStudent, Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue)); uiGridViewStudentResults.DataBind(); uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ArStudentName"].ToString() + ds.Tables[0].Rows[0]["ArFatherName"].ToString(); DataSet StudentClassRoom = new DataSet(); StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString())); DataSet StudentClass = new DataSet(); StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString())); uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString(); } uiPanelCurrentStudents.Visible = false; uiPanelCurrent.Visible = true; }
protected void uiGridViewClasses_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditClass") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentClass = id; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetClass(id); if (ds.Tables[0].Rows.Count > 0) { uiTextBoxEnName.Text = ds.Tables[0].Rows[0]["EnName"].ToString(); uiTextBoxArName.Text = ds.Tables[0].Rows[0]["ArName"].ToString(); if (ds.Tables[0].Rows[0]["ClassTypeID"] != null) { uiDropDownListClassType.SelectedValue = ds.Tables[0].Rows[0]["ClassTypeID"].ToString(); } } uiPanelCurrentClasses.Visible = false; uiPanelCurrent.Visible = true; } else if (e.CommandName == "EditClassRoom") { int id = Convert.ToInt32(e.CommandArgument.ToString()); Session["CurrentClassForclassRoom"] = id; Response.Redirect("EditClassRoom.aspx"); } else if (e.CommandName == "DeleteClass") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentClass = id; DBLayer db = new DBLayer(); db.DeleteClass(id); uiPanelCurrentClasses.Visible = true; uiPanelCurrent.Visible = false; BindData(); } }