Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int     KeywordCode = Convert.ToInt32(Request["Code"]);
            BOLNews NewsBOL     = new BOLNews();

            BOLKeywords KeywordsBOL = new BOLKeywords();
            Keywords    CurKeyword  = ((IBaseBOL <Keywords>)KeywordsBOL).GetDetails(KeywordCode);
            if (CurKeyword != null)
            {
                Response.Redirect("~/NK" + CurKeyword.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurKeyword.Name) + ".html", false);
                return;

                NewsList1.ShowNewsByKeywordCode(KeywordCode);

                lblTitle.Text = " خبرهای " + CurKeyword.Name;
                Page.Title    = "خبرهای " + CurKeyword.Name;
                HtmlMeta metadesc = (HtmlMeta)Page.Master.FindControl("description");
                metadesc.Attributes["content"] = CurKeyword.Name;
            }
            else
            {
                Response.Redirect("~/", false);
            }
        }
        catch (Exception err)
        {
            BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
            ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "NewsByKeywordCode::Load");
            Response.Redirect("~/", false);
        }
    }
Пример #2
0
    protected void DoSave(object sender, ImageClickEventArgs e)
    {
        if (!ValidateInputs())
        {
            return;
        }

        BOLKeywords CurObj = new BOLKeywords();

        if (!NewMode)
        {
            CurObj.Code = Convert.ToInt32(Code);
        }
        else
        {
            BOLKeywords KeywordsBOL = new BOLKeywords();
            Keywords    Key         = KeywordsBOL.GetDataByKeyword(txtName.Text);
            if (Key != null)
            {
                msgBox.Text = "این کلید واژه قبلا وارد شده است";
                return;
            }
        }
        CurObj.Name        = txtName.Text;
        CurObj.EngName     = txtEngName.Text;
        CurObj.Description = txtDescription.Text;

        CurObj.SaveChanges(NewMode);

        GoToList(null, null);
    }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strPageNo = Request["PageNo"];
            try
            {
                PageNo = Convert.ToInt32(strPageNo);
                if (PageNo == 0)
                {
                    PageNo = 1;
                }

                Page.Title = ltrHeader.Text = "فهرست تمام کلیده واژه ها صفحه  " + Tools.ChangeEnc(PageNo);

                BOLKeywords KeywordsBOL = new BOLKeywords();
                rptKeywords.DataSource = KeywordsBOL.GetKeywords(_pageSize, PageNo);
                rptKeywords.DataBind();

                int ResultCount = KeywordsBOL.GetKeywordCount();
                int PageCount   = (int)ResultCount / _pageSize;
                if (ResultCount % _pageSize > 0)
                {
                    PageCount++;
                }

                pgrToolbar.PageNo    = PageNo;
                pgrToolbar.PageCount = PageCount;
                pgrToolbar.ConcatUrl = ConcatUrl;
                pgrToolbar.PageBind();
            }
            catch
            {
            }
        }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strStartIndex = Request["s"];
        int    StartIndex;

        Int32.TryParse(strStartIndex, out StartIndex);
        if (StartIndex == 0)
        {
            StartIndex = 1;
        }
        BOLKeywords KeywordsBOL = new BOLKeywords();

        rptKeywords.DataSource = KeywordsBOL.GetList(StartIndex, 25000);
        rptKeywords.DataBind();
    }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string  Keyword = Request["Keyword"];
                BOLNews NewsBOL = new BOLNews();

                Keyword = Keyword.Replace("_", " ");
                BOLKeywords KeywordsBOL = new BOLKeywords();
                Keywords    CurKeyword  = KeywordsBOL.GetDataByKeyword(Keyword);
                if (CurKeyword != null)
                {
                    lblTitle.Text = "خبرهای مرتبط با " + CurKeyword.Name;
                    Page.Title    = "خبرهای مرتبط با " + CurKeyword.Name + " - خبردان";

                    Tools.SetLink("lnkCanonical", "https://www.khabardaan.ir/" + "/K/" + Tools.ReplaceSpaceWithUnderline(CurKeyword.Name) + ".html");

                    Tools.SetMeta("keywords", CurKeyword.Name);
                    Tools.SetMeta("description", CurKeyword.Name);
                    Tools.SetMeta("twittercard", CurKeyword.Name);
                    Tools.SetMeta("twittertitle", CurKeyword.Name);
                    Tools.SetMeta("twitterdescription", CurKeyword.Name);
                    Tools.SetMeta("ogtitle", CurKeyword.Name);
                    Tools.SetMeta("ogurl", "https://www.khabardaan.ir/" + "/K/" + Tools.ReplaceSpaceWithUnderline(CurKeyword.Name) + ".html");
                    Tools.SetMeta("twitterimagesrc", "");
                    Tools.SetMeta("ogimage", "");
                    Tools.SetMeta("ogdescription", CurKeyword.Name);


                    NewsList1.ShowNewsByKeywordCode(CurKeyword.Code);

                    dtlOtherKeywords.DataSource = KeywordsBOL.GetKeywordsStartsWith(CurKeyword.Name);
                    dtlOtherKeywords.DataBind();
                }
                else
                {
                    Response.Write("این کلمه از فهرست حذف شده است.");
                }
            }
            catch (Exception err)
            {
                Response.Write("این کلمه از فهرست حذف شده است.");
                //string MailBody = "Page: " + Request.FilePath + " Exception: " + err.Message;
                //Tools tools = new Tools();
                //bool SendResult = tools.SendEmail(MailBody, "پارست ::Error ", "*****@*****.**", "", "", "");
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int     KeywordCode = Convert.ToInt32(Request["Code"]);
                BOLNews NewsBOL     = new BOLNews();

                BOLKeywords KeywordsBOL = new BOLKeywords();
                Keywords    CurKeyword  = ((IBaseBOL <Keywords>)KeywordsBOL).GetDetails(KeywordCode);
                if (CurKeyword != null)
                {
                    lblTitle.Text = CurKeyword.Name;
                    Page.Title    = CurKeyword.Name + " - خبردان";

                    Tools.SetLink("lnkCanonical", "https://www.khabardaan.ir/" + "/K/" + Tools.ReplaceSpaceWithUnderline(CurKeyword.Name) + ".html");

                    Tools.SetMeta("keywords", CurKeyword.Name);
                    Tools.SetMeta("description", CurKeyword.Name);
                    Tools.SetMeta("twittercard", CurKeyword.Name);
                    Tools.SetMeta("twittertitle", CurKeyword.Name);
                    Tools.SetMeta("twitterdescription", CurKeyword.Name);
                    Tools.SetMeta("ogtitle", CurKeyword.Name);
                    Tools.SetMeta("ogurl", "https://www.khabardaan.ir/" + "/K/" + Tools.ReplaceSpaceWithUnderline(CurKeyword.Name) + ".html");
                    Tools.SetMeta("twitterimagesrc", "");
                    Tools.SetMeta("ogimage", "");
                    Tools.SetMeta("ogdescription", CurKeyword.Name);


                    NewsList1.ShowNewsByKeywordCode(KeywordCode);

                    dtlOtherKeywords.DataSource = KeywordsBOL.GetKeywordsStartsWith(CurKeyword.Name);
                    dtlOtherKeywords.DataBind();
                }
                else
                {
                    Response.Redirect("~/", false);
                }
            }
            catch (Exception err)
            {
                Response.Redirect("~/", false);
                //string MailBody = "Page: " + Request.FilePath + " Exception: " + err.Message;
                //Tools tools = new Tools();
                //bool SendResult = tools.SendEmail(MailBody, "پارست ::Error ", "*****@*****.**", "", "", "");
            }
        }
