protected void imbSave_Click(object sender, ImageClickEventArgs e) { try { HTMLController objHtml = new HTMLController(); ArrayList arrColl = null; arrColl = IsContentValid(txtBody.Text.ToString()); string HTMLBodyText = arrColl[1].ToString().Trim(); if (ViewState["EditHtmlTextID"] != null) { objHtml.HtmlTextUpdate(hdnUserModuleID.Value, HTMLBodyText, ddlLanuage.SelectedValue.ToString(), chkAllowComment.Checked, chkPublish.Checked, true, DateTime.Now, GetPortalID, GetUsername); ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("HTML", "HTMLContentIsUpdatedSuccessfully"), "", SageMessageType.Success); } else { _newHTMLContentID = objHtml.HtmlTextAdd(hdnUserModuleID.Value, HTMLBodyText, ddlLanuage.SelectedValue.ToString(), chkAllowComment.Checked, true, chkPublish.Checked, DateTime.Now, GetPortalID, GetUsername); if (_newHTMLContentID != 0) { ShowMessage("", GetSageMessage("HTML", "HTMLContentIsAddedSuccessfully"), "", SageMessageType.Success); } } } catch (Exception ex) { ProcessException(ex); } }
protected void imbAdd_Click(object sender, ImageClickEventArgs e) { HTMLController objHtml = new HTMLController(); try { if (Session["EditCommentID"] != null) { objHtml.HtmlCommentUpdate(Session["EditCommentID"], txtComment.Text, chkApprove.Checked, chkApprove.Checked, true, DateTime.Now, GetPortalID, GetUsername); ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("HTML", "CommentIsUpdatedSuccessfully"), "", SageMessageType.Success); } else { objHtml.HtmlCommentAdd(hdfHTMLTextID.Value, txtComment.Text, chkApprove.Checked, chkIsActive.Checked, DateTime.Now, GetPortalID, GetUsername); if (chkApprove.Checked && chkIsActive.Checked) { ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("HTML", "CommentIsAddedSuccessfully"), "", SageMessageType.Success); } else { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("HTML", "CommentWillBeAddedAfterApproved"), "", SageMessageType.Alert); } } HideAll(); BindComment(); divViewWrapper.Visible = true; divViewComment.Visible = true; ClearComment(); } catch (Exception ex) { ProcessException(ex); } }
public async Task <IActionResult> FileDownload([FromBody] DownloadFile file) { if (file.File == null) { return(BadRequest("Bad Filename!!")); } if (!await this.VerifySession(_manager)) { return(Forbid()); } var test = await _query.GetTest(file.TestID); if (test == null) { return(NotFound("Failed to find Test ID!")); } var fileName = Path.GetFileName(file.File); var path = Path.Combine(Path.Join(_config.IncludeLocation, "" + file.TestID), fileName !); if (!System.IO.File.Exists(path)) { return(NotFound("File not found!")); } var stream = System.IO.File.OpenRead(path); return(new FileStreamResult(stream, HTMLController.GetMIME(fileName))); }
private void BindComment() { HTMLController objHtml = new HTMLController(); try { SQLHandler Sq = new SQLHandler(); if (IsSuperUser() && GetUsername != SystemSetting.SYSTEM_USER_NOTALLOW_HTMLCOMMENT[0]) { List <HTMLContentInfo> ml = objHtml.BindCommentForSuperUser(GetPortalID, hdfHTMLTextID.Value); if (ml != null) { gdvHTMLList.DataSource = ml; gdvHTMLList.DataBind(); if (gdvHTMLList.Rows.Count > 0) { //Setting comment Count Label lblCommentCount = gdvHTMLList.HeaderRow.FindControl("lblCommentCount") as Label; if (lblCommentCount != null) { lblCommentCount.Text = gdvHTMLList.Rows.Count.ToString(); } gdvHTMLList.Columns[gdvHTMLList.Columns.Count - 1].Visible = true; gdvHTMLList.Columns[gdvHTMLList.Columns.Count - 2].Visible = true; rowApprove.Visible = true; rowIsActive.Visible = true; } } } else { List <HTMLContentInfo> nl = objHtml.BindCommentForOthers(GetPortalID, hdfHTMLTextID.Value); if (nl != null) { gdvHTMLList.DataSource = nl; gdvHTMLList.DataBind(); if (gdvHTMLList.Rows.Count > 0) { //Setting comment Count Label lblCommentCount = gdvHTMLList.HeaderRow.FindControl("lblCommentCount") as Label; if (lblCommentCount != null) { lblCommentCount.Text = gdvHTMLList.Rows.Count.ToString(); } divViewComment.Style.Add("display", "block"); gdvHTMLList.Columns[gdvHTMLList.Columns.Count - 1].Visible = false; gdvHTMLList.Columns[gdvHTMLList.Columns.Count - 2].Visible = false; } rowApprove.Visible = false; rowIsActive.Visible = false; } } } catch (Exception ex) { ProcessException(ex); } }
private void Delete(int DeleteID) { try { HTMLController objHtml = new HTMLController(); objHtml.HTMLCommentDeleteByCommentID(DeleteID, GetPortalID, GetUsername); ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("HTML", "CommentIsDeletedSuccessfully"), "", SageMessageType.Success); BindComment(); } catch (Exception ex) { ProcessException(ex); } }
private void BindEditor() { try { HTMLController _html = new HTMLController(); HTMLContentInfo objHtmlInfo = _html.GetHTMLContent(GetPortalID, Int32.Parse(hdnUserModuleID.Value), ddlLanuage.SelectedValue.ToString());//GetCurrentCultureName if (objHtmlInfo != null) { txtBody.Text = objHtmlInfo.Content; chkPublish.Checked = bool.Parse(objHtmlInfo.IsActive.ToString()); chkAllowComment.Checked = bool.Parse(objHtmlInfo.IsAllowedToComment.ToString()); ViewState["EditHtmlTextID"] = objHtmlInfo.HtmlTextID; divEditWrapper.Visible = true; } } catch (Exception ex) { ProcessException(ex); } }
private void BindContent() { try { HTMLController _html = new HTMLController(); HTMLContentInfo contentInfo = _html.GetHTMLContent(GetPortalID, Int32.Parse(SageUserModuleID), GetCurrentCultureName); if (contentInfo != null) { ltrContent.Text = contentInfo.Content.ToString(); if (contentInfo.IsActive == true) { divViewWrapper.Visible = true; } } } catch (Exception ex) { ProcessException(ex); } }
private void Edit(int EditID) { HTMLController objHtml = new HTMLController(); try { HTMLContentInfo CommentInfo = objHtml.HtmlCommentGetByHTMLCommentID(GetPortalID, EditID); if (CommentInfo != null) { txtComment.Text = CommentInfo.Comment; chkApprove.Checked = (bool)CommentInfo.IsApproved; chkIsActive.Checked = (bool)CommentInfo.IsActive; Session["EditCommentID"] = EditID; HideAll(); divViewWrapper.Visible = true; divEditComment.Visible = true; } } catch (Exception ex) { ProcessException(ex); } }
private void BindContent() { try { HTMLController _html = new HTMLController(); HTMLContentInfo contentInfo = _html.GetHTMLContent(GetPortalID, Int32.Parse(hdnUserModuleID.Value), GetCurrentCultureName); if (contentInfo != null) { hdfHTMLTextID.Value = contentInfo.HtmlTextID.ToString(); ltrContent.Text = contentInfo.Content.ToString(); if (contentInfo.IsActive == true) { divViewWrapper.Visible = true; if (HTMLController.IsAuthenticatedToEdit(hdnUserModuleID.Value, GetUsername, GetPortalID) && GetUsername != SystemSetting.SYSTEM_USER_NOTALLOW_HTMLCOMMENT[0]) { divEditContent.Visible = true; } else { divEditContent.Visible = false; } if (IsAuthenticatedForComment() && contentInfo.IsAllowedToComment == true && GetUsername != SystemSetting.SYSTEM_USER_NOTALLOW_HTMLCOMMENT[0]) { divAddComment.Visible = true; divViewComment.Visible = true; if (!IsPostBack) { BindComment(); } } else { divAddComment.Visible = false; divViewComment.Visible = true; divEditComment.Visible = false; if (!IsPostBack) { BindComment(); } } } else { HideAll(); divAddComment.Visible = false; divViewComment.Visible = false; divEditComment.Visible = false; if (HTMLController.IsAuthenticatedToEdit(hdnUserModuleID.Value, GetUsername, GetPortalID) && GetUsername != SystemSetting.SYSTEM_USER_NOTALLOW_HTMLCOMMENT[0]) { divViewWrapper.Visible = true; divEditContent.Visible = true; } } } else if (contentInfo == null && Request.QueryString["ManageReturnUrl"] != null && GetUsername != SystemSetting.SYSTEM_USER_NOTALLOW_HTMLCOMMENT[0]) { HideAll(); divEditWrapper.Visible = true; divAddComment.Visible = false; divViewComment.Visible = false; BindEditor(); } else { if (HTMLController.IsAuthenticatedToEdit(hdnUserModuleID.Value, GetUsername, GetPortalID) && GetUsername != SystemSetting.SYSTEM_USER_NOTALLOW_HTMLCOMMENT[0]) { HideAll(); divViewWrapper.Visible = true; divEditContent.Visible = true; divAddComment.Visible = false; divViewComment.Visible = false; } else { HideAll(); divEditContent.Visible = false; divAddComment.Visible = false; divViewComment.Visible = false; } } } catch (Exception ex) { ProcessException(ex); } }