protected void Page_Load(object sender, EventArgs e) { try{ BOLHardCode HardCodeBOL = new BOLHardCode(); ddlCats.DataSource = HardCodeBOL.GetList("HCResourceSitesCats"); ddlCats.DataTextField = "Name"; ddlCats.DataValueField = "Code"; ddlCats.DataBind(); ListItem li1 = new ListItem("همه گروه ها", "0"); ddlCats.Items.Insert(0, li1); BOLResourceSites ResourceSitesBOL = new BOLResourceSites(); ddlResources.DataSource = ResourceSitesBOL.GetActiveList(); ddlResources.DataTextField = "Name"; ddlResources.DataValueField = "Code"; ddlResources.DataBind(); ListItem li2 = new ListItem("همه منابع", "0"); ddlResources.Items.Insert(0, li2); } catch (Exception err) { BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs(); ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "UCNewsFeedTools::Load"); } }
protected void Page_Load(object sender, EventArgs e) { BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCContentTypes"; lblHeader.Text = HardCodeBOL.GetNameByCode(_hCContentTypeCode); BOLNews NewsBOL = new BOLNews(); int TakeCount = 4; if (_hCContentTypeCode == 5)//دیدگاه { TakeCount = 2; } if (_hCContentTypeCode == 8)//دیگر رسانه ها { TakeCount = 5; } if (_hCContentTypeCode == 3)//گزارش { TakeCount = 3; } if (_hCContentTypeCode == 2)//مصاحبه { TakeCount = 2; } rptItems.DataSource = NewsBOL.GetNewsByContentType(_hCContentTypeCode, TakeCount, 1); rptItems.DataBind(); hplMore.NavigateUrl = "~/News/?CT=" + _hCContentTypeCode; }
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"); } }
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); } } }
protected void Page_Load(object sender, EventArgs e) { BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCNewsCats"; ltrHeader.Text = HardCodeBOL.GetNameByCode(_hCNewsCatCode); hplArchive.NavigateUrl = "~/?CatCode=" + _hCNewsCatCode + "&Archive=1"; BOLNews NewsBOL = new BOLNews(); rptNews.DataSource = NewsBOL.GetLatestNewsList(_hCNewsCatCode, null, _newsCount, 1, null, "", null); rptNews.DataBind(); }
protected void DoSave(object sender, ImageClickEventArgs e) { if (!ValidateInputs()) { return; } BOLHardCode CurObj = new BOLHardCode(); CurObj.TableOrViewName = BaseID; if (!NewMode) { CurObj.Code = Convert.ToInt32(Code); } CurObj.Name = txtName.Text; CurObj.Description = txtDescription.Text; CurObj.SaveChanges(NewMode); GoToList(null, null); }
protected void Page_Load(object sender, EventArgs e) { BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCNewsTypes"; lblHeader.Text = HardCodeBOL.GetNameByCode(_HCNewsCatCode); int TakeCount = 5; if (_HCNewsCatCode == 3) { TakeCount = 4; } BOLNews NewsBOL = new BOLNews(); rptItems.DataSource = NewsBOL.GetNewsByCatCode(_HCNewsCatCode, TakeCount, 1, 7, 1); rptItems.DataBind(); hplMore.NavigateUrl = "~/News/?NT=" + _HCNewsCatCode; }
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; } } } }
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 Page_Load(object sender, EventArgs e) { string RealBaseID; BOLClass = new BOLEntityKeywords(); Label MasterPageTitle = (Label)Master.FindControl("lblTitle"); MasterPageTitle.Text = BOLClass.PageLable; if (Code == null) { if (!NewMode) { return; } } if (!Page.IsPostBack) { string InstanceName = Request["InstanceName"]; ViewState["InstanceName"] = InstanceName; // cboHCEntityTypeCode.DataSource = new BOLHardCode().GetHCDataTable("HCEntities"); RealBaseID = Request["BaseID"]; SavedBaseID = RealBaseID; if (!NewMode) { LoadData((int)Code); } else { int MasterCode = Convert.ToInt32(Request["MasterCode"]); hflEntityCode.Value = MasterCode.ToString(); RealBaseID = RealBaseID.Replace("Keywords", ""); if (!RealBaseID.EndsWith("s")) { if (RealBaseID.EndsWith("y")) { RealBaseID = RealBaseID.Substring(0, RealBaseID.Length - 1) + "ies"; } else if (RealBaseID.EndsWith("es")) { RealBaseID = RealBaseID.Substring(0, RealBaseID.Length - 2) + "es"; } else { RealBaseID = RealBaseID + "s"; } } if (RealBaseID == "Thesis") { RealBaseID = "Thesises"; } BOLHardCode HardCodeBOL = new BOLHardCode(); SearchFilterCollection sfc = new SearchFilterCollection(); sfc.Add(new SearchFilter("Name", SqlOperators.Equal, RealBaseID)); HardCodeBOL.TableOrViewName = "HCEntities"; DataTable dt = HardCodeBOL.GetDataSource(sfc, "Code", 10, 1); if (dt.Rows.Count > 0) { hflHCEntityTypeCode.Value = dt.Rows[0]["Code"].ToString(); } } } }
public int[] ShowLatestNews(int?HCNewsCatCode, int PageSize, int[] ExcludeCodeArray, int?HCContentTypeCode, int?paramPageNo, bool ShowPager, string strDate, int HCNewsTypeCode) { if (!_showHeader) { pnlHeader.Visible = false; } //if(ExcludeCodeArray.Length > 0) // ShowTime = true; _pageSize = PageSize; strPageNo = Request["PageNo"]; try { PageNo = Convert.ToInt32(strPageNo); } catch { } if (PageNo == 0) { PageNo = 1; } if (paramPageNo != null) { PageNo = (int)paramPageNo; } BOLNews NewsBOL = new BOLNews(); IQueryable <vLatestNews> ItemList = NewsBOL.GetLatestNewsList(HCNewsCatCode, ExcludeCodeArray, _pageSize, PageNo, HCContentTypeCode, strDate, HCNewsTypeCode); rptNewsList.DataSource = ItemList; rptNewsList.DataBind(); int[] NewCodeArray = new int[50]; if (ExcludeCodeArray != null) { if (ExcludeCodeArray.Length > 0) { NewCodeArray[0] = ExcludeCodeArray[0]; } } int Counter = 1; foreach (var item in ItemList) { NewCodeArray[Counter] = item.Code; Counter++; } string MainHeader = ""; if (HCNewsTypeCode != 0) { switch (HCNewsTypeCode) { case 1: ltrHeader.Text = "آخرین اخبار"; break; case 2: ltrHeader.Text = "یادداشت"; break; case 3: ltrHeader.Text = "گزارش"; break; case 4: ltrHeader.Text = "گفتگو"; break; default: break; } } if (HCNewsCatCode != null) { BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCNewsCats"; ltrHeader.Text = HardCodeBOL.GetNameByCode((int)HCNewsCatCode); switch (HCNewsCatCode) { case 0: CaptionClass = "Latest"; break; case 1: CaptionClass = "Politics"; break; case 2: CaptionClass = "Socity"; break; case 3: CaptionClass = "Sport"; break; case 4: CaptionClass = "Event"; break; case 5: CaptionClass = "Tech"; break; case 6: CaptionClass = "Culture"; break; case 7: CaptionClass = "Reading"; break; default: CaptionClass = "Latest"; break; } } if (!string.IsNullOrEmpty(strDate)) { ltrHeader.Text = "اخبار تاریخ " + Tools.ChageEnc(strDate); ConcatUrl += "&d=" + Request["d"]; } if (ShowPager) { string CatCode = Request["CatCode"]; if (!string.IsNullOrEmpty(CatCode)) { ConcatUrl += "&CatCode=" + CatCode; } int ResultCount = NewsBOL.GetLatestNewsListCount(HCNewsCatCode, ExcludeCodeArray, _pageSize, PageNo, HCContentTypeCode, strDate, HCNewsTypeCode); int PageCount = ResultCount / _pageSize; if (ResultCount % _pageSize > 0) { PageCount++; } pgrToolbar.PageNo = PageNo; pgrToolbar.PageCount = PageCount; pgrToolbar.ConcatUrl = ConcatUrl; pgrToolbar.PageBind(); } else { pgrToolbar.Visible = false; } return(NewCodeArray); }
protected void Page_Load(object sender, EventArgs e) { Security.Check(); int UserCode = Convert.ToInt32(Session["UserCode"]); if (Session["dtOrders"] == null) { Response.Redirect("~/"); return; } if (!Page.IsPostBack) { int intDeliverType = Convert.ToInt32(Session["DeliverType"]); int intAddressCode = Convert.ToInt32(Session["AddressCode"]); BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCSendTypes"; lblSendType.Text = HardCodeBOL.GetNameByCode(intDeliverType); BOLUserAddresses UserAddressesBOL = new BOLUserAddresses(UserCode); vUserAddresses CurAddress = UserAddressesBOL.GetFullDetails(intAddressCode); lblFullName.Text = CurAddress.FullName; lblAddress.Text = CurAddress.Province + " " + CurAddress.City + " " + CurAddress.Address; lblContactNumber.Text = CurAddress.CellPhone + " " + CurAddress.Tel; lblDiscount.Text = Tools.ChangeEnc("0"); string strDeliverType = "1"; if (Session["DeliverType"] != null) { strDeliverType = Session["DeliverType"].ToString(); } //if (strDeliverType == "2")//Sefareshi //{ // OtherCosts = 65000; // lblOtherCosts.Text = Tools.ChangeEnc("65000"); // lblSendCost.Text = Tools.ChangeEnc("65000"); //} //else //{ // OtherCosts = 75000; // lblOtherCosts.Text = Tools.ChangeEnc("75000"); // lblSendCost.Text = Tools.ChangeEnc("75000"); //} if (Session["dtOrders"] != null) { DataTable dt = (DataTable)Session["dtOrders"]; for (int i = 0; i < dt.Rows.Count; i++) { int ItemCount = Convert.ToInt32(dt.Rows[i]["ItemCount"]); int SendPishtazPrice = Convert.ToInt32(dt.Rows[i]["SendPishtazPrice"]); int SendSefareshiPrice = Convert.ToInt32(dt.Rows[i]["SendSefareshiPrice"]); if (strDeliverType == "1")//Sefareshi { OtherCosts += SendSefareshiPrice * ItemCount; } else { OtherCosts += SendPishtazPrice * ItemCount; } } lblOtherCosts.Text = Tools.ChangeEnc((OtherCosts / 10).ToString()); lblSendCost.Text = Tools.ChangeEnc((OtherCosts / 10).ToString()); if (dt.Rows.Count > 0) { CalcTotalAmount(dt); lblBasketHeader.Text = "سبد خرید"; rptBasket.DataSource = dt; rptBasket.DataBind(); if (Session["UserCode"] != null) { BOLUsers UsersBOL = new BOLUsers(); Users CurUser = ((IBaseBOL <Users>)UsersBOL).GetDetails(UserCode); } } else { lblBasketHeader.Text = "سبد خرید خالی است."; } } } }