private void listParentQuestionByID(int parentID, string RolesName_) { ListQuestionBSO listQuestionBSO = new ListQuestionBSO(); DataTable dt = new DataTable(); dt = listQuestionBSO.listParentQuestionByID(parentID); DataView view1 = new DataView(dt); string strCate = GetCateParentIDArrayByID(); if (RolesName_ == "Guest") { view1.RowFilter = "CreateUserName ='******'"; grvListQuestion.Columns[6].Visible = false; //Hide column publish grvListQuestion.Columns[7].Visible = false; //Hide column Action iconForUser(); //Hide icon for Guest //------------------Neu la khach && chu de bi khoa => hide textRadHtml va btn if (view1[0]["QuestionStatus"].ToString() == "3") { txtRadShort.Visible = false; btnSend.Visible = false; btnCancel.Visible = false; image_Attach.Visible = false; file_Attach.Visible = false; Label11.Visible = false; Label6.Visible = false; Label4.Visible = false; } } else if (!string.IsNullOrEmpty(strCate)) { string restr = strCate.Remove(strCate.LastIndexOf(",")).Replace(",", "','"); //view1.RowFilter = "CateNewsID in('" + restr + "')"; view1.RowFilter = "CateNewsID in('" + restr + "') or CreateUserName ='******'"; } //else //{ // if (RolesName_ == "Guest") // { // view1.RowFilter = "CreateUserName ='******'"; // grvListQuestion.Columns[6].Visible = false; //Hide column Action // iconForUser(); //Hide icon for Guest // //------------------Neu la khach && chu de bi khoa => hide textRadHtml va btn // if (view1[0]["QuestionStatus"].ToString() == "3") // { // txtRadShort.Visible = false; // btnSend.Visible = false; // btnCancel.Visible = false; // image_Attach.Visible = false; // file_Attach.Visible = false; // Label11.Visible = false; // Label6.Visible = false; // Label4.Visible = false; // } // } //} grvListQuestion.DataSource = view1; grvListQuestion.DataBind(); //-----------------------Luu thong tin ve cau hoi HiddenField_CreateDate.Value = view1[0]["CreateDate"].ToString(); HiddenField_CreateUserName.Value = view1[0]["CreateUserName"].ToString(); HiddenField_QuestionStatus.Value = view1[0]["QuestionStatus"].ToString(); HiddenField_CateNewsID.Value = view1[0]["CateNewsID"].ToString(); HiddenField_Question_Title.Value = view1[0]["Question_Title"].ToString(); HiddenField_QuestionID.Value = view1[0]["Question_ID"].ToString(); }
private void bindingContentQuestion(int parentID, string RolesName_) { ListQuestionBSO listQuestionBSO = new ListQuestionBSO(); DataTable dt = new DataTable(); dt = listQuestionBSO.listParentQuestionByID(parentID); DataView view1 = new DataView(dt); string strCate = GetCateParentIDArrayByID(); ////-------------------Lay nhom Role AdminBSO adminBSO = new AdminBSO(); if (RolesName_ == "Guest") { view1.RowFilter = "CreateUserName ='******'"; } else if (!string.IsNullOrEmpty(strCate)) { string restr = strCate.Remove(strCate.LastIndexOf(",")).Replace(",", "','"); //view1.RowFilter = "CateNewsID in('" + restr + "')"; view1.RowFilter = "CateNewsID in('" + restr + "') or CreateUserName ='******'"; } ETO.Admin userPostQuestion = new ETO.Admin(); if (adminBSO.CheckExist(view1[0]["CreateUserName"].ToString())) { userPostQuestion = adminBSO.GetAdminById(view1[0]["CreateUserName"].ToString()); lbContentQuestion.Text = view1[0]["Question_Content"].ToString(); lbDatePostQuestion.Text = " gửi ngày: " + view1[0]["CreateDate"].ToString(); lbQuestionTitle.Text = "Tiêu đề: <b>" + view1[0]["Question_Title"].ToString() + "</b>"; lbUserPost.Text = "Người gửi: <b>" + userPostQuestion.AdminFullName.ToString() + "</b>, "; if (!string.IsNullOrEmpty(view1[0]["Question_Image"].ToString())) { string strImgName = view1[0]["Question_Image"].ToString(); Literal_images.Text = "<span style='display: block;'>Hình đính kèm:</span>"; Literal_images.Text = "<a href='" + ResolveUrl("~/") + "Upload/Question/Images/" + strImgName + "' rel='lightbox' ><img src='" + ResolveUrl("~/") + "Upload/Question/Images/" + strImgName + "' class='image_album' width='120' align='left' hspace='1' /></a>"; } if (!string.IsNullOrEmpty(view1[0]["Question_fileAttach"].ToString())) { string strFileAttch = view1[0]["Question_fileAttach"].ToString(); Literal_file.Text = "<span style='display: block;'>Tệp tin đính kèm:</span>"; Literal_file.Text += "<a href='" + ResolveUrl("~/") + "Upload/Question/Files/" + strFileAttch + "' ><img src='" + ResolveUrl("~/") + "Images/icon_file.png' class='icon' width='30' hspace='1' /> Tải tệp tin đính kèm </a>"; } } else { lbContentQuestion.Text = ""; lbDatePostQuestion.Text = ""; lbQuestionTitle.Text = ""; lbUserPost.Text = "Người gửi câu hỏi không tồn tại!"; } }