private void SaveTabir(string WordName, string TabirUrl) { ReqUtils Reqs = new ReqUtils(); TabirUrl = TabirUrl.Replace("\" target=\"_blank", ""); string Result = Reqs.GetHTML(TabirUrl, System.Text.Encoding.UTF8); string _pattern = @" class=""contentpaneopen_text"">\s*(.*?)</div>"; Regex r = new Regex(_pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline); Match m = r.Match(Result); if (m.Success) { string Meaning = m.Groups[1].Captures[0].ToString(); Meaning = Reqs.RemoveTags(Meaning); TabirDataContext dc = new TabirDataContext(); Parsetv91._1.Code.DAL.Tabir NewRecord = new Code.DAL.Tabir(); dc.Tabirs.InsertOnSubmit(NewRecord); NewRecord.WordName = WordName; NewRecord.Meaning = Meaning; NewRecord.ID = MainCounter.ToString(); MainCounter++; dc.SubmitChanges(); } }
public string FormatText2(Object obj, int CharCount) { if (obj == null) { return(""); } ReqUtils rUtil = new ReqUtils(); return(Tools.ShowBriefText(rUtil.RemoveTags(obj.ToString()), CharCount)); }
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"); } }
protected void Page_Load(object sender, EventArgs e) { try { //TextNewsList2.ShowLatestTextNews(100); int Code; string strCode = Request["Code"]; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLNews NewsBOL = new BOLNews(); //PageTools1.ItemCode = Code; //PageTools1.HCEntityCode = 1; vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); if (CurNews == null) { msgText.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgText.Text = "No news found"; //pnlShowNews.Visible = false; return; } NewsUrl = CurNews.Url; if (!NewsUrl.StartsWith("http://")) { NewsUrl = "http://" + NewsUrl; } NewsUrl = NewsUrl.Replace("http://https://", "https://"); Response.Redirect(NewsUrl); Response.End(); return; //NewsBOL.UpdateViewCount(Code); Page.Title = CurNews.Title; string FullStory = Tools.FormatString(CurNews.Contents); HtmlMeta metaTitle = (HtmlMeta)Page.Master.FindControl("title"); metaTitle.Attributes["content"] = CurNews.Title.Trim(); HtmlMeta metaURL = (HtmlMeta)Page.Master.FindControl("url"); metaURL.Attributes["content"] = "https://www.khabardaan.ir/N" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html"; HtmlMeta metaKeywords = (HtmlMeta)Page.Master.FindControl("keywords"); metaKeywords.Attributes["content"] = ""; HtmlMeta metaDescription = (HtmlMeta)Page.Master.FindControl("description"); string BriefStory = Tools.ShowBriefText(FullStory, 1100); ReqUtils Utils = new ReqUtils(); BriefStory = Utils.RemoveTags(BriefStory); metaDescription.Attributes["content"] = BriefStory; if (!string.IsNullOrEmpty(CurNews.PicName)) { HtmlMeta metaImage = (HtmlMeta)Page.Master.FindControl("image"); metaImage.Attributes["content"] = "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; } DateTimeMethods dtm = new DateTimeMethods(); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } //if (FullStory.Length < 100) //{ // Response.Redirect(CurNews.Url); // return; //} } } catch (Exception err) { //Response.Write(err.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { //TextNewsList2.ShowLatestTextNews(100); int Code; string strCode = Request["Code"]; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLNews NewsBOL = new BOLNews(); //PageTools1.ItemCode = Code; //PageTools1.HCEntityCode = 1; vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); if (CurNews == null) { msgText.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgText.Text = "خبری با این کد یافت نشد."; //pnlShowNews.Visible = false; return; } Response.Redirect("~/N" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html", false); return; NewsUrl = CurNews.Url; //NewsBOL.UpdateViewCount(Code); Page.Title = CurNews.Title; string FullStory = Tools.FormatString(CurNews.Contents); HtmlMeta metaTitle = (HtmlMeta)Page.Master.FindControl("title"); metaTitle.Attributes["content"] = CurNews.Title; HtmlMeta metaURL = (HtmlMeta)Page.Master.FindControl("url"); metaURL.Attributes["content"] = "https://www.khabardaan.ir/news/" + CurNews.Code + ".htm"; HtmlMeta metaKeywords = (HtmlMeta)Page.Master.FindControl("keywords"); metaKeywords.Attributes["content"] = ""; HtmlMeta metaDescription = (HtmlMeta)Page.Master.FindControl("description"); string BriefStory = Tools.ShowBriefText(FullStory, 400); ReqUtils Utils = new ReqUtils(); BriefStory = Utils.RemoveTags(BriefStory); metaDescription.Attributes["content"] = BriefStory; if (!string.IsNullOrEmpty(CurNews.PicName)) { HtmlMeta metaImage = (HtmlMeta)Page.Master.FindControl("image"); metaImage.Attributes["content"] = "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; } DateTimeMethods dtm = new DateTimeMethods(); //lblViewTitle.Text = CurNews.Title; //lblViewNewsDate.Text = Tools.ChangeEnc(dtm.GetPersianLongDate((DateTime)CurNews.NewsDate)); //RelatedNews1.NewsCode = Code.ToString(); //KeywordList1.NewsCode = Code.ToString(); //lblViewCount.Text = NewsBOL.GetVisitCount(CurNews.Code);// Tools.ChangeEnc(CurNews.ViewCount.ToString()); //hplResourceName.Text = "جدید ترین خبرهای " + CurNews.Name; //hplResourceName.NavigateUrl = "~/News/Resources/" + CurNews.ResouseSiteCode + ".htm"; //hplCatName.Text = "جدید ترین خبرهای " + CurNews.CatName; //hplCatName.NavigateUrl = "~/News/NewsByCatCode.aspx?Code=" + CurNews.CatCode; //hplRelatedNews.NavigateUrl = "~/News/RelatedNews.aspx?Code=" + CurNews.Code; //hplViewResourceName.NavigateUrl = CurNews.Url; //lblViewCode.Text = CurNews.Code.ToString(); //lblViewNewsTime.Text = Tools.ChangeEnc(CurNews.NewsDate.Value.Hour + ":" + CurNews.NewsDate.Value.Minute); //ShareFaceBook.NavigateUrl = "~/ShareLink.aspx?Media=facebook&LinkUrl=" + Server.UrlEncode("https://www.khabardaan.ir/News/ShowNews.aspx?Code=" + CurNews.Code) + "&LinkTitle=" + Server.UrlEncode(CurNews.Title); //ShareDigg.NavigateUrl = "~/ShareLink.aspx?Media=digg&LinkUrl=" + Server.UrlEncode("https://www.khabardaan.ir/News/ShowNews.aspx?Code=" + CurNews.Code) + "&LinkTitle=" + Server.UrlEncode(CurNews.Title); //ShareTwitter.NavigateUrl = "~/ShareLink.aspx?Media=twitter&LinkUrl=" + Server.UrlEncode("https://www.khabardaan.ir/News/ShowNews.aspx?Code=" + CurNews.Code) + "&LinkTitle=" + Server.UrlEncode(CurNews.Title); //rptResourceNewsList.DataSource = NewsBOL.GetLatestNewsByResourceCode((int)CurNews.ResouseSiteCode, 4, 1); //rptResourceNewsList.DataBind(); //rptMostVisitedNews.DataSource = NewsBOL.GetMostVisitedTextNews(5, 1, 100); //rptMostVisitedNews.DataBind(); //rptCatNews.DataSource = NewsBOL.GetNewsByCatCode((int)CurNews.CatCode, 4, 1); //rptCatNews.DataBind(); //rptRelatedNews.DataSource = NewsBOL.GetRelatedNews((int)CurNews.Code, 4, 1); //rptRelatedNews.DataBind(); //if (rptRelatedNews.Items.Count == 0) // pnlRelatedNews.Visible = false; BOLNewsKeywords NewsKeywordsBOL = new BOLNewsKeywords(CurNews.Code); //rptKeywords.DataSource = NewsKeywordsBOL.GetTopKeywords(CurNews.Code, 3); //rptKeywords.DataBind(); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } if (FullStory.Length < 100) { Response.Redirect(CurNews.Url); return; } } } catch (Exception err) { BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs(); ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "ShowExternalNews::Load"); } }
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(); //PageTools1.ItemCode = Code; //PageTools1.HCEntityCode = 1; vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); if (CurNews == null) { msgText.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgText.Text = "No news found."; pnlShowNews.Visible = false; return; } strNewsCode = CurNews.Code.ToString(); Tools.SetLink("lnkCanonical", "https://www.khabardaan.ir/" + "/News/" + CurNews.Code + ".html"); Tools.SetMeta("keywords", CurNews.Title); Tools.SetMeta("description", CurNews.Title); Tools.SetMeta("twittercard", CurNews.Title); Tools.SetMeta("twittertitle", CurNews.Title); Tools.SetMeta("twitterdescription", CurNews.Title); Tools.SetMeta("ogtitle", CurNews.Title); Tools.SetMeta("ogurl", "https://www.khabardaan.ir/" + "/News/" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html"); Tools.SetMeta("twitterimagesrc", ""); if (!string.IsNullOrEmpty(CurNews.PicName)) { Tools.SetMeta("ogimage", "https://static.parset.com/Files/News/" + CurNews.PicName); } Tools.SetMeta("ogdescription", CurNews.Title); //NewsBOL.UpdateViewCount(Code); lblViewTitle.Text = CurNews.Title; Page.Title = CurNews.Title + " - خبردان"; ReqUtils Utils = new ReqUtils(); string FullStory = CurNews.Contents; FullStory = Utils.RemoveTags(FullStory); FullStory = Tools.FormatString(FullStory); FullStory = Tools.ShowBriefText(FullStory, 3000) + "..."; FullStory = FullStory.Replace("<img ", "<img class=\"img-responsive\" "); //if (FullStory.IndexOf("<br />") == -1) //{ // if(FullStory.IndexOf("<img ") == -1) // lblViewContents.Text = GenParagraph(FullStory); // else // lblViewContents.Text = CorrectEnters(FullStory); //} //else // lblViewContents.Text = FullStory; DataTable dtNewsImages = new Converter <NewsImages>().ToDataTable(NewsBOL.GetNewsImages(CurNews.Code)); lblViewContents.Text = GenParagraph(FullStory, dtNewsImages); DateTimeMethods dtm = new DateTimeMethods(); lblViewNewsDate.Text = Tools.ChangeEnc(dtm.GetPersianDate((DateTime)CurNews.NewsDate)); if (!string.IsNullOrEmpty(CurNews.PicName)) { imgPicName.ImageUrl = CurNews.ImgUrl;// "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; imgPicName.ToolTip = CurNews.Title; } else { pnlPic.Visible = false; } RelatedNews1.NewsCode = Code.ToString(); KeywordList1.NewsCode = Code.ToString(); lblViewCount.Text = Tools.ChangeEnc(NewsBOL.GetVisitCount(CurNews.Code)); hplViewResourceName.Text = CurNews.Name; hplMoreFull.NavigateUrl = hplViewResourceName.NavigateUrl = CurNews.Url; //"https://www.khabardaan.ir/N" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html"; lblViewCode.Text = CurNews.Code.ToString(); string strNewsHour = CurNews.NewsDate.Value.Hour.ToString(); if (strNewsHour.Length == 1) { strNewsHour = "0" + strNewsHour; } string strNewsMinute = CurNews.NewsDate.Value.Minute.ToString(); if (strNewsMinute.Length == 1) { strNewsMinute = "0" + strNewsMinute; } lblViewNewsTime.Text = Tools.ChangeEnc(strNewsHour + ":" + strNewsMinute); News3Col1.LoadPicNews(); //rptNewsImages.DataSource = NewsBOL.GetNewsImages(CurNews.Code); //rptNewsImages.DataBind(); //rptImages.DataSource = NewsBOL.GetSmallRelatedNews(CurNews.Code, 20, 1); //rptImages.DataBind(); //int CatCode = (int)CurNews.CatCode; //switch (CatCode) //{ // case 1: // { // lblCatTitle.Text = "اجتماعي "; // break; // } // case 2: // { // lblCatTitle.Text = "اقتصادي"; // break; // } // case 3: // { // lblCatTitle.Text = "سياسي"; // break; // } // case 4: // { // lblCatTitle.Text = "ورزشي"; // break; // } // case 5: // { // lblCatTitle.Text = "علمي"; // break; // } // case 6: // { // lblCatTitle.Text = "فرهنگي"; // break; // } // case 7: // { // lblCatTitle.Text = "ادب و هنر"; // break; // } // case 8: // { // lblCatTitle.Text = "بينالملل"; // break; // } // case 9: // { // lblCatTitle.Text = "حوادث"; // break; // } // default: // break; //} //lblCatTitle.Text = "آخرین خبرهای " + lblCatTitle.Text ; //NewsList1.ShowPager = false; //NewsList1.ShowNewsByCatCode((int)CurNews.CatCode, null); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } //if (FullStory.Length < 100) //{ // Response.Redirect(CurNews.Url); // return; //} //SmallAdsList1.ShowAdsByNewsCode(Code); //dtlRelatedPicNews.DataSource = NewsBOL.GetRelatedPicNews(Code); //dtlRelatedPicNews.DataBind(); //ProductsDataContext pdc = new ProductsDataContext(); //vRandPayeganGood CurRandBanner = pdc.vRandPayeganGoods.SingleOrDefault(); //if (CurRandBanner != null) //{ // hplPBanner.ImageUrl = CurRandBanner.strHBannerURL.Trim(); // hplPBanner.NavigateUrl = "http://forosh.biz/Detail.aspx?q=" + CurRandBanner.strGoodCode.Trim() + "&s=9144"; //} //CurRandBanner = pdc.vRandPayeganGoods.SingleOrDefault(); //if (CurRandBanner != null) //{ // hplPBanner2.ImageUrl = CurRandBanner.strHBannerURL.Trim(); // hplPBanner2.NavigateUrl = "http://forosh.biz/Detail.aspx?q=" + CurRandBanner.strGoodCode.Trim() + "&s=9144"; //} } } catch (Exception err) { BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs(); ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "ShowNews::Load"); } }
void ListNews(int privateSiteCode, string privateNewsUrl, string privateNewsTitle, string privateREDetail, string privateREImage, string privateREVideo, int Count, string LinkDomainName, int EncodingTypeCode) { ReqUtils gn = new ReqUtils(); string NewsContentHtml = ""; string FullStory = ""; string ImageSource = ""; string VideoSource = ""; string TextTitle = ""; string NewsCode = ""; System.Text.Encoding enc = System.Text.Encoding.UTF8; if (EncodingTypeCode != 1) { IBaseBOL <DataTable> BolHardCode = new BOLHardCode(); BolHardCode.QueryObjName = "HCEncodingTypes"; DataTable dt = BolHardCode.GetDetails(EncodingTypeCode); enc = System.Text.Encoding.GetEncoding(dt.Rows[0]["Description"].ToString()); } privateNewsUrl = privateNewsUrl.Replace("//", "/"); privateNewsUrl = privateNewsUrl.Replace("http:/", "http://"); privateNewsUrl = privateNewsUrl.Replace("https:/", "https://"); if (privateREDetail.Length > 0) { NewsContentHtml = gn.GetHTML(privateNewsUrl, enc); if (privateREDetail != null && privateREDetail != "") { FullStory = gn.GetREGroup(NewsContentHtml, privateREDetail, "CONTENT"); } if (privateREImage != null && privateREImage != "") { ImageSource = gn.GetREGroup(NewsContentHtml, privateREImage, "IMAGE"); } if (privateREVideo != null && privateREVideo != "") { VideoSource = gn.GetREGroup(NewsContentHtml, privateREVideo, "VIDEO"); } if (!ImageSource.StartsWith("http://") && !ImageSource.StartsWith("https://") && ImageSource != "") { ImageSource = LinkDomainName + ImageSource; } if (!VideoSource.StartsWith("http://") && VideoSource != "") { VideoSource = LinkDomainName + VideoSource; } FullStory = gn.RemoveTags(FullStory, "br"); FullStory = FullStory.Replace("'", ""); FullStory = FullStory.Replace("\"", ""); FullStory = FullStory.Replace("\r", ""); FullStory = FullStory.Replace("\t", ""); FullStory = FullStory.Replace(" ", ""); ImageSource = ImageSource.Replace("[", "%5B"); ImageSource = ImageSource.Replace("]", "%5D"); VideoSource = VideoSource.Replace("[", "%5B"); VideoSource = VideoSource.Replace("]", "%5D"); if (ImageSource != "") //Save News File { try { int SlashPos = ImageSource.LastIndexOf("/"); string FileName = ImageSource.Substring(SlashPos + 1, ImageSource.Length - SlashPos - 1); WebClient WebCl = new WebClient(); string FName = Server.MapPath("~/Files/News/" + Tools.GetRandomFileName(FileName)); //WebCl.DownloadFile(ImageSource, FName); } catch { } } } TextTitle = gn.RemoveTags(privateNewsTitle); string ImageTag = ""; if (ImageSource != "") { ImageSource = "<img src=\"" + ImageSource + "\">"; } string outStr = string.Format("<table border=\"1\" class=\"cNews\" dir=\"rtl\" width=\"100%\" ><tr><td>{0}</td><td >{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr></table>", Count, TextTitle, FullStory.Length, ImageSource, VideoSource, privateNewsUrl); Response.Write(outStr); Response.Flush(); gn.Dispose(); }
public void GetSingleSite(int privateSiteCode, int privateLimitCount) { int Count = 1; string NewsTitle = ""; string HtmlContent = ""; string EditedNewsTitle = ""; string NewsTextTitle = ""; ReqUtils gn; string SelectStatement = ""; BOLResourseSiteCats ResourceSiteCatsBOL = new BOLResourseSiteCats(1); vResourseSiteCats SingleSite = ResourceSiteCatsBOL.GetSingleSite(privateSiteCode); int SiteCode = SingleSite.Code; string SiteName = SingleSite.Name; string SiteUrl = SingleSite.Url; int? EncodingTypeCode = SingleSite.HCEncodingTypeCode; string BaseURL = SingleSite.BaseURL; string RELink = SingleSite.RELink; string REDetail = SingleSite.REDetail; string REImage = SingleSite.REImage; string REVideo = SingleSite.REVideo; ArrayList NewList = new ArrayList(); gn = new ReqUtils(); System.Text.Encoding enc = System.Text.Encoding.UTF8; if (EncodingTypeCode != 1) { IBaseBOL <DataTable> BolHardCode = new BOLHardCode(); BolHardCode.QueryObjName = "HCEncodingTypes"; DataTable dt = BolHardCode.GetDetails((int)EncodingTypeCode); enc = System.Text.Encoding.GetEncoding(dt.Rows[0]["Description"].ToString()); } int LastSlash = SiteUrl.LastIndexOf("/"); string LinkDomainName; if (BaseURL != null && BaseURL != "") { LinkDomainName = BaseURL; } else { LinkDomainName = SiteUrl.Substring(0, LastSlash + 1); } if (!(bool)SingleSite.RssIsActive) { HtmlContent = gn.GetHTML(SiteUrl, enc); NewList = gn.ExtractNewsLinks(HtmlContent, RELink, LinkDomainName); } else { NewList = GetNewsList(SingleSite.RssUrl); } IEnumerator NewENum = NewList.GetEnumerator(); gn = new ReqUtils(); while (NewENum.MoveNext()) { NewsTitle = NewENum.Current.ToString(); NewsTextTitle = gn.RemoveTags(NewsTitle); BOLNews NewsBOl = new BOLNews(); if (!NewsBOl.CheckNewsExists(NewsTextTitle, SiteCode)) { string RealLink = gn.ExtractLink(NewsTitle); string outStr = ""; //outStr = string.Format("<table width=100% ><tr><td class=\"cNews\">{1}</td><td>{0}</td></tr></table>", Count, NewsTitle); //Response.Write(outStr); //Response.Flush(); ListNews(SiteCode, RealLink, NewsTitle, REDetail, REImage, REVideo, Count, LinkDomainName, (int)EncodingTypeCode); } Count++; if (privateLimitCount != 0) { if (privateLimitCount == Count) { break; } } } }
public string ShowText(Object obj) { int SelectLen = 180; try { if (obj != null) { string str = obj.ToString(); try { ReqUtils Utils = new ReqUtils(); str = Utils.RemoveTags(str); if (!string.IsNullOrEmpty(_keyword)) { string FirstKeyword = _keyword; if (_keyword.IndexOf(" ") != -1) { string[] KeywordArray = _keyword.Split(' '); FirstKeyword = KeywordArray[0]; } int FirstKeywordIndex = str.IndexOf(FirstKeyword); if (FirstKeywordIndex > SelectLen) { int StartIndex = FirstKeywordIndex - 150; int StopIndex = FirstKeywordIndex + 150; if (StopIndex > str.Length) { StopIndex = str.Length; } int CutLen = StopIndex - StartIndex; str = "..." + str.Substring(StartIndex, CutLen) + "..."; } } } catch { } if (str.Length > SelectLen) { str = str.Substring(0, SelectLen) + "..."; } if (!string.IsNullOrEmpty(_keyword)) { _keyword = _keyword.Trim(); string[] KeywordArray = _keyword.Split(' '); for (int i = 0; i < KeywordArray.Length; i++) { if (KeywordArray[i].Length > 1) { str = str.Replace(KeywordArray[i], "<span class=keyworditem>" + KeywordArray[i] + "</span>"); } } return(str); } else { return(str); } } else { return(""); } } catch { return(obj.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserCode"] == null) { } else { } if (!Page.IsPostBack) { if (Request["RefUserCode"] != null) { Session["RefUserCode"] = Request["RefUserCode"]; } strCode = Request["Code"]; int Code; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLProducts ProductsBOL = new BOLProducts(); Products CurProduct = ((IBaseBOL <Products>)ProductsBOL).GetDetails(Code); if (CurProduct != null) { ViewState["Code"] = Code.ToString(); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" ) { int ff = 1; } else { ProductsBOL.IncrementView(CurProduct.Code); ProductsBOL.IncProVisits(CurProduct.Code); } hplBuy.NavigateUrl = "~/Cart.aspx?ProductCode=" + Code; lblEnTitle.Text = CurProduct.EnTitle; lblFaTitle.Text = CurProduct.FaTitle; strEnTitle = CurProduct.EnTitle; lblDescription.Text = Tools.FormatString(CurProduct.Description); lblPrice.Text = Tools.ChangeEnc(Tools.FormatCurrency((Convert.ToInt32(CurProduct.Price) / 10).ToString())) + " تومان"; int?MarketPrice = CurProduct.MarketPrice; if (MarketPrice != null) { if (MarketPrice > CurProduct.Price) { lblMarketPrice.Text = Tools.ChangeEnc(Tools.FormatCurrency((Convert.ToInt32(CurProduct.MarketPrice) / 10).ToString())) + " تومان"; pnlMarketPrice.Visible = true; } } ProTitle = CurProduct.FaTitle; if (string.IsNullOrEmpty(CurProduct.FaTitle)) { ProTitle = CurProduct.EnTitle; } ReqUtils Utils = new ReqUtils(); string FullDesc = CurProduct.Description; string BriefDesc = Tools.ShowBriefText(Utils.RemoveTags(FullDesc), 300); Page.Title = ProTitle; //if (CurProduct.ProductCatCode != null) //{ // SelectedProducts1.CatCode = (int)CurProduct.ProductCatCode; // RelatedProducts1.ProductCode = CurProduct.Code; // RelatedProducts1.ShowSelectedProducts(); //} //else // SelectedProducts1.Visible = false; BOLHardCode HardCodeBOL = new BOLHardCode(); ltrHirarchy.Text = strHirarchy; #region Fill Fields #endregion #region Visibility #endregion #region Box Visibility #endregion //string[] ProTitleArray = ProTitle.Split(' '); } } } }
protected void Button1_Click(object sender, EventArgs e) { //BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); //ReqUtils Utils = new ReqUtils(); //ContentsDataContext dc = new ContentsDataContext(); //var ContentList = dc.Contents; //foreach (var item in ContentList) //{ // try // { // string CurDesc = item.ContentText; // CurDesc = Utils.RemoveTags(CurDesc); // CurDesc = Tools.PersianTextCorrection(CurDesc); // ExtractKeywords(CurDesc); // string KeywordCodeList = Tools.GetkeywordCodes2(AdvertiseKeyword); // EntityKeywordsBOL.SaveKeywordList(item.Code, KeywordCodeList, 4); // } // catch // { // } //} //BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); //TabirDataContext dc = new TabirDataContext(); //ReqUtils Utils = new ReqUtils(); //var TabirList = dc.Tabirs; //foreach (var item in TabirList) //{ // try // { // string CurDesc = item.Meaning; // CurDesc = Utils.RemoveTags(CurDesc); // CurDesc = Tools.PersianTextCorrection(CurDesc); // ExtractKeywords(CurDesc); // string KeywordCodeList = Tools.GetkeywordCodes2(AdvertiseKeyword); // EntityKeywordsBOL.SaveKeywordList(item.Code, KeywordCodeList, 5); // } // catch // { // } //} BOLEntityKeywords EntityKeywordsBOL = new BOLEntityKeywords(); ProductsDataContext dc = new ProductsDataContext(); ReqUtils Utils = new ReqUtils(); var ProductList = dc.Products; foreach (var item in ProductList) { try { string CurDesc = item.Description; CurDesc = Utils.RemoveTags(CurDesc); CurDesc = Tools.PersianTextCorrection(CurDesc); ExtractKeywords(CurDesc); string KeywordCodeList = Tools.GetkeywordCodes2(AdvertiseKeyword); EntityKeywordsBOL.SaveKeywordList(item.Code, KeywordCodeList, 6); } catch { } } }