Ejemplo n.º 1
0
    private void FillGrid()
    {
        GridView1.SelectedIndex = -1;
        int ID_Admin = 0;
        if (Request.Cookies["Type_Role"].Value.ToString() == "Teacher")
        {
            DataTable dt = new tbl_TeacherInformationTableAdapter().GetDataByID(int.Parse(Request.Cookies["ID_Role"].Value.ToString()));
            ID_Admin=int.Parse(dt.Rows[0]["TI_ID_Admin"].ToString());
        }
        else if (Request.Cookies["Type_Role"].Value.ToString() == "Parent")
        {

            DataTable dt2 = new tbl_ParentInformationTableAdapter().GetDataByID(int.Parse(Request.Cookies["ID_Role"].Value.ToString()));

            DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(dt2.Rows[0]["PA_ID_Student"].ToString()));
            ID_Admin = int.Parse(dt.Rows[0]["SI_ID_Admin"].ToString());
        }
        else if (Request.Cookies["Type_Role"].Value.ToString() == "Student")
        {
            DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(Request.Cookies["ID_Role"].Value.ToString()));
            ID_Admin= int.Parse(dt.Rows[0]["SI_ID_Admin"].ToString());
        }
        GridView1.DataSource = new tbl_AdminInformationTableAdapter().GetDataByAdminListTeacher(ID_Admin);

        GridView1.DataBind();
    }
Ejemplo n.º 2
0
    private void Fill()
    {
        int ID = int.Parse(Request.QueryString["ID_Student"]);
        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(ID);
        if (dt.Rows.Count > 0)
        {
            TextName = dt.Rows[0]["SI_Name"].ToString();
            TextFatherName = dt.Rows[0]["SI_FatherName"].ToString();
            TextAddress = dt.Rows[0]["SI_Address"].ToString();
            TextTell = dt.Rows[0]["SI_Tell"].ToString();
            TextPostalCode = dt.Rows[0]["SI_PostalCode"].ToString();
            TextExportPlace = dt.Rows[0]["SI_ExportPlace"].ToString();
            TextBirthDate = dt.Rows[0]["SI_BirthDate"].ToString();
            TextAdminCode = dt.Rows[0]["SI_StudentCode"].ToString();
            TextUserName = dt.Rows[0]["SI_UserName"].ToString();
            TextEndTime = dt.Rows[0]["SI_Stu_End_Time"].ToString();
            TextStartTime = dt.Rows[0]["SI_Stu_Start_Time"].ToString();

            TextFatherMobile = dt.Rows[0]["SI_FatherMobile"].ToString();
            TextFatherJob = dt.Rows[0]["SI_FatherJob"].ToString();
            TextMotherMobile = dt.Rows[0]["SI_MotherMobile"].ToString();
            TextMotherName = dt.Rows[0]["SI_MotherName"].ToString();
            TextMotherJob = dt.Rows[0]["SI_MotherJob"].ToString();

            Image1.ImageUrl = dt.Rows[0]["SI_Picture"].ToString();
            if (System.IO.File.Exists(Server.MapPath(Image1.ImageUrl)))
            {
            }
            else
            {
                Image1.ImageUrl = "~//Image_User//default_pic.png";
            }
            FillPath("Student", dt.Rows[0]["Student_ID"].ToString(), dt.Rows[0]["SI_ID_Category"].ToString());
        }
    }
    private void FillGrid()
    {
        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(Request.Cookies["ID_Role"].Value));
            int ID_Category =int.Parse( dt.Rows[0]["SI_ID_Category"].ToString());

            GridView1.SelectedIndex = -1;
            GridView1.DataSource = new tbl_StudentInformationTableAdapter().GetDataByCategory_ID(ID_Category);
            GridView1.DataBind();
            FillPath(ID_Category.ToString());
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
            {
                string title = "";
                string name = "";
                string Type = ((Label)(e.Row.FindControl("lblTypeGetter"))).Text;
                string ID = ((Label)(e.Row.FindControl("lblIDGetter"))).Text;
                DataTable dt;
                if (Type == "Admin")
                {
                    dt = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(ID));
                    name = dt.Rows[0]["AI_name"].ToString();
                    if (name.Trim().Length == 0)
                    {
                        name = dt.Rows[0]["AI_username"].ToString();
                    }
                    title = "مدیر";
                }
                else if (Type == "Teacher")
                {
                    dt = new tbl_TeacherInformationTableAdapter().GetDataByID(int.Parse(ID));
                    name = dt.Rows[0]["TI_name"].ToString();
                    if (name.Trim().Length == 0)
                    {
                        name = dt.Rows[0]["TI_username"].ToString();
                    }
                    title = "معلم";
                }
                else if (Type == "Parent")
                {
                    dt = new tbl_ParentInformationTableAdapter().GetDataByID(int.Parse(ID));
                    name = dt.Rows[0]["PA_name"].ToString();
                    if (name.Trim().Length == 0)
                    {
                        name = dt.Rows[0]["PA_username"].ToString();
                    }

                    title = "اولیاء";
                }
                else if (Type == "Student")
                {
                    dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
                    name = dt.Rows[0]["SI_name"].ToString();
                    if (name.Trim().Length == 0)
                    {
                        name = dt.Rows[0]["SI_username"].ToString();
                    }
                    title = "دانش آموز";
                }

                ((Label)(e.Row.FindControl("lblName"))).Text = name + " ( " + title + " ) ";

            }
    }
    private void FillDr()
    {
        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(Request.Cookies["ID_Role"].Value));
        int ID_Category = int.Parse(dt.Rows[0]["SI_ID_Category"].ToString());

        DropDownList1.Items.Clear();
        DropDownList1.DataValueField = "Lesson_ID";
        DropDownList1.DataTextField = "Les_Name";
        DropDownList1.DataSource = new tbl_LessonTableAdapter().GetDataByCategory_ID(ID_Category);
        DropDownList1.DataBind();
        DropDownList1.Visible = true;
    }
Ejemplo n.º 6
0
    private void FillPath(string Type, string ID, string ID_Category)
    {
        string title = "";
        string name = "";

        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
        name = dt.Rows[0]["SI_name"].ToString();
        if (name.Trim().Length == 0)
        {
            name = dt.Rows[0]["SI_username"].ToString();
        }
        title = " دانش آموزان";
        lblPath.Text = lblPath.Text  +
            title +  " >> " + FillPath2(ID_Category) +
            "<a href='./index.aspx?Type=" + Type + "Detail&" +
            "ID_" + Type + "=" + ID + "'>" +
            name + "</a>";

        Message = "<a  href='index.aspx?Type=PersonalMessageInsert&Type_Role_Getter=" +
            Type + "&ID_Role_Getter=" + ID + "'>ارسال پیام شخصی</a>";
    }
Ejemplo n.º 7
0
    private void FillChild(string Type,string ID)
    {
        string name = "";

        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
        name = dt.Rows[0]["SI_name"].ToString();
        if (name.Trim().Length == 0)
        {
            name = dt.Rows[0]["SI_username"].ToString();
        }
        if (Request.Cookies["Type_Role"].Value != "Parent")
        {

            ChildName = "<a href='./index.aspx?Type=" + Type + "Detail&" +
                "ID_" + Type + "=" + ID + "'>" +
                name + "</a>";
        }
        else
        {
            ChildName = name;
        }
    }
    private void FillGrid()
    {
        int ID_Category = -10;
        string cat_path = "";
        if (Request.Cookies["Type_Role"].Value.ToString() == "Parent")
        {
            int ID_Role = int.Parse(Request.Cookies["ID_Role"].Value.ToString());
            DataTable dt = new tbl_ParentInformationTableAdapter().GetDataByParentInformationCategoryStudentInformationPersonParent(ID_Role);
            cat_path = dt.Rows[0]["Cat_Path"].ToString();
            ID_Category = int.Parse(dt.Rows[0]["Category_ID"].ToString());
        }
        else if (Request.Cookies["Type_Role"].Value.ToString() == "Student")
        {

            int ID_Role = int.Parse(Request.Cookies["ID_Role"].Value.ToString());
            DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudentInformationCategoryWhereID_Student(ID_Role);
            cat_path = dt.Rows[0]["Cat_Path"].ToString();
            ID_Category = int.Parse(dt.Rows[0]["SI_ID_Category"].ToString());

        }

        GridView1.DataSource = new tbl_GallerySubjectTableAdapter().GetDataByPerson(ID_Category, cat_path);
        GridView1.DataBind();
    }
    private void FillPath(string Type, string ID)
    {
        string title = "";
        string name = "";

        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
        name = dt.Rows[0]["SI_name"].ToString();
        if (name.Trim().Length == 0)
        {
            name = dt.Rows[0]["SI_username"].ToString();
        }
        title = "مدیریت دانش آموزان";
        lblPath.Text = lblPath.Text + "<a href='./index.aspx?Type=StudentInformationManage'>" +
            title + "</a>" + " >> " +
            "<a href='./index.aspx?Type=AdminEditStudent&Student_ID=" + ID + "'>" +
            name + "</a>";
    }
    private void FillTest()
    {
        int ID_Student = int.Parse(Request.QueryString["ID_Student"]);
        int ID_Test = int.Parse(Request.QueryString["ID_Test"]);

        DataTable dt = new tbl_TestTableAdapter().GetDataByTest_ID(ID_Test);
        lblTestTitle=dt.Rows[0]["t_title"].ToString();

        DataTable dt2= new tbl_TestResultTableAdapter().GetDataByScoreStudent(ID_Test,ID_Student);
        if (dt2.Rows.Count > 0)
        {
            txtScoreAllTest.Text = dt2.Rows[0]["tr_Score"].ToString();
        }

        DataTable dt3 = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(ID_Student);
        lblName.Text = dt3.Rows[0]["SI_Name"].ToString();
        if (lblName.Text.Length == 0)
        {
            lblName.Text = dt3.Rows[0]["SI_UserName"].ToString();

        }
        lblName.Text = "<a href='index.aspx?Type=StudentDetail&ID_Student=" + dt3.Rows[0]["Student_ID"].ToString() +
            "'>" + lblName.Text + "</a>";
    }
