Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (CurrentClassType != 0)
         {
             //BindData();
             DBLayer db = new DBLayer();
             DataSet ds = new DataSet();
             ds = db.GetClassType(CurrentClassType);
             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();
             }
             uiPanelCurrentClassType.Visible = false;
             uiPanelCurrent.Visible = true;
         }
         else
         {
             uiPanelCurrentClassType.Visible = true;
             uiPanelCurrent.Visible = false;
             BindData();
         }
     }
 }
Пример #2
0
        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;
            }
        }
Пример #3
0
 protected void uiGridViewClassType_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditClassType")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentClassType = id;
         DBLayer db = new DBLayer();
         DataSet ds = new DataSet();
         ds = db.GetClassType(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();
         }
         uiPanelCurrentClassType.Visible = false;
         uiPanelCurrent.Visible = true;
     }
     else if (e.CommandName == "DeleteClassType")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentClassType = id;
         DBLayer db = new DBLayer();
         db.DeleteClassType(id);
         uiPanelCurrentClassType.Visible = true;
         uiPanelCurrent.Visible = false;
         BindData();
     }
 }