Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strCode = "";

        try
        {
            strCode = Request["Code"];
            int Code;
            Int32.TryParse(strCode, out Code);
            BOLResourceSites ResourceSitesBOL = new BOLResourceSites();
            ResourceSites    CurResourceSite  = ResourceSitesBOL.GetDetails(Code);
            if (CurResourceSite != null)
            {
                Response.Redirect("~/NR" + Code + "_" + Tools.ReplaceSpaceWithUnderline(CurResourceSite.Name) + ".html", false);
            }
            Page.Title = lblResourceTitle.Text = " آخرین خبرهای " + CurResourceSite.Name;

            NewsList1.ShowNewsByResourceCode(Code);
        }
        catch (Exception err)
        {
            BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
            ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "NewsByResource::Load:Code=" + strCode);
        }
    }
Ejemplo n.º 2
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);
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string UserAgent = Request.UserAgent;

        if (!Page.IsPostBack)
        {
            //tnMostVisited.ShowLatestTextNews(100);

            try
            {
                BOLNews NewsBOL = new BOLNews();

                Keyword = Request["Keyword"];
                if (string.IsNullOrEmpty(Keyword))
                {
                    NewsList1.ShowPicNews();
                }
                //else
                //NewsList1.SearchNews(Keyword);

                rptKhabardaanPicNews.Visible    = true;
                rptKhabardaanPicNews.DataSource = NewsBOL.GetRandPicNews(4);
                rptKhabardaanPicNews.DataBind();
            }

            catch (Exception err)
            {
                BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
                ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "News_Default::Load");
            }
        }
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string strCode = Request["Code"];
            int    Code;
            Int32.TryParse(strCode, out Code);
            BOLNews NewsBOL = new BOLNews();
            NewsList1.ShowNewsByCatCode(Code, null);

            string strPageNo = Request["PageNo"];
            int    PageNo    = Convert.ToInt32(strPageNo);
            if (PageNo == 0)
            {
                PageNo = 1;
            }


            IBaseBOL <DataTable> HardCodeBOL = new BOLHardCode();
            HardCodeBOL.QueryObjName = "HCResourceSitesCats";
            DataTable dtCurCat = HardCodeBOL.GetDetails(Code);
            if (dtCurCat.Rows.Count == 1)
            {
                ltrHeader.Text = "آخرین خبرهای " + dtCurCat.Rows[0]["Name"].ToString() + " صفحه " + Tools.ChangeEnc(PageNo);
                Page.Title     = " آخرین خبرهای " + dtCurCat.Rows[0]["Name"].ToString() + " صفحه " + Tools.ChangeEnc(PageNo);
            }
        }
        catch (Exception err)
        {
            BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
            ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "NewsByCatCode::Load");
        }
    }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int    PageNo    = 1;
                string strPageNo = Request["PageNo"];
                if (!string.IsNullOrEmpty(strPageNo))
                {
                    Int32.TryParse(strPageNo, out PageNo);
                }
                if (PageNo == 0)
                {
                    PageNo = 1;
                }

                int?HCNewsCatCode = null;

                string strCatCode = Request["CatCode"];
                if (!string.IsNullOrEmpty(strCatCode))
                {
                    int CatCode = 0;
                    Int32.TryParse(strCatCode, out CatCode);
                    if (CatCode != 0)
                    {
                        HCNewsCatCode = CatCode;
                    }
                }
                //DateTimeMethods dtm = new DateTimeMethods();
                //BOLNews NewsBOL = new BOLNews();
                //vNews LatestNews = NewsBOL.GetLatestNews(1);

                NewsList1.ShowLatestNews(HCNewsCatCode, 15, null, null, PageNo, true, null, 1);
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int    HCContentTypeCode    = 0;
                string strHCContentTypeCode = Request["CT"];
                string strCaseCode          = Request["CaseCode"];
                string strDate         = Request["d"];
                string strNewsTypeCode = Request["NTC"];

                Int32.TryParse(strHCContentTypeCode, out HCContentTypeCode);
                string Keyword = Request["Keyword"];
                string strMCat = Request["MCat"];
                int    MCat;
                int    CaseCode;
                int    NewsTypeCode;

                Int32.TryParse(strCaseCode, out CaseCode);
                Int32.TryParse(strMCat, out MCat);
                Int32.TryParse(strNewsTypeCode, out NewsTypeCode);

                int    WorkGroupCode    = 0;
                string strWorkGroupCode = Request["WG"];
                Int32.TryParse(strWorkGroupCode, out WorkGroupCode);

                if (HCContentTypeCode != 0)
                {
                    BOLHardCode HardCodeBOL = new BOLHardCode();
                    HardCodeBOL.TableOrViewName = "HCContentTypes";
                    //lblHeader.Text = HardCodeBOL.GetNameByCode(HCContentTypeCode);

                    //BOLNews NewsBOL = new BOLNews();
                    //vNews LatestNews = NewsBOL.GetLatestNews(1);
                    NewsList1.ShowNewsByContentTypeCode(HCContentTypeCode);
                }
                else if (MCat != 0)
                {
                    BOLNews NewsBOL = new BOLNews();
                    NewsList1.LoadMainCats(MCat);
                }
                else if (!string.IsNullOrEmpty(Keyword))
                {
                    //BOLNews NewsBOL = new BOLNews();
                    //vNews LatestNews = NewsBOL.GetLatestNews(1);
                    NewsList1.PageSize       = 10;
                    NewsList1.CurrentKeywrod = Keyword;
                    NewsList1.SearchNews(Keyword);
                }
                else if (!string.IsNullOrEmpty(strDate))
                {
                    NewsList1.ShowLatestNews(null, 10, new int[] { }, null, null, true, strDate, NewsTypeCode);
                }
                else
                {
                    NewsList1.ShowLatestNews(null, 10, new int[] { }, null, null, true, null, NewsTypeCode);
                }
            }
        }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string Keyword = Server.UrlDecode(Request["Keyword"]);
         if (Keyword != "" && Keyword != null)
         {
             NewsList1.ShowNewsByKeyword(Keyword);
         }
         //((TextBox)Master.FindControl("txtKeyword")).Text = Keyword;
     }
 }
Ejemplo n.º 8
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 ", "*****@*****.**", "", "", "");
            }
        }
Ejemplo n.º 9
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 ", "*****@*****.**", "", "", "");
            }
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int PageSize      = 20;
            int PageNo        = 1;
            int?HCNewsCatCode = null;

            string strPageNo        = Request["PageNo"];
            string strHCNewsCatCode = Request["CatCode"];

            Int32.TryParse(strPageNo, out PageNo);
            if (!string.IsNullOrEmpty(strHCNewsCatCode))
            {
                HCNewsCatCode = Convert.ToInt32(strHCNewsCatCode);
            }

            NewsList1.ShowLatestNews(HCNewsCatCode, PageSize, new int[] { }, null, PageNo, false, null, 1);
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string strCode = Request["Code"];
                int    Code;
                Int32.TryParse(strCode, out Code);
                BOLNews NewsBOL = new BOLNews();
                NewsList1.ShowNewsByResourceCode(Code);

                BOLResourceSites ResourceSitesBOL = new BOLResourceSites();
                ResourceSites    CurResourceSite  = ((IBaseBOL <ResourceSites>)ResourceSitesBOL).GetDetails(Code);
                Page.Title = lblResourceTitle.Text = " آخرین خبرهای " + CurResourceSite.Name;
            }
            catch
            {
            }
        }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int    Code;
            string strCode = Request["Code"];
            Int32.TryParse(strCode, out Code);
            if (Code != 0)
            {
                BOLNews NewsBOL = new BOLNews();
                News    CurNews = ((IBaseBOL <News>)NewsBOL).GetDetails(Code);
                if (CurNews != null)
                {
                    Page.Title    = CurNews.Title;
                    hplTitle.Text = CurNews.Title;
                    //hplTitle.NavigateUrl = "~/News/" + Code + ".htm";
                    lblDate.Text = Tools.GetPrettyDate((DateTime)CurNews.NewsDate);
                    string   FullStory = CurNews.Contents;
                    ReqUtils Utils     = new ReqUtils();
                    FullStory = Utils.RemoveTags(FullStory);

                    lblContents.Text = Tools.ShowBriefText(FullStory, 300);
                    if (CurNews.PicName != null && CurNews.PicName != "")
                    {
                        imgPic.ImageUrl = CurNews.ImgUrl;
                        imgPic.CssClass = "img-fluid";
                    }
                    else
                    {
                        imgPic.Visible = false;
                    }
                    NewsList1.ShowRelatedNews(Code);
                }
            }
        }
        catch (Exception err)
        {
            BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
            ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "RelatedNews::Load");
        }
    }