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();
    }
    private void Fill()
    {
        int ID = int.Parse(Request.QueryString["ID_Parent"]);
        DataTable dt = new tbl_ParentInformationTableAdapter().GetDataByID(ID);
        if (dt.Rows.Count > 0)
        {
            TextName = dt.Rows[0]["PA_Name"].ToString();
            TextAddress = dt.Rows[0]["PA_Address"].ToString();
            TextTell = dt.Rows[0]["PA_Tell"].ToString();
            TextUserName = dt.Rows[0]["PA_UserName"].ToString();
            TextEndTime = dt.Rows[0]["PA_End_Time"].ToString();
            TextStartTime = dt.Rows[0]["PA_Start_Time"].ToString();
            TextMobile = dt.Rows[0]["PA_Mobile"].ToString();
            TextJob = dt.Rows[0]["PA_Job"].ToString();

            Image1.ImageUrl = dt.Rows[0]["PA_Pic"].ToString();
            if (System.IO.File.Exists(Server.MapPath(Image1.ImageUrl)))
            {
            }
            else
            {
                Image1.ImageUrl = "~//Image_User//default_pic.png";
            }
            FillPath("Parent", dt.Rows[0]["Parent_ID"].ToString());
            FillChild("Student",dt.Rows[0]["PA_ID_Student"].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 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>";
    }
    private void FillGrid()
    {
        int ID = int.Parse(Request.Cookies["ID_Role"].Value.ToString());
        DataTable dt2 = new tbl_ParentInformationTableAdapter().GetDataByID(ID);

        DataTable dt = new tbl_StudentInformationTableAdapter().GetDataByStudent_ID(int.Parse(dt2.Rows[0]["PA_ID_Student"].ToString()));
        int ID_Category = int.Parse(dt.Rows[0]["SI_ID_Category"].ToString());

        GridView1.SelectedIndex = -1;
        GridView1.DataSource = new tbl_LessonTableAdapter().GetDataByCategory_ID( ID_Category);
        GridView1.DataBind();
        FillPath(ID_Category.ToString());
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int ID = int.Parse(((Label)(GridView1.Rows[e.RowIndex].FindControl("lblID"))).Text);

        new tbl_PersonalMessageTableAdapter().DeleteUserMessage("Student", ID);

        new tbl_ScoreTableAdapter().DeleteStudent(ID);

        DataTable dt10 = new tbl_ParentInformationTableAdapter().GetDataByPA_ID_Student(ID);
        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(ID);

        new tbl_StudentInformationTableAdapter().Delete(ID);
        FillGrid();
    }
    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_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 = " اولیاء";
        lblPath.Text = lblPath.Text +
            title  + " >> " +
            "<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>";
    }
    void fill()
    {
        int ID = int.Parse(Request.Cookies["ID_Role"].Value.ToString());
        DataTable dt = new tbl_ParentInformationTableAdapter().GetDataByID(ID);
        if (dt.Rows.Count > 0)
        {
            TextName.Text = dt.Rows[0]["PA_Name"].ToString();
            TextMobile.Text = dt.Rows[0]["PA_Mobile"].ToString();
            TextJob.Text = dt.Rows[0]["PA_Job"].ToString();
            TextAddress.Text = dt.Rows[0]["PA_Address"].ToString();
            TextTell.Text = dt.Rows[0]["PA_Tell"].ToString();
            TextUserName.Text = dt.Rows[0]["PA_UserName"].ToString();
            HiddenField2.Value = dt.Rows[0]["PA_UserName"].ToString();

            HiddenField1.Value = new main_class().Decode(dt.Rows[0]["PA_Password"].ToString());
            Image1.ImageUrl = dt.Rows[0]["PA_Pic"].ToString();
            if (System.IO.File.Exists(Server.MapPath(Image1.ImageUrl)))
            {
                Image1.Visible = true;
            }
            else
            {
                Image1.Visible = true;
                Image1.ImageUrl = "~//Image_User//default_pic.png";
            }
            FileUpload1.ToolTip = dt.Rows[0]["PA_Pic"].ToString();
        }
    }
Beispiel #10
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 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();
        }
    }
    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();
    }
    private void FillPath(string Type, string ID)
    {
        string title = "";
        string name = "";

        DataTable 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 = "مدیریت اولیاء";
        lblPath.Text = lblPath.Text + "<a href='./index.aspx?Type=ParentInformationManage'>" +
            title + "</a>" + " >> " +
            "<a href='./index.aspx?Type=AdminParentEdit&Parent_ID=" + ID + "'>" +
            name + "</a>";
    }
    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'");

            }

        }
    }
    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>";
        }
    }
    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;
        }
        //////////// //////////////////////// //////////////////////// //////////////////////// ////////////
    }