Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Username"] != null && Session["Token"] != null && Session["Id_mod"] != null)
                    {
                        ReadAllGradeCommand cmd = new ReadAllGradeCommand();
                        cmd.Execute();
                        grade_list = cmd.Grades;
                        foreach (Grade grade in grade_list)
                        {
                            list_grades.DataTextField  = "Name";
                            list_grades.DataValueField = "Id";
                            list_grades.DataSource     = grade_list;
                            list_grades.DataBind();
                        }

                        string id_mod = Session["Id_mod"].ToString();
                        course     = new Course();
                        section    = new Section();
                        section.Id = Int32.Parse(id_mod);
                        ReadSectionCommand cmd_ = new ReadSectionCommand(section);
                        cmd_.Execute();
                        section   = cmd_.Section;
                        course.Id = section.Course.Id;
                        ReadCourseCommand cmd__ = new ReadCourseCommand(course);
                        cmd__.Execute();
                        course = cmd__.Course;
                        list_grades.SelectedValue = course.Grade.Id.ToString();
                        Grade grade_ = new Grade();
                        grade_.Id   = Int32.Parse(list_grades.SelectedValue);
                        grade_.Name = list_grades.DataTextField;
                        ReadAllCourseByGradeCommand _cmd = new ReadAllCourseByGradeCommand(grade_);
                        _cmd.Execute();
                        course_list = _cmd.Courses;
                        foreach (Course course in course_list)
                        {
                            list_course.DataTextField  = "Name";
                            list_course.DataValueField = "Id";
                            list_course.DataSource     = course_list;
                            list_course.DataBind();
                        }
                        list_course.SelectedValue = course.Id;
                        name.Value   = section.Name;
                        desc.Value   = section.Description;
                        amount.Value = section.Amount.ToString();
                    }
                    else
                    {
                        Response.Redirect("/site/admin/login.aspx");
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Username"] != null && Session["Token"] != null && Session["Id_mat"] != null)
                    {
                        ReadAllGradeCommand cmd = new ReadAllGradeCommand();
                        cmd.Execute();
                        grade_list = cmd.Grades;
                        foreach (Grade grade in grade_list)
                        {
                            list_grades.DataTextField  = "Name";
                            list_grades.DataValueField = "Id";
                            list_grades.DataSource     = grade_list;
                            list_grades.DataBind();
                        }

                        string id_mat = Session["Id_mat"].ToString();
                        course    = new Course();
                        course.Id = id_mat;
                        ReadCourseCommand cmd_ = new ReadCourseCommand(course);
                        cmd_.Execute();
                        course = cmd_.Course;
                        list_grades.SelectedValue = course.Grade.Id.ToString();
                        name.Value = course.Name;
                        desc.Value = course.Description;
                    }
                    else
                    {
                        Response.Redirect("/site/admin/login.aspx");
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Username"] != null && Session["Token"] != null && Session["Id_doc"] != null)
                    {
                        ReadAllGradeCommand cmd = new ReadAllGradeCommand();
                        cmd.Execute();
                        grade_list = cmd.Grades;
                        foreach (Grade grade in grade_list)
                        {
                            list_grades.DataTextField  = "Name";
                            list_grades.DataValueField = "Id";
                            list_grades.DataSource     = grade_list;
                            list_grades.DataBind();
                        }

                        string Id_doc = Session["Id_doc"].ToString();
                        document    = new Document();
                        section     = new Section();
                        course      = new Course();
                        topic       = new Topic();
                        document.Id = Int32.Parse(Id_doc);
                        ReadDocumentCommand cmd_ = new ReadDocumentCommand(document);
                        cmd_.Execute();
                        document = cmd_.Document;
                        topic.Id = document.Topic.Id;
                        ReadTopicCommand __cmd_ = new ReadTopicCommand(topic);
                        __cmd_.Execute();
                        topic      = __cmd_.Topic;
                        section.Id = topic.Section.Id;
                        ReadSectionCommand cmd__ = new ReadSectionCommand(section);
                        cmd__.Execute();
                        section   = cmd__.Section;
                        course.Id = section.Course.Id;
                        ReadCourseCommand _cmd = new ReadCourseCommand(course);
                        _cmd.Execute();
                        course = _cmd.Course;
                        list_grades.SelectedValue = course.Grade.Id.ToString();
                        Grade grade_ = new Grade();
                        grade_.Id   = Int32.Parse(list_grades.SelectedValue);
                        grade_.Name = list_grades.DataTextField;
                        ReadAllCourseByGradeCommand __cmd = new ReadAllCourseByGradeCommand(grade_);
                        __cmd.Execute();
                        course_list = __cmd.Courses;
                        foreach (Course course in course_list)
                        {
                            list_course.DataTextField  = "Name";
                            list_course.DataValueField = "Id";
                            list_course.DataSource     = course_list;
                            list_course.DataBind();
                        }
                        list_course.SelectedValue = course.Id;
                        Course _course = new Course();
                        _course.Id   = list_course.SelectedValue;
                        _course.Name = list_course.DataTextField;
                        ReadAllSectionByCourseCommand _cmd_ = new ReadAllSectionByCourseCommand(course);
                        _cmd_.Execute();
                        section_list = _cmd_.Sections;
                        foreach (Section section in section_list)
                        {
                            list_section.DataTextField  = "Name";
                            list_section.DataValueField = "Id";
                            list_section.DataSource     = section_list;
                            list_section.DataBind();
                        }
                        list_section.SelectedValue = section.Id.ToString();
                        Section _section = new Section();
                        _section.Id   = Int32.Parse(list_section.SelectedValue);
                        _section.Name = list_section.DataTextField;
                        ReadAllTopicByTopicCommand __cmd__ = new ReadAllTopicByTopicCommand(section);
                        __cmd__.Execute();
                        topic_list = __cmd__.Topics;
                        foreach (Topic topic in topic_list)
                        {
                            list_topic.DataTextField  = "Name";
                            list_topic.DataValueField = "Id";
                            list_topic.DataSource     = topic_list;
                            list_topic.DataBind();
                        }
                        list_topic.SelectedValue = topic.Id.ToString();
                        name.Value = document.File;
                    }
                    else
                    {
                        Response.Redirect("/site/admin/login.aspx");
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }