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 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 Edit(int EditID)
 {
     HTMLController objHtml = new HTMLController();
     try
     {
         SQLHandler sq = new SQLHandler();
         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);
     }
 }
        protected void imbAdd_Click(object sender, ImageClickEventArgs e)
        {
            HTMLController objHtml = new HTMLController();
            try
            {
                SQLHandler sq = new SQLHandler();
                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);
            }
        }
 protected void imbSave_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         HTMLController objHtml = new HTMLController();
         ArrayList arrColl = null;
         arrColl = IsContentValid(txtBody.Text.ToString());
         SQLHandler sq = new SQLHandler();
         string HTMLBodyText = arrColl[1].ToString().Trim();
         if (ViewState["EditHtmlTextID"] != null)
         {
             objHtml.HtmlTextUpdate(hdnUserModuleID.Value, HTMLBodyText, GetCurrentCultureName, chkAllowComment.Checked, chkPublish.Checked, true, DateTime.Now, GetPortalID, GetUsername);
             ViewState["EditHtmlTextID"] = null;
             ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("HTML", "HTMLContentIsUpdatedSuccessfully"), "", SageMessageType.Success);
         }
         else
         {
             objHtml.HtmlTextAdd(hdnUserModuleID.Value, HTMLBodyText, GetCurrentCultureName, chkAllowComment.Checked, true, chkPublish.Checked, DateTime.Now, GetPortalID, GetUsername);
             if (_newHTMLContentID != 0)
             {
                 ShowMessage("", GetSageMessage("HTML", "HTMLContentIsAddedSuccessfully"), "", 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), 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 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 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);
            }
        }