コード例 #1
0
    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 + " ) ";

            }
    }
コード例 #2
0
    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>";
    }
コード例 #3
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
        {
            int ID_Role = int.Parse(((Label)(e.Row.FindControl("ID_Role"))).Text);

            if (((Label)(e.Row.FindControl("Type_Role"))).Text == "Admin")
            {
                DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(ID_Role);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["AI_Name"].ToString().Length > 0)
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = dt.Rows[0]["AI_Name"].ToString();
                    }
                    else
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = dt.Rows[0]["AI_UserName"].ToString();
                    }
                    ((Label)(e.Row.FindControl("lblName"))).Text = "<a href='index.aspx?Type=AdminDetail&ID_Admin=" + ID_Role.ToString() +
                           "'>" + ((Label)(e.Row.FindControl("lblName"))).Text + " ( مدیر ) " + "</a>";
                }
            }
            else if (((Label)(e.Row.FindControl("Type_Role"))).Text == "Teacher")
            {
                DataTable dt = new tbl_TeacherInformationTableAdapter().GetDataByID(ID_Role);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["TI_Name"].ToString().Length > 0)
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = dt.Rows[0]["TI_Name"].ToString();
                    }
                    else
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = dt.Rows[0]["TI_UserName"].ToString();
                    }
                    ((Label)(e.Row.FindControl("lblName"))).Text = "<a href='index.aspx?Type=TeacherDetail&ID_Teacher=" + ID_Role.ToString() +
                          "'>" + ((Label)(e.Row.FindControl("lblName"))).Text + " ( معلم ) " + "</a>";
                }
            }
        }
    }
コード例 #4
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
        {
            int ID_Role = int.Parse(((Label)(e.Row.FindControl("ID_Role"))).Text.ToString());

            if (((Label)(e.Row.FindControl("Type_Role"))).Text == "Admin")
            {
                DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(ID_Role);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["AI_Name"].ToString().Length > 0)
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = "توسط : " + dt.Rows[0]["AI_Name"].ToString();
                    }
                    else
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = "توسط : " + dt.Rows[0]["AI_UserName"].ToString();

                    }
                }
            }
            else
            {
                DataTable dt = new tbl_TeacherInformationTableAdapter().GetDataByID(ID_Role);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["TI_Name"].ToString().Length > 0)
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = "توسط : " + dt.Rows[0]["TI_Name"].ToString();
                    }
                    else
                    {
                        ((Label)(e.Row.FindControl("lblName"))).Text = "توسط : " + dt.Rows[0]["TI_UserName"].ToString();
                    }
                }
            }
        }
    }
コード例 #5
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
        {
            int ID_Role = int.Parse(((Label)(e.Row.FindControl("ID_Role"))).Text.ToString());

            DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(ID_Role);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["AI_Name"].ToString().Length > 0)
                {
                    ((Label)(e.Row.FindControl("lblName"))).Text = "توسط : " + dt.Rows[0]["AI_Name"].ToString();
                }
                else
                {
                    ((Label)(e.Row.FindControl("lblName"))).Text = "توسط : " + dt.Rows[0]["AI_UserName"].ToString();
                }
            }
            int ID = int.Parse(((Label)(e.Row.FindControl("lblID"))).Text);
            DataTable dt2 = new tbl_GalleryPictureTableAdapter().GetDataBygp_ID_GallerySubject(ID);

            ((Label)(e.Row.FindControl("lblCount"))).Text = " ( " + dt2.Rows.Count.ToString() + " تصویر )";
        }
    }
コード例 #6
0
    private void Fill()
    {
        int GallerySubjet_ID = int.Parse(Request.QueryString["ID_GallerySubject"]);
        DataTable dt = new tbl_GallerySubjectTableAdapter().GetDataByGallerySubjet_ID(GallerySubjet_ID);
        TitleContent = dt.Rows[0]["gs_title"].ToString();
        DateContent = dt.Rows[0]["gs_Date"].ToString();
        BazdidContent = dt.Rows[0]["gs_Bazdid"].ToString();

        // موضوع

        Label2.Text = "موضوع : <b>گالری تصاویر</b>";

        // نویسنده مطلب
        DataTable dt2;
        string Con_ID_Role = "0";

        dt2 = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(dt.Rows[0]["gs_ID_Admin"].ToString()));
        AuthorContent = dt2.Rows[0]["AI_Name"].ToString();
        if (AuthorContent.Trim().Length == 0)
        {
            AuthorContent = dt2.Rows[0]["AI_UserName"].ToString();

        }
        Con_ID_Role = dt2.Rows[0]["Admin_ID"].ToString();

        AuthorContent = "<a href='./index.aspx?Type=AdminDetail&" +
                "ID_Admin=" + Con_ID_Role + "'>" +
                AuthorContent + "</a>";

        DataTable dt3 = new tbl_GalleryPictureTableAdapter().GetDataBygp_ID_GallerySubject(GallerySubjet_ID);
        DataList1.DataSource = dt3;
        DataList1.DataBind();

        // مسیر قرارگیری مطلب
        FillPath(dt.Rows[0]["gs_id_category"].ToString());
    }
コード例 #7
0
    void fill()
    {
        int ID =int.Parse( Request.Cookies["ID_Role"].Value.ToString());
        DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(ID);
        if (dt.Rows.Count > 0)
        {
            TextName.Text = dt.Rows[0]["AI_Name"].ToString();
            TextFatherName.Text = dt.Rows[0]["AI_FatherName"].ToString();
            TextAddress.Text = dt.Rows[0]["AI_Address"].ToString();
            TextTell.Text = dt.Rows[0]["AI_Tell"].ToString();
            TextPostalCode.Text = dt.Rows[0]["AI_PostalCode"].ToString();
            TextExportPlace.Text = dt.Rows[0]["AI_ExportPlace"].ToString();
            TextBirthDate.Text = dt.Rows[0]["AI_BirthDate"].ToString();
            TextAdminCode.Text = dt.Rows[0]["AI_AdminCode"].ToString();
            TextUserName.Text = dt.Rows[0]["AI_UserName"].ToString();
            HiddenField2.Value= dt.Rows[0]["AI_UserName"].ToString();
            HiddenField1.Value = new main_class().Decode(dt.Rows[0]["AI_Password"].ToString());
            TextRoll.Text = dt.Rows[0]["AI_Role_Admin"].ToString();
            Image1.ImageUrl = dt.Rows[0]["AI_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]["AI_Pic"].ToString();

        }
    }
コード例 #8
0
    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 = " معلم ";
        }

            AuthorContent = " <a href='./index.aspx?Type=" + Type + "Detail&" +
                "ID_" + Type + "=" + ID + "'>" + name + " ( "+ title+ " )</a>";
    }
コード例 #9
0
ファイル: Login.ascx.cs プロジェクト: bahmany/SchoolOrgSystem
    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
        {

        }
    }
コード例 #10
0
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        Cancel();
        int ID = int.Parse(((Label)(GridView1.Rows[e.NewEditIndex].FindControl("lblID"))).Text);
        DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(ID);
        if (dt.Rows.Count > 0)
        {
            TextName.Text = dt.Rows[0]["AI_Name"].ToString();
            TextFatherName.Text = dt.Rows[0]["AI_FatherName"].ToString();
            TextAddress.Text = dt.Rows[0]["AI_Address"].ToString();
            TextTell.Text = dt.Rows[0]["AI_Tell"].ToString();
            TextPostalCode.Text = dt.Rows[0]["AI_PostalCode"].ToString();
            TextExportPlace.Text = dt.Rows[0]["AI_ExportPlace"].ToString();
            TextBirthDate.Text = dt.Rows[0]["AI_BirthDate"].ToString();
            TextAdminCode.Text = dt.Rows[0]["AI_AdminCode"].ToString();
            TextUserName.Text = dt.Rows[0]["AI_UserName"].ToString();
            HiddenField2.Value = dt.Rows[0]["AI_UserName"].ToString();
            HiddenField1.Value = new main_class().Decode(dt.Rows[0]["AI_Password"].ToString());
            TextRoll.Text = dt.Rows[0]["AI_Role_Admin"].ToString();
            FileUpload1.ToolTip = dt.Rows[0]["AI_Pic"].ToString();

            Image1.Visible = true;

            Image1.ImageUrl = dt.Rows[0]["AI_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";
            }
        }
             LblHidden.ToolTip = ID.ToString();
            GridView1.SelectedIndex = e.NewEditIndex;
            Button3.Visible = true;
            Button1.Visible = false;
    }
コード例 #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Folder1 = "~\\Image_User\\Image_Admin\\";
        string File_Name1 = FileUpload1.FileName.ToString().Trim();
        string Address_Full1 = check_name_File(Folder1, File_Name1);

        DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(Request.Cookies["ID_Role"].Value));
        string ID_Admin_Path = dt.Rows[0]["AI_ID_Admin_Path"].ToString();

        string pass = "";

        if (TextPassword.Text.Trim().Length > 0)
        {
            pass = new main_class().Encode(TextPassword.Text);
        }
        else
        {
            pass = new main_class().Encode(HiddenField1.Value);
        }
        //////
        int err = 0;
        string pic="";
        if (LblHidden.ToolTip.Length == 0)
        {
            if (new tbl_AdminInformationTableAdapter().GetDataByUserName(TextUserName.Text).Rows.Count == 0)
            {

                if (FileUpload1.HasFile)
                {
                    if (FileUpload1.PostedFile.ContentLength < 5120000)
                    {
                        pic = Address_Full1;

                    }
                    else
                    {
                        err++;
                        Response.Write("<script>alert('حجم باید کمتر از 5000 کیلو بایت باشد')</script>");
                    }
                }
                else
                {
                     pic = "";
                }
                if (err == 0)
                {
                    new tbl_AdminInformationTableAdapter().Insert1(
                                TextName.Text,
                                TextFatherName.Text,
                                TextAddress.Text,
                                TextTell.Text,
                                TextPostalCode.Text,
                                TextExportPlace.Text,
                                TextBirthDate.Text,
                                TextAdminCode.Text, TextUserName.Text, pass, TextRoll.Text, pic, new main_class().GetDate(),
                                "", int.Parse(Request.Cookies["ID_Role"].Value),
                                ID_Admin_Path + "," + Request.Cookies["ID_Role"].Value);

                    /////////////////////////////////////////
                    if (FileUpload1.HasFile)
                    {
                        Save_File(FileUpload1, Address_Full1);
                    }
                    FillGrid();
                    Cancel();
                }
            }
            else
            {
                Label1.Text = "نام کاربری تکراری می باشد";
                Label1.Visible = true;
            }
        }
        else
        {
            string pic1 = "";
            if (new tbl_AdminInformationTableAdapter().GetDataByUserName(TextUserName.Text).Rows.Count == 0 || TextUserName.Text == HiddenField2.Value)
            {
                if (FileUpload1.HasFile)
                {
                    if (FileUpload1.PostedFile.ContentLength < 5120000)
                    {
                         pic1 = Address_Full1;

                    }
                    else
                    {
                        err++;
                        Response.Write("<script>alert('حجم باید کمتر از 5000 کیلو بایت باشد')</script>");
                    }
                }
                else
                {
                     pic1 = FileUpload1.ToolTip; ;
                }
                if (err == 0)
                {
                    int ID = int.Parse(LblHidden.ToolTip);
                    new tbl_AdminInformationTableAdapter().Update1(
                        TextName.Text,
                        TextFatherName.Text,
                        TextAddress.Text,
                        TextTell.Text,
                        TextPostalCode.Text,
                        TextExportPlace.Text,
                        TextBirthDate.Text,
                        TextAdminCode.Text, TextUserName.Text, pass, TextRoll.Text, pic1, ID);
                    /////////////////////////////////////////
                    if (FileUpload1.HasFile)
                    {
                        Save_File(FileUpload1, Address_Full1);
                        if (System.IO.File.Exists(Server.MapPath(FileUpload1.ToolTip)))
                        {
                            System.IO.File.Delete(Server.MapPath(FileUpload1.ToolTip));
                        }
                    }
                    FillGrid();
                    Cancel();
                }
            }
            else
            {
                Label1.Text = "نام کاربری تکراری می باشد";
                Label1.Visible = true;
            }
        }
    }
コード例 #12
0
    private void Fill()
    {
        int ID_Content = int.Parse(Request.QueryString["ID_Content"]);
        DataTable dt = new tbl_ContentTableAdapter().GetDataByContent_ID(ID_Content);
        TitleContent = dt.Rows[0]["con_title"].ToString();
        DateContent = dt.Rows[0]["Con_Date"].ToString();
        BazdidContent = dt.Rows[0]["Con_Bazdid"].ToString();
        Label1.Text = dt.Rows[0]["con_text"].ToString();

        // موضوع
        if (dt.Rows[0]["Con_Type"].ToString() == "News")
        {
            Label2.Text = "موضوع : <b>اخبار و اطلاعیه ها</b>";
        }
        else if (dt.Rows[0]["Con_Type"].ToString() == "Break")
        {
            Label2.Text = "موضوع : <b>زنگ تفریح</b>";
        }
        else if (dt.Rows[0]["Con_Type"].ToString() == "Library")
        {
            Label2.Text = "موضوع : <b>کتابخانه</b>";
        }

        // نویسنده مطلب
        DataTable dt2;
        string  Con_ID_Role = "0";
        if (dt.Rows[0]["Con_Type_Role"].ToString() == "Teacher")
        {
            dt2 = new tbl_TeacherInformationTableAdapter().GetDataByID(int.Parse(dt.Rows[0]["Con_ID_Role"].ToString()));
            AuthorContent = dt2.Rows[0]["TI_Name"].ToString();
            if (AuthorContent.Trim().Length == 0)
            {
                AuthorContent = dt2.Rows[0]["TI_UserName"].ToString();

            }
            Con_ID_Role = dt2.Rows[0]["Teacher_ID"].ToString();

        }
        else if (dt.Rows[0]["Con_Type_Role"].ToString() == "Admin")
        {
            dt2 = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(dt.Rows[0]["Con_ID_Role"].ToString()));
            AuthorContent = dt2.Rows[0]["AI_Name"].ToString();
            if (AuthorContent.Trim().Length == 0)
            {
                AuthorContent = dt2.Rows[0]["AI_UserName"].ToString();

            }
            Con_ID_Role = dt2.Rows[0]["Admin_ID"].ToString();
        }
        AuthorContent = "<a href='./index.aspx?Type=" + dt.Rows[0]["Con_Type_Role"].ToString() + "Detail&" +
                "ID_" + dt.Rows[0]["Con_Type_Role"].ToString() + "=" + Con_ID_Role + "'>" +
                AuthorContent + "</a>";

        // فایل پیوست
        if (System.IO.File.Exists(Server.MapPath(dt.Rows[0]["Con_Attach"].ToString())))
        {
            HyperLink1.NavigateUrl = dt.Rows[0]["Con_Attach"].ToString();
            System.IO.FileStream f = new System.IO.FileStream(Server.MapPath(dt.Rows[0]["Con_Attach"].ToString()), System.IO.FileMode.Open);
            double a = f.Length;
            double b = 1024;
            double size = a / b;
            Label3.Text = size.ToString();
            Label3.Text = Label3.Text.Substring(0, 6);
            f.Close();
        }
        else
        {
            HyperLink1.NavigateUrl = "";
            Panel1.Visible = false;
        }

        // مسیر قرارگیری مطلب
        FillPath(dt.Rows[0]["con_id_category"].ToString());
    }
コード例 #13
0
 private void FillPath(string ID)
 {
     DataTable dt = new tbl_AdminInformationTableAdapter().GetDataByID(int.Parse(Request.QueryString["ID_Admin"]));
     string name = dt.Rows[0]["AI_Name"].ToString();
     if (name.Trim().Length == 0)
     {
         name = dt.Rows[0]["AI_UserName"].ToString();
     }
     lblPath.Text = "<a href='./index.aspx?Type=AdminInformationManage'>" +
      "مدیریت مدیران" + "</a>" + " >> مدیریت دسترسی >> " +
      "<a href='./index.aspx?Type=AdminDetail&ID_Admin=" + ID + "'>" + name + "</a> >> ";
 }
コード例 #14
0
    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'");

            }

        }
    }
コード例 #15
0
    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>";
        }
    }