private void Fill() { int ID = int.Parse(Request.QueryString["Content_ID"].ToString()); DataTable dt = new tbl_ContentTableAdapter().GetDataByContent_ID(ID); if (dt.Rows.Count > 0) { LblHidden.ToolTip = Request.QueryString["Content_ID"].ToString(); TextTitle.Text = dt.Rows[0]["Con_Title"].ToString(); FCKeditor1.Value = dt.Rows[0]["Con_Text"].ToString(); FileUpload1.ToolTip = dt.Rows[0]["Con_Attach"].ToString(); CheckBox1.Checked = bool.Parse(dt.Rows[0]["Con_Active"].ToString()); DateContent = dt.Rows[0]["Con_date"].ToString(); Panel1.Visible = true; Panel2.Visible = true; FillPath(dt.Rows[0]["Con_Type_Role"].ToString(), dt.Rows[0]["Con_ID_Role"].ToString()); } FillDr(-1, DropDownList1); DataTable dt2 = new tbl_CategoryTableAdapter().GetDataByID(int.Parse(dt.Rows[0]["Con_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]["Con_ID_Category"].ToString()).Selected = true; } }
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()); }