Пример #1
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int ID = int.Parse(((Label)(GridView1.Rows[e.RowIndex].FindControl("lblID"))).Text);

        DataTable dt4 = new tbl_ScoreTitleTableAdapter().GetDataByID_Lesson(ID);
        for (int j = 0; j < dt4.Rows.Count; j++)
        {
            new tbl_ScoreTableAdapter().DeleteTitle(int.Parse(dt4.Rows[j]["ScoreTitle_ID"].ToString()));
        }
        new tbl_ScoreTitleTableAdapter().DeleteLesson(ID);

        // Delete Test
        DataTable dt6 = new tbl_TestTableAdapter().GetDataByt_id_lesson(ID);
        for (int k = 0; k < dt4.Rows.Count; k++)
        {
            DataTable dt7 = new tbl_TestQuestionTableAdapter().GetDataByDetailStudent(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));
            for (int f = 0; f < dt7.Rows.Count; f++)
            {
                new tbl_TestResultDetailTableAdapter().DeleteQuestion(int.Parse(dt7.Rows[f]["TestQuestion_ID"].ToString()));
            }
            new tbl_TestQuestionTableAdapter().DeleteTest(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));

            new tbl_TestResultTableAdapter().DeleteTest(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));
        }
        new tbl_TestTableAdapter().DeleteLesson(ID);

        new tbl_LessonTableAdapter().Delete(ID);
        FillGrid();
    }
Пример #2
0
 private void Fill()
 {
     DataTable dt = new tbl_ScoreTitleTableAdapter().GetDataByID(int.Parse(Request.QueryString["ScoreTitle_ID"]));
     TextName.Text = dt.Rows[0]["StTitle"].ToString();
     DropDownList2.Items.FindByValue(dt.Rows[0]["StType"].ToString()).Selected = true;
     HiddenField1.Value = dt.Rows[0]["StID_Lesson"].ToString();
     FillPath(dt.Rows[0]["StID_Lesson"].ToString());
 }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int ID = int.Parse(((Label)(GridView1.Rows[e.RowIndex].FindControl("lblID"))).Text);
        int i = 0;

        // Delete Teacher
        DataTable dt20 = new tbl_TeacherInformationTableAdapter().GetDataByAdmin(ID);
        for (int h = 0; h < dt20.Rows.Count; h++)
        {
            new tbl_LinkTableAdapter().DeletePerson(int.Parse(dt20.Rows[i]["Teacher_ID"].ToString()),"Teacher");
            new tbl_ContentTableAdapter().DeletePerson("Teacher",int.Parse(dt20.Rows[i]["Teacher_ID"].ToString()));
            new tbl_PersonalMessageTableAdapter().DeleteUserMessage("Teacher", int.Parse(dt20.Rows[i]["Teacher_ID"].ToString()));

            // Delete Lesson
            DataTable dt3 = new tbl_LessonTableAdapter().GetDataByAllTeacher(int.Parse(dt20.Rows[i]["Teacher_ID"].ToString()));
            for (i = 0; i < dt3.Rows.Count; i++)
            {
                DataTable dt4 = new tbl_ScoreTitleTableAdapter().GetDataByID_Lesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));
                for (int j = 0; j < dt4.Rows.Count; j++)
                {
                    new tbl_ScoreTableAdapter().DeleteTitle(int.Parse(dt4.Rows[j]["ScoreTitle_ID"].ToString()));
                }
                new tbl_ScoreTitleTableAdapter().DeleteLesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));

                // Delete Test
                DataTable dt6 = new tbl_TestTableAdapter().GetDataByt_id_lesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));
                for (int k = 0; k < dt4.Rows.Count; k++)
                {
                    DataTable dt7 = new tbl_TestQuestionTableAdapter().GetDataByDetailStudent(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));
                    for (int f = 0; f < dt7.Rows.Count; f++)
                    {
                        new tbl_TestResultDetailTableAdapter().DeleteQuestion(int.Parse(dt7.Rows[f]["TestQuestion_ID"].ToString()));
                    }
                    new tbl_TestQuestionTableAdapter().DeleteTest(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));

                    new tbl_TestResultTableAdapter().DeleteTest(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));
                }
                new tbl_TestTableAdapter().DeleteLesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));
            }
            new tbl_LessonTableAdapter().DeleteTeacher(int.Parse(dt20.Rows[i]["Teacher_ID"].ToString()));

        }
        new tbl_TeacherInformationTableAdapter().DeleteAdmin(ID);

        // Delete Student Parent
        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByAdmin(ID);
        for (i = 0; i < dt.Rows.Count; i++)
        {
            new tbl_PersonalMessageTableAdapter().DeleteUserMessage("Student",
                int.Parse(dt.Rows[i]["Student_ID"].ToString()));
            new tbl_ScoreTableAdapter().DeleteStudent(int.Parse(dt.Rows[i]["Student_ID"].ToString()));

            DataTable dt10 = new tbl_ParentInformationTableAdapter().GetDataByPA_ID_Student(int.Parse(dt.Rows[i]["Student_ID"].ToString()));
            for (int f = 0; f < dt10.Rows.Count; f++)
            {
                new tbl_PersonalMessageTableAdapter().DeleteUserMessage("Parent",
                    int.Parse(dt10.Rows[f]["Parent_ID"].ToString()));
            }
            new tbl_ParentInformationTableAdapter().DeleteStudent(int.Parse(dt.Rows[i]["Student_ID"].ToString()));
        }
        new tbl_StudentInformationTableAdapter().DeleteAdmin(ID);

        // Delete Gallery
        DataTable dt5 = new tbl_GallerySubjectTableAdapter().GetDataByAdmin(ID);
        for (i = 0; i < dt5.Rows.Count; i++)
        {
            new tbl_GalleryPictureTableAdapter().Deletegp_ID_GallerySubject(int.Parse(dt5.Rows[i]["GallerySubjet_ID"].ToString()));
        }
        new tbl_GallerySubjectTableAdapter().DeleteAdmin(ID);

        new tbl_AdminSecurityTableAdapter().DeleteAS_ID_Admin(ID);
        new tbl_AdminPermissionCategoryTableAdapter().DeleteAPC_ID_Admin(ID);
         new tbl_ContentTableAdapter().DeletePerson("Admin", ID);
           new tbl_LinkTableAdapter().DeletePerson(ID, "Admin");
        new tbl_PersonalMessageTableAdapter().DeleteUserMessage("Admin", ID);
        new tbl_AdminInformationTableAdapter().DeleteAdmin(ID);
        FillGrid();
        Cancel();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int ID = int.Parse(((Label)(GridView1.Rows[e.RowIndex].FindControl("lblID"))).Text);

        int i = 0;

        // Delete Lesson
        DataTable dt3 = new tbl_LessonTableAdapter().GetDataByAllTeacher(ID);
        for (i = 0; i < dt3.Rows.Count; i++)
        {
            DataTable dt4 = new tbl_ScoreTitleTableAdapter().GetDataByID_Lesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));
            for (int j = 0; j < dt4.Rows.Count; j++)
            {
                new tbl_ScoreTableAdapter().DeleteTitle(int.Parse(dt4.Rows[j]["ScoreTitle_ID"].ToString()));
            }
            new tbl_ScoreTitleTableAdapter().DeleteLesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));

            // Delete Test
            DataTable dt6 = new tbl_TestTableAdapter().GetDataByt_id_lesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));
            for (int k = 0; k < dt4.Rows.Count; k++)
            {
                DataTable dt7 = new tbl_TestQuestionTableAdapter().GetDataByDetailStudent(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));
                for (int f = 0; f < dt7.Rows.Count; f++)
                {
                    new tbl_TestResultDetailTableAdapter().DeleteQuestion(int.Parse(dt7.Rows[f]["TestQuestion_ID"].ToString()));
                }
                new tbl_TestQuestionTableAdapter().DeleteTest(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));

                new tbl_TestResultTableAdapter().DeleteTest(int.Parse(dt6.Rows[k]["ID_Test"].ToString()));
            }
            new tbl_TestTableAdapter().DeleteLesson(int.Parse(dt3.Rows[i]["Lesson_ID"].ToString()));
        }
        new tbl_LessonTableAdapter().DeleteTeacher(ID);

        new tbl_ContentTableAdapter().DeletePerson("Teacher", ID);
        new tbl_LinkTableAdapter().DeletePerson(ID, "Teacher");
        new tbl_PersonalMessageTableAdapter().DeleteUserMessage("Teacher", ID);

        new tbl_TeacherInformationTableAdapter().Delete(ID);

        FillGrid();
        Cancel();
    }