Ejemplo n.º 11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Folder1 = "~\\Image_User\\Image_Parent\\";
        string File_Name1 = FileUpload1.FileName.ToString().Trim();
        string Address_Full1 = check_name_File(Folder1, File_Name1);

        ////////////////////////////////////////////////////////////////////////
        string Code = TextCode.Text;
        string StudentCode = TextStudentCode.Text;
        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByUserNameAndStudentCode(Code, StudentCode);
        if (dt.Rows.Count > 0)
        {
            int id_Student = int.Parse(dt.Rows[0]["Student_ID"].ToString());
            DataTable dt5 = new tbl_ParentInformationTableAdapter().GetDataByPA_ID_Student(id_Student);
            if (dt5.Rows.Count == 0)
            {
                if (new tbl_ParentInformationTableAdapter().GetDataByUsername(TextUserName.Text).Rows.Count == 0)
                {
                    int ID_Stdent = int.Parse(dt.Rows[0]["Student_ID"].ToString());
                    if (FileUpload1.HasFile)
                    {
                        if (FileUpload1.PostedFile.ContentLength < 5120000)
                        {
                            string pic = Address_Full1;
                            new tbl_ParentInformationTableAdapter().Insert1(
                                TextName.Text,
                                TextMobile.Text,
                                TextUserName.Text,
                                new main_class().Encode(TextPassword.Text),
                                ID_Stdent,
                                TextJob.Text,
                                TextTell.Text,
                                TextAddress.Text,
                                pic, new main_class().GetDate(), "");

                            /////////////////////////////////////////
                            if (FileUpload1.HasFile)
                            {
                                Save_File(FileUpload1, Address_Full1);
                            }
                        }
                        else
                        {
                            Response.Write("<script>alert('حجم باید کمتر از 5000 کیلو بایت باشد')</script>");
                        }
                    }
                    else
                    {
                        string pic1 = "";
                        new tbl_ParentInformationTableAdapter().Insert1(
                            TextName.Text,
                            TextMobile.Text,
                            TextUserName.Text,
                            new main_class().Encode(TextPassword.Text),
                            ID_Stdent,
                            TextJob.Text,
                            TextTell.Text,
                            TextAddress.Text,
                            pic1, new main_class().GetDate(), "");
                        /////////////////////////////////////////
                        if (FileUpload1.HasFile)
                        {
                            Save_File(FileUpload1, Address_Full1);
                        }

                    }

                    lblError.Text = "ثبت نام به درستی انجام شد";
                    lblError.Visible = true;

                }

                else
                {
                    lblError.Text = "نام کاربری وارد شده تکراری میباشد";
                    lblError.Visible = true;
                }
            }
            else
            {
                lblError.Text = "برای این دانش آموز قبلا اولیایی به ثبت رسیده است";
                lblError.Visible = true;

            }
        }
        else
        {
            lblError.Text = "دانش آموزی با این مشخصات یافت نشد";
            lblError.Visible = true;
        }
        //////////// //////////////////////// //////////////////////// //////////////////////// ////////////
    }
    private void FillGrid()
    {
        if (Request.Cookies["Type_Role"].Value.ToString() == "Parent")
        {
            int ID_Role = int.Parse(Request.Cookies["ID_Role"].Value.ToString());
            DataTable dt = new tbl_ParentInformationTableAdapter().GetDataByParentInformationCategoryStudentInformationPersonParent(ID_Role);
            string cat_path = dt.Rows[0]["Cat_Path"].ToString();
            //Label4.Text = dt.Rows[0]["Cat_Path"].ToString();
            //TextBox1.Text = dt.Rows[0]["Cat_Path"].ToString();
            int ID_Category = int.Parse(dt.Rows[0]["Category_ID"].ToString());
            // Label4.Text = dt.Rows[0]["SI_ID_Category"].ToString();
            GridView1.DataSource = new tbl_ContentTableAdapter().GetDataByPersonCategory(ID_Category, "Library", cat_path);
            GridView1.DataBind();
        }
        else
        {

            int ID_Role = int.Parse(Request.Cookies["ID_Role"].Value.ToString());
            DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudentInformationCategoryWhereID_Student(ID_Role);
            string cat_path = dt.Rows[0]["Cat_Path"].ToString();
            //Label4.Text = dt.Rows[0]["Cat_Path"].ToString();
            //TextBox1.Text = dt.Rows[0]["Cat_Path"].ToString();
            int ID_Category = int.Parse(dt.Rows[0]["SI_ID_Category"].ToString());
            // Label4.Text = dt.Rows[0]["SI_ID_Category"].ToString();
            GridView1.DataSource = new tbl_ContentTableAdapter().GetDataByPersonCategory(ID_Category, "Library", cat_path);
            GridView1.DataBind();
        }
    }
Ejemplo n.º 13
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        // Response.Redirect("~//index.aspx?Type=IndexAdmin");
        if (RadioButtonList1.SelectedValue == "Parent")
        {
            DataTable dt = new tbl_ParentInformationTableAdapter().GetByUserNameAndPassword(TextBox1.Text, new main_class().Encode(TextBox2.Text));
            if (dt.Rows.Count > 0)
            {
                //      Response.Cookies.Add(new HttpCookie("username", TextBox1.Text));
                //    Response.Cookies.Add(new HttpCookie("password", new main_class().Encode(TextBox2.Text)));
                Response.Cookies.Add(new HttpCookie("ID_Role", dt.Rows[0]["Parent_ID"].ToString()));
                Response.Cookies.Add(new HttpCookie("Type_Role", RadioButtonList1.SelectedValue));
                Response.Redirect("~//index.aspx?Type=IndexParent");
            }
            else
            {
                lblEror.Visible = true;
            }
        }
        else if (RadioButtonList1.SelectedValue == "Student")
        {
            DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByUserNameAndPassword(TextBox1.Text, new main_class().Encode(TextBox2.Text));
            if (dt.Rows.Count > 0)
            {
                //      Response.Cookies.Add(new HttpCookie("username", TextBox1.Text));
                //    Response.Cookies.Add(new HttpCookie("password", new main_class().Encode(TextBox2.Text)));
                Response.Cookies.Add(new HttpCookie("ID_Role", dt.Rows[0]["Student_ID"].ToString()));
                Response.Cookies.Add(new HttpCookie("Type_Role", RadioButtonList1.SelectedValue));
                Response.Redirect("~//index.aspx?Type=IndexStudent");
            }
            else
            {
                lblEror.Visible = true;
            }
        }
        else if (RadioButtonList1.SelectedValue == "Teacher")
        {
            DataTable dt = new tbl_TeacherInformationTableAdapter().GetDataByUserNameAndPassword(TextBox1.Text, new main_class().Encode(TextBox2.Text));
            if (dt.Rows.Count > 0)
            {
                //      Response.Cookies.Add(new HttpCookie("username", TextBox1.Text));
                //    Response.Cookies.Add(new HttpCookie("password", new main_class().Encode(TextBox2.Text)));
                Response.Cookies.Add(new HttpCookie("ID_Role", dt.Rows[0]["Teacher_ID"].ToString()));
                Response.Cookies.Add(new HttpCookie("Type_Role", RadioButtonList1.SelectedValue));
                Response.Redirect("~//index.aspx?Type=IndexTeacher");
            }
            else
            {
                lblEror.Visible = true;
            }
        }
        else if (RadioButtonList1.SelectedValue == "Admin")
        {
            DataTable dt = new tbl_AdminInformationTableAdapter().GetByUserNameAndPassword(TextBox1.Text, new main_class().Encode(TextBox2.Text));
            if (dt.Rows.Count > 0)
            {
                //      Response.Cookies.Add(new HttpCookie("username", TextBox1.Text));
                //    Response.Cookies.Add(new HttpCookie("password", new main_class().Encode(TextBox2.Text)));
                Response.Cookies.Add(new HttpCookie("ID_Role", dt.Rows[0]["Admin_ID"].ToString()));
                Response.Cookies.Add(new HttpCookie("Type_Role", RadioButtonList1.SelectedValue));
                Response.Redirect("~//index.aspx?Type=IndexAdmin");
            }
            else
            {
                lblEror.Visible = true;
            }
        }
        else
        {

        }
    }
    private void FillPath(string Type,string ID)
    {
        string title = "";
        string name = "";

        DataTable dt;
        if (Type == "Admin")
        {
            dt = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(ID));
            name = dt.Rows[0]["AI_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["AI_username"].ToString();
            }
            title = " مدیران";
        }
        else if (Type == "Teacher")
        {
            dt = new tbl_TeacherInformationTableAdapter().GetDataByID(int.Parse(ID));
            name = dt.Rows[0]["TI_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["TI_username"].ToString();
            }
            title = " معلم ها";
        }
        else if (Type == "Parent")
        {
            dt = new tbl_ParentInformationTableAdapter().GetDataByID(int.Parse(ID));
            name = dt.Rows[0]["PA_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["PA_username"].ToString();
            }

            title = " اولیاء";
        }
        else if (Type == "Student")
        {
            dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
            name = dt.Rows[0]["SI_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["SI_username"].ToString();
            }

            title = " دانش آموزان";
        }
        if (Request.QueryString["Kind"] == "Inbox")
        {
            lblPath.Text = lblPath.Text + "<a href='index.aspx?Type=PersonalMessageInbox'> پیام های دریافتی </a> >> " +
                title + " >> " +
                "<a href='./index.aspx?Type=" + Type + "Detail&" +
                "ID_" + Type + "=" + ID + "'>" +
                name + "</a>";
        }
        else if (Request.QueryString["Kind"] == "Outbox")
        {
            lblPath.Text = lblPath.Text + "<a href='index.aspx?Type=PersonalMessageOutbox'> پیام های فرستاده شده </a> >> "+
                title +  " >> " +
                "<a href='./index.aspx?Type=" + Type + "Detail&" +
                "ID_" + Type + "=" + ID + "'>" +
                name + "</a>";

        }
        if (Request.QueryString["Kind"] == "Inbox")
        {
            AuthorContent = "<a href='index.aspx?Type=PersonalMessageInsert&Type_Role_Getter=" + Type + "&ID_Role_Getter=" + ID + "'>پاسخ به " + name + "</a>";
        }
        else if (Request.QueryString["Kind"] == "Outbox")
        {
            AuthorContent = "<a href='index.aspx?Type=PersonalMessageInsert&Type_Role_Getter=" + Type + "&ID_Role_Getter=" + ID + "'>ارسالی دیگر به " + name + "</a>";
        }
    }
    private void Fill()
    {
        int ID = int.Parse(Request.QueryString["Student_ID"].ToString());
        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(ID);
        if (dt.Rows.Count > 0)
        {
            LblHidden.ToolTip = Request.QueryString["Student_ID"].ToString();
            TextName.Text = dt.Rows[0]["SI_Name"].ToString();
            TextFatherMobile.Text = dt.Rows[0]["SI_FatherMobile"].ToString();
            TextFatherName.Text = dt.Rows[0]["SI_FatherName"].ToString();
            TextFatherJob.Text = dt.Rows[0]["SI_FatherJob"].ToString();
            TextMotherMobile.Text = dt.Rows[0]["SI_MotherMobile"].ToString();
            TextMotherName.Text = dt.Rows[0]["SI_MotherName"].ToString();
            TextMotherJob.Text = dt.Rows[0]["SI_MotherJob"].ToString();
            TextAddress.Text = dt.Rows[0]["SI_Address"].ToString();
            TextTell.Text = dt.Rows[0]["SI_Tell"].ToString();
            TextPostalCode.Text = dt.Rows[0]["SI_PostalCode"].ToString();
            TextExportPlace.Text = dt.Rows[0]["SI_ExportPlace"].ToString();
            TextBirthDate.Text = dt.Rows[0]["SI_BirthDate"].ToString();
            TextAdminCode.Text = dt.Rows[0]["SI_StudentCode"].ToString();
            TextUserName.Text = dt.Rows[0]["SI_UserName"].ToString();
            HiddenField2.Value = dt.Rows[0]["SI_UserName"].ToString();
            HiddenField1.Value = new main_class().Decode(dt.Rows[0]["SI_Password"].ToString());
            Image1.Visible = true;
            Image1.ImageUrl = dt.Rows[0]["SI_Picture"].ToString();
            if (System.IO.File.Exists(Server.MapPath(Image1.ImageUrl)))
            {
                Image1.Visible = true;
            }
            else
            {
                Image1.Visible = true;
                Image1.ImageUrl = "~//Image_User//default_pic.png";
            }
        }
        FillDr(-1, DropDownList1);
        DataTable dt2 = new tbl_CategoryTableAdapter().GetDataByID(int.Parse(dt.Rows[0]["SI_ID_Category"].ToString()));
        if (dt2.Rows.Count > 0)
        {
            string delimitedInfo = dt2.Rows[0]["Cat_Path"].ToString();
            string[] discreteInfo = delimitedInfo.Split(new char[] { ',' });
            int i = 1;
            foreach (string Data in discreteInfo)
            {
                if (Data == "-1")
                {
                    FillDr(int.Parse(Data), (DropDownList)FindControl("DropDownList" + i.ToString()));
                }
                else
                {
                    ((DropDownList)(FindControl("DropDownList" + (i - 1).ToString()))).Items.FindByValue(Data).Selected = true;
                    FillDr(int.Parse(Data), (DropDownList)FindControl("DropDownList" + i.ToString()));
                }
                i++;
            }
            ((DropDownList)(FindControl("DropDownList" + (i - 1).ToString()))).Items.FindByValue(dt.Rows[0]["SI_ID_Category"].ToString()).Selected = true;

            if (i != 6)
            {
                FillDr(int.Parse(dt.Rows[0]["SI_ID_Category"].ToString()), (DropDownList)FindControl("DropDownList" + (i + 1).ToString()));
            }
        }
        Panel1.Visible = true;
        FillPath("Student", dt.Rows[0]["Student_ID"].ToString());
    }
    private void FillPath()
    {
        string title = "";
        string name = "";
        string Type = Request.QueryString["Type_Role_Getter"];
        string ID = Request.QueryString["ID_Role_Getter"];
        DataTable dt;
        if (Type == "Admin")
        {
            dt = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(ID));
            name = dt.Rows[0]["AI_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["AI_username"].ToString();
            }
            title = " مدیران";
        }
        else if (Type == "Teacher")
        {
            dt = new tbl_TeacherInformationTableAdapter().GetDataByID(int.Parse(ID));
            name = dt.Rows[0]["TI_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["TI_username"].ToString();
            }
            title = " معلم ها";
        }
        else if (Type == "Parent")
        {
            dt = new tbl_ParentInformationTableAdapter().GetDataByID(int.Parse(ID));
            name = dt.Rows[0]["PA_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["PA_username"].ToString();
            }

            title = " اولیاء";
        }
        else if (Type == "Student")
        {
            dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
            name = dt.Rows[0]["SI_name"].ToString();
            if (name.Trim().Length == 0)
            {
                name = dt.Rows[0]["SI_username"].ToString();
            }

            title = " دانش آموزان";
        }
        lblPath.Text = lblPath.Text+ "ارسال پیام برای >> " +
            title  + " >> " +
            "<a href='./index.aspx?Type=" + Type + "Detail&" +
            "ID_"+Type +"=" + ID + "'>" +
            name + "</a>";
    }
    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_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
        {
            string title = "";
            string name = "توسط : ";
            string Type = ((Label)(e.Row.FindControl("lblTypeSender"))).Text;
            string ID = ((Label)(e.Row.FindControl("lblIDSender"))).Text;
            DataTable dt;
            if (Type == "Admin")
            {
                dt = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(ID));
                name = dt.Rows[0]["AI_name"].ToString();
                if (name.Trim().Length == 0)
                {
                    name = dt.Rows[0]["AI_username"].ToString();
                }
                title = "مدیر";
            }
            else if (Type == "Teacher")
            {
                dt = new tbl_TeacherInformationTableAdapter().GetDataByID(int.Parse(ID));
                name = dt.Rows[0]["TI_name"].ToString();
                if (name.Trim().Length == 0)
                {
                    name = dt.Rows[0]["TI_username"].ToString();
                }
                title = "معلم";
            }
            else if (Type == "Parent")
            {
                dt = new tbl_ParentInformationTableAdapter().GetDataByID(int.Parse(ID));
                name = dt.Rows[0]["PA_name"].ToString();
                if (name.Trim().Length == 0)
                {
                    name = dt.Rows[0]["PA_username"].ToString();
                }

                title = "اولیاء";
            }
            else if (Type == "Student")
            {
                dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(ID));
                name = dt.Rows[0]["SI_name"].ToString();
                if (name.Trim().Length == 0)
                {
                    name = dt.Rows[0]["SI_username"].ToString();
                }
                title = "دانش آموز";
            }

            name = "توسط : " + name;

            ((Label)(e.Row.FindControl("lblName"))).Text = name + " ( " + title + " ) ";

            if (bool.Parse(((Label)(e.Row.FindControl("lblVision"))).Text))
            {
                e.Row.Attributes.Add("onMouseOver", "this.style.background='#eeff00'");
                e.Row.Attributes.Add("onMouseOut", "this.style.background='#EFF3FB'");
                e.Row.BackColor = System.Drawing.Color.FromName("#EFF3FB");
            }
            else
            {
                e.Row.BackColor = System.Drawing.Color.White;
                e.Row.Attributes.Add("onMouseOver", "this.style.background='#eeff00'");
                e.Row.Attributes.Add("onMouseOut", "this.style.background='White'");

            }

        }
    }