Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Tab Pages
        //if (!NewMode)
        //     ShowDetails();
        //else
        //{
        //     RadMultiPage1.SelectedIndex = 0;
        //     tsComments.Tabs[0].Selected = true;
        //}
        #endregion
        BOLClass        = new BOLComments();
        lblSysName.Text = BOLClass.PageLable;

        if ((Code == null) && (!NewMode))
        {
            return;
        }
        if (!Page.IsPostBack)
        {
            //if (!NewMode) ShowDetails();


            #region Fill Combo
            cboHCCommentStatusCode.DataSource = new BOLHardCode().GetHCDataTable("HCCommentStatuses");
            cboHCSectionCode.DataSource       = new BOLHardCode().GetHCDataTable("HCSections");

            #endregion
            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                txtComment.Attributes.Add("onblur", "this.className='CommentText';if(this.value == '') this.value = '" + "پیام" + "';");
                txtName.Attributes.Add("onblur", "this.className='CommentText';if(this.value == '') this.value = '" + "نام" + "';");
                txtEmail.Attributes.Add("onblur", "this.className='CommentText';if(this.value == '') this.value = '" + "نام خانوادگی" + "';");
            }

            BOLComments CommentsBOL = new BOLComments();

            rptComments.DataSource = CommentsBOL.GetCommentsByStatusCode(_itemCode, 2);
            rptComments.DataBind();

            if (rptComments.Items.Count == 0)
            {
                rptComments.Visible = false;
                PublishInfo.Visible = false;
            }

            int PublishedCount          = CommentsBOL.GetCommentByStatusCodeCount(_itemCode, 2);
            int WillNotBePublishedCount = CommentsBOL.GetCommentByStatusCodeCount(_itemCode, 3);

            lblPublishedCount.Text          = "منتشر شده" + ": " + Tools.ChangeEnc(PublishedCount.ToString());
            lblWillNotBePublishedCount.Text = "منتشر نشده" + ": " + Tools.ChangeEnc(WillNotBePublishedCount.ToString());
        }
Ejemplo n.º 3
0
        private void SendComment()
        {
            string strNewsCode = Request.Form["NewsCode"];
            string Name        = Request.Form["Name"];
            string Email       = Request.Form["Email"];
            string Comment     = Request.Form["Comment"];

            int HCSectionCode = 1;
            int ItemCode;

            Int32.TryParse(strNewsCode, out ItemCode);

            BOLComments CommentsBOL = new BOLComments();
            bool        Result      = CommentsBOL.SaveComment(HCSectionCode, ItemCode, Name, Email, Comment);

            op_result _op_result = new op_result();

            if (Result)
            {
                _op_result.result = "نظر با موفقیت ثبت شد";
                //msgBox.Text = "نظر شما با موفقیت دریافت شد";
            }
            else
            {
                _op_result.result = "متاسفانه خطایی در ثبت نظر رخ داده است";
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize((object)_op_result);

            Response.Write(json);
            Response.End();
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //HtmlGenericControl script = new HtmlGenericControl("script");
            //script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/Scripts/farsi.js"));
            //script.Attributes.Add("type", "text/javascript");
            //Page.Header.Controls.Add(script);

            if (!Page.IsPostBack)
            {
                int    Code    = 0;
                string strCode = Request["Code"];
                Int32.TryParse(strCode, out Code);
                BOLNews NewsBOL = new BOLNews();
                News    CurNews = ((IBaseBOL <News>)NewsBOL).GetDetails(Code);
                if (CurNews != null)
                {
                    NewsCode          = Code.ToString();
                    ViewState["Code"] = CurNews.Code;

                    lblSuTitr.Text = CurNews.SoTitr;
                    Page.Title     = lblTitle.Text = CurNews.Title;

                    DateTimeMethods dtm           = new DateTimeMethods();
                    string          strDateTime   = "";
                    string          strCurrentMin = CurNews.NewsDate.Minute.ToString();


                    strDateTime += Tools.ChageEnc(dtm.GetPersianLongDate(CurNews.NewsDate));
                    strDateTime += " ساعت: " + Tools.ChageEnc(CurNews.NewsDate.Hour + ":" + strCurrentMin);

                    lblDate.Text = strDateTime;

                    lblNewsCode.Text = " کد : " + Tools.ChageEnc(CurNews.Code.ToString());

                    if (!string.IsNullOrEmpty(CurNews.PicFile1))
                    {
                        hplImage.ImageUrl    = CurNews.PicFile1;
                        hplImage.NavigateUrl = CurNews.PicFile1;
                    }
                    else
                    {
                        hplImage.ImageUrl = "~/images/Nopic.gif";
                    }

                    string Abstract = CurNews.Abstract;
                    Abstract = Abstract.Replace("style=", "style1=");
                    Abstract = Abstract.Replace("<br />", "</p><p>");
                    //NewBody = NewBody.Replace("<div", "<p");


                    ltrNewsBody.Text = Tools.FormatText(Abstract);
                    BOLComments CommentsBOL  = new BOLComments();
                    int         CommentCount = CommentsBOL.GetCommentCount(CurNews.Code);

                    lblAbstract.Text = Tools.FormatText(CurNews.Abstract);
                }
            }
        }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Tab Pages
        //if (!NewMode)
        //     ShowDetails();
        //else
        //{
        //     RadMultiPage1.SelectedIndex = 0;
        //     tsComments.Tabs[0].Selected = true;
        //}
        #endregion
        BOLClass        = new BOLComments();
        lblSysName.Text = BOLClass.PageLable;

        if ((Code == null) && (!NewMode))
        {
            return;
        }
        if (!Page.IsPostBack)
        {
            //if (!NewMode) ShowDetails();


            #region Fill Combo
            cboHCCommentStatusCode.DataSource = new BOLHardCode().GetHCDataTable("HCCommentStatuses");
            cboHCSectionCode.DataSource       = new BOLHardCode().GetHCDataTable("HCSections");
            cboHCLanguageCode.DataSource      = new BOLHardCode().GetHCDataTable("HCLanguages");

            #endregion
            if (!NewMode)
            {
                LoadData((int)Code);
                BOLComments CommentsBOL   = new BOLComments();
                Comments    CurComment    = CommentsBOL.GetData((int)Code);
                int         HCSectionCode = CurComment.HCSectionCode;
                if (HCSectionCode == 1)//News
                {
                    BOLNews NewsBOL = new BOLNews();
                    News    CurNews = NewsBOL.GetData((int)CurComment.ItemCode);
                    if (CurNews != null)
                    {
                        hplItem.Text        = CurNews.Title;
                        hplItem.NavigateUrl = "~/Admin/News/EditNews.aspx?Code=" + CurComment.ItemCode;
                    }
                }
            }
        }
    }
Ejemplo n.º 6
0
        private void GetNewsComments()
        {
            string strNewsCode = Request.Form["NewsCode"];
            int    NewsCode;

            Int32.TryParse(strNewsCode, out NewsCode);
            if (NewsCode == 0)
            {
                return;
            }

            BOLComments CommentsBOL = new BOLComments();
            var         Result      = CommentsBOL.GetCommentsByStatusCode(NewsCode, 2);

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize((object)Result);

            Response.Write(json);
            Response.End();
        }
Ejemplo n.º 7
0
        protected void btnSendComment_Click(object sender, EventArgs e)
        {
            if (!RadCaptcha1.IsValid)
            {
                msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error;
                msgBox.Text            = "کد امنیتی اشتباه است";
                return;
            }

            msgBox.Text = "";
            string Name    = txtName.Text.Trim();
            string Email   = txtEmail.Text.Trim();
            string Comment = txtComment.Text.Trim();

            if (Comment == "")
            {
                msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error;
                msgBox.Text            = "لطفا پیام را وارد کنید";
                return;
            }

            if (ViewState["ItemCode"] != null && ViewState["HCSectionCode"] != null)
            {
                int         HCSectionCode = Convert.ToInt32(ViewState["HCSectionCode"]);
                int         ItemCode      = Convert.ToInt32(ViewState["ItemCode"]);
                BOLComments CommentsBOL   = new BOLComments();
                bool        Result        = CommentsBOL.SaveComment(HCSectionCode, ItemCode, Name, Email, Comment);
                if (Result)
                {
                    msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.OK;
                    msgBox.Text            = "نظر شما با موفقیت دریافت شد";
                    btnSendComment.Visible = false;
                }
                else
                {
                    msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error;
                    msgBox.Text            = "متاسفانه خطایی در ثبت نظر رخ داده است";
                }
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlGenericControl script = new HtmlGenericControl("script");

            script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/Scripts/farsi.js"));
            script.Attributes.Add("type", "text/javascript");
            Page.Header.Controls.Add(script);

            if (!Page.IsPostBack)
            {
                int    Code    = 0;
                string strCode = Request["Code"];
                Int32.TryParse(strCode, out Code);
                BOLNews NewsBOL = new BOLNews();
                News    CurNews = ((IBaseBOL <News>)NewsBOL).GetDetails(Code);
                if (CurNews != null)
                {
                    NewsCode          = Code.ToString();
                    ViewState["Code"] = CurNews.Code;
                    //hplExportTpPDF.NavigateUrl = "~/Export.aspx?Type=PDF&Code=" + CurNews.Code;
                    Page.Title = lblTitle.Text = CurNews.Title;

                    string strCurrentMin = CurNews.NewsDate.Minute.ToString();
                    if (strCurrentMin.Length == 1)
                    {
                        strCurrentMin = "0" + strCurrentMin;
                    }

                    DateTimeMethods dtm         = new DateTimeMethods();
                    string          strDateTime = "";

                    strDateTime += Tools.ChageEnc(dtm.GetPersianLongDate(CurNews.NewsDate));
                    strDateTime += " ساعت: " + Tools.ChageEnc(CurNews.NewsDate.Hour + ":" + strCurrentMin);

                    lblDate.Text = strDateTime;


                    if (!string.IsNullOrEmpty(CurNews.PicFile1))
                    {
                        hplImage.ImageUrl = CurNews.PicFile2;
                    }
                    else
                    {
                        hplImage.ImageUrl = "~/images/Nopic.gif";
                    }

                    string Abstract = CurNews.Abstract;
                    Abstract = Abstract.Replace("<br />", "</p><p>");
                    Abstract = Abstract.Replace("font-family", "font-family1");
                    Abstract = Abstract.Replace("font-size", "font-size1");
                    Abstract = Abstract.Replace("line-height", "line-height1");

                    ltrNewsBody.Text = Tools.FormatText(Abstract);
                    BOLComments CommentsBOL  = new BOLComments();
                    int         CommentCount = CommentsBOL.GetCommentCount(CurNews.Code);

                    //if (!string.IsNullOrEmpty(CurNews.SourceLink))
                    //{
                    //    hplSourceLink.Text = CurNews.SourceLink;
                    //    hplSourceLink.NavigateUrl = CurNews.SourceLink;
                    //}

                    UCComments1.ItemCode = CurNews.Code;
                    BOLNewsKeywords NewsKeywordsBOL = new BOLNewsKeywords(1);
                    rptNewsKeywords.DataSource = NewsKeywordsBOL.GetKeywords(CurNews.Code);
                    rptNewsKeywords.DataBind();

                    if (CurNews.ShowPic != null)
                    {
                        pnlNewsPic.Visible = (bool)CurNews.ShowPic;
                    }
                }
            }
        }