Пример #7
0
 internal string GetLatestNewsByKeyword(string Keyword)
 {
     try
     {
         BOLKeywords KeywordsBOL = new BOLKeywords();
         int?        KeywordCode = KeywordsBOL.GetKeywordCode(Keyword);
         if (KeywordCode != null)
         {
             IEnumerable <spGetNewsByKeywordCodeResult> Result = dataContext.spGetNewsByKeywordCode(KeywordCode).Where(p => p.KeywordCode.Equals(KeywordCode)).OrderByDescending(p => p.NewsDate).Take(1);
             spGetNewsByKeywordCodeResult CurItem = Result.First();
             return(CurItem.Title + "|" + CurItem.ResourceName + " " + Tools.GetPrettyPersianDate2(CurItem.NewsDate));
         }
         return("");
     }
     catch
     {
         return("");
     }
 }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLLogs LogsBOL = new BOLLogs();

        LogsBOL.LogRequest();

        string CurUrl = Request.Url.ToString();

        CurUrl = CurUrl.Replace("http://", "");
        //if(CurUrl.IndexOf("//") != -1)
        //{
        //    Response.Redirect("http://" + CurUrl.Replace("//", "/"));
        //}


        if (!Page.IsPostBack)
        {
            string UserCode = "";
            try
            {
                BOLKeywords NewsKeywords = new BOLKeywords();
                rptMostImportantKeywords.DataSource = NewsKeywords.GetMostImportantKeywords(10);
                rptMostImportantKeywords.DataBind();
            }
            catch
            {
            }

            try
            {
                BOLNews NewsBOL = new BOLNews();
                rptImages.DataSource = NewsBOL.GetPicNews(null, null, 40);
                rptImages.DataBind();
            }
            catch
            {
            }
        }
        #region Load Scripts
        //HtmlGenericControl script0 = new HtmlGenericControl("script");
        //script0.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/jquery-1.11.3.min.js"));
        //script0.Attributes.Add("type", "text/javascript");
        //script0.Attributes.Add("", "");
        //Page.Header.Controls.Add(script0);

        //HtmlGenericControl scriptBootStrap = new HtmlGenericControl("script");
        //scriptBootStrap.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/bootstrap.min.js"));
        //scriptBootStrap.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(scriptBootStrap);

        //HtmlGenericControl script23 = new HtmlGenericControl("script");
        //script23.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/jquery.cycle.all.js"));
        //script23.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script23);

        //HtmlGenericControl script1 = new HtmlGenericControl("script");
        //script1.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/jquery-ui.js"));
        //script1.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script1);

        //HtmlGenericControl script10 = new HtmlGenericControl("script");
        //script10.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/jquery.easing.min.1.3.js"));
        //script10.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script10);

        //HtmlGenericControl script11 = new HtmlGenericControl("script");
        //script11.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/jquery.jcontent.0.8.min.js"));
        //script11.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script11);

        //HtmlGenericControl script12 = new HtmlGenericControl("script");
        //script12.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/hoverIntent.js"));
        //script12.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script12);

        //HtmlGenericControl script = new HtmlGenericControl("script");
        //script.Attributes.Add("src", this.ResolveClientUrl("~/Scripts/mainv1.2.js"));
        //script.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script);

        //HtmlGenericControl script2 = new HtmlGenericControl("script");
        //script2.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/farsi.js"));
        //script2.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script2);

        //if (fBrowserIsMobile())
        //{
        //    HtmlGenericControl scriptPopup = new HtmlGenericControl("script");
        //    scriptPopup.Attributes.Add("src", this.ResolveClientUrl("https://static.Khabardaan.ir/Scripts/Popupv8.js"));
        //    scriptPopup.Attributes.Add("type", "text/javascript");
        //    Page.Header.Controls.Add(scriptPopup);
        //}


        //HtmlGenericControl script24 = new HtmlGenericControl("script");
        //script24.Attributes.Add("src", this.ResolveClientUrl("~/Scripts/jquery.accordion.2.0.min.js"));
        //script24.Attributes.Add("type", "text/javascript");
        //Page.Header.Controls.Add(script24);
        #endregion

        #region DateTime
        DateTimeMethods dtm      = new DateTimeMethods();
        DateTime        IranDate = DateTime.Now;
        lblPersianDateTime.Text = Tools.ChangeEnc(dtm.GetPersianLongDate(DateTime.Now));

        #endregion
    }
Пример #9
0
        public void ShowNewsByKeywordCode(int KeywordCode)
        {
            try
            {
                strPageNo = Request["PageNo"];
                try
                {
                    PageNo = Convert.ToInt32(strPageNo);
                }
                catch
                {
                }
                if (PageNo == 0)
                {
                    PageNo = 1;
                }
                if (PageNo > 50)
                {
                    PageNo = 50;
                }

                BOLNews NewsBOL = new BOLNews();
                //IQueryable<vNewsByKeywords> ItemList = NewsBOL.GetNewsByKeywordCode(KeywordCode, _pageSize, PageNo);

                BOLKeywords KeywordsBOL    = new BOLKeywords();
                Keywords    CurrentKeyword = KeywordsBOL.GetKeywordByCode(KeywordCode);
                if (CurrentKeyword != null)
                {
                    _keyword = CurrentKeyword.Name;
                }

                int ResultCount = NewsBOL.GetNewsByKeywordCodeCount(KeywordCode);
                rptNewsList.DataSource = NewsBOL.GetNewsByKeywordCode(KeywordCode, _pageSize, PageNo);
                rptNewsList.DataBind();

                if (rptNewsList.Items.Count == 0)
                {
                    Keywords CurKeyword = ((IBaseBOL <Keywords>)KeywordsBOL).GetDetails(KeywordCode);
                    ResultCount = NewsBOL.SearchNewsByKeywordCount(CurKeyword.Name);

                    rptNewsList.DataSource = NewsBOL.SearchNewsByKeyword(CurKeyword.Name, _pageSize, PageNo);;
                    rptNewsList.DataBind();
                }

                string Keyword = Request["Keyword"];
                ConcatUrl = "&Code=" + KeywordCode + "&Keyword=" + Keyword;
                int PageCount = ResultCount / _pageSize;
                if (ResultCount % _pageSize > 0)
                {
                    PageCount++;
                }
                pgrToolbar.PageNo    = PageNo;
                pgrToolbar.PageCount = PageCount;
                pgrToolbar.ConcatUrl = ConcatUrl;
                pgrToolbar.PageBind();
            }
            catch (Exception err)
            {
                BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
                ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "UCNewsList::ShowNewsByKeywordCode");

                //string MailBody = "Page: " + Request.FilePath + " Exception: " + err.Message;
                //Tools tools = new Tools();
                //bool SendResult = tools.SendEmail(MailBody, "پارست ::Error ", "*****@*****.**", "", "", "");
            }
        }