public ActionResult ReverURL(int id) { var bolService = new BOLService.BOLService(); bolService.ReverURL(id); return(Json(true, JsonRequestBehavior.AllowGet)); }
public ActionResult NiceURL(int id) { var bolService = new BOLService.BOLService(); bolService.UpdateNiceURL(id); return(RedirectToAction("Index", "Home")); }
public ActionResult Detail(int id) { var bolService = new BOLService.BOLService(); var obj = new ImageDisplay(); obj.ListImg.Add(bolService.GetImgLinkById(id)); return(View(obj)); }
// // GET: /Lasted/ public ActionResult Index() { var bolService = new BOLService.BOLService(); var obj = new ImageDisplay(); obj.PageIndex = 0; obj.PageSize = 1000; obj.ListImg = bolService.GetImgLinks(obj.PageIndex, obj.PageSize); return(View(obj)); }
public ActionResult FireFoxExtension() { var amount = 50; var bolService = new BOLService.BOLService(); var obj = new ImageDisplay(); obj.PageIndex = new Random().Next(0, 5); obj.PageSize = amount; obj.ListImg = bolService.GetCoolRandomImgLinks(amount); return(View(obj)); }
// // GET: /Clip/ public ActionResult Index() { var bolService = new BOLService.BOLService(); var vImg = bolService.GetRandomImage(1); string str = vImg.First().linkimg; int index = str.LastIndexOf('.'); string strExtension = str.Substring(index + 1); var webClient = new WebClient(); webClient.DownloadFile(str, "D:\\Public\\Project_Tools_\\DemoDepVDWeb\\Demo1\\Download_\\" + vImg.First().ID + "." + strExtension); return(View()); }
public ActionResult GenerateRandomImage(int?id) { var v = id.HasValue ? id.Value : 15; var bolService = new BOLService.BOLService(); var result = bolService.GetRandomImage(v); var data = result.Select(o => new ListItem() { Id = o.ID, Name = o.linkimg }); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult RandomLinkImage(int?id) { var vAmountRows = id.HasValue ? id.Value : 15; var bolService = new BOLService.BOLService(); var result = bolService.GetRandomImage(vAmountRows, 1, 0, string.Empty); var data = result.Select(o => new ListItem() { Id = o.ID, Name = o.linkimg }); return(Json(data, JsonRequestBehavior.AllowGet)); }
//private static readonly ILog log = LogManager.GetLogger(typeof (Program)) ; public ActionResult Index() { var bolService = new BOLService.BOLService(); var obj = new ImageDisplay(); obj.PageIndex = new Random().Next(0, 5); obj.PageSize = 500; obj.ListImg = bolService.GetImgLinks(obj.PageIndex, obj.PageSize); if (obj.ListImg.Count == 0) { obj.ListImg = bolService.GetImgLinks(0, obj.PageSize); } return(View(obj)); }
public ActionResult Index([FromUri] int?amount) { if (amount.HasValue == false || amount.Value <= 0) { amount = 50; } var bolService = new BOLService.BOLService(); var obj = new ImageDisplay(); obj.PageIndex = new Random().Next(0, 5); obj.PageSize = amount.Value; obj.ListImg = bolService.GetCoolRandomImgLinks(amount.Value); return(View(obj)); }
public ActionResult GetNewImages(int iPageIndex, int iPageSize) { var bolService = new BOLService.BOLService(); if (iPageIndex < 0) { iPageIndex = bolService.TotalImages() / iPageIndex; } var data = bolService.GetImgLinks(iPageIndex, iPageSize).Select(o => new ListItem() { Id = o.ID, Name = o.linkimg }); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetNewImages(int iPageIndex, int iPageSize) { var bolService = new BOLService.BOLService(); var v = bolService.GetCoolRandomImgLinks(iPageSize); v.Shuffle(); var data = v.Select(o => new ListItem() { Id = o.ID, Name = o.linkimg }); var jsonResult = Json(data, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); //return Json(data, JsonRequestBehavior.AllowGet); }
public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "depvd.com")) { Console.WriteLine("Exist ^_^: " + strPage); return; } var lst = new List <BOLService.ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@id = 'vd-view-carousel']"); if (divContainer == null) { return; } foreach (HtmlNode childNode in divContainer.ChildNodes) { if (childNode.Name.Equals("div") && childNode.Attributes["class"] != null && childNode.Attributes["class"].Value.Equals("carousel-inner")) { foreach (var node in childNode.ChildNodes) { if (node.Name.Equals("div") && node.Attributes["class"] != null && node.Attributes["class"].Value.Contains("item")) { try { string strLink = node.FirstChild.Attributes["src"].Value; if (string.IsNullOrEmpty(strLink)) { strLink = node.FirstChild.Attributes["data-original"].Value; } var item = new BOLService.ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "depvd.com", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } } if (lst.Count > 0) { bolService.SaveImgDepVD(lst); Console.WriteLine(strPage); } break; } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void NewSexyGirl() { try { var bolService = new BOLService.BOLService(); List <ImgLink> lst = new List <ImgLink>(); var web = new HtmlWeb(); int start = 1; int end = 20;// 5; //TODO: current max value 24 for (int i = start; i < end; i++) { string strURL = "http://www.depvd.com/new/p" + i; var doc = web.Load(strURL); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@id = 'vd-topics']"); if (divContainer == null) { return; } foreach (HtmlNode childNode in divContainer.ChildNodes) { if (childNode.Name.Equals("div") && childNode.Attributes["class"] != null && childNode.Attributes["class"].Value.Equals("vd-topic vd-xitin")) { //TODO: have 4 column HtmlNodeCollection nodeImagesCollection = divContainer.SelectNodes("//div[@class = 'vd-topic-title']"); foreach (var node in nodeImagesCollection) { try { foreach (HtmlNode nodeLink in node.ChildNodes) { if (nodeLink.Name.Equals("a")) { string strTitle = nodeLink.InnerText; string strPage = nodeLink.Attributes["href"].Value; string strCategory = "Sexy-Girl"; string strCounter = BuildCounter(strPage); TestImageOnePage(strPage, strCounter, strCategory, strTitle); break; } } } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } } } Console.WriteLine("Finish page ^_^: " + strURL); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }