示例#1
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            LinkInfo link = new LinkInfo();

            link.ID        = RequestHelper.GetQueryString <int>("ID");
            link.LinkClass = Convert.ToInt32(this.LinkClass.Text);
            if (link.LinkClass == 1)
            {
                link.Display = this.TextDisplay.Text;
            }
            else
            {
                link.Display = this.PictureDisplay.Text;
            }
            link.URL    = this.URL.Text;
            link.Remark = this.Remark.Text;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (link.ID == -2147483648)
            {
                base.CheckAdminPower("AddLink", PowerCheckType.Single);
                int id = LinkBLL.AddLink(link);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Link"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateLink", PowerCheckType.Single);
                LinkBLL.UpdateLink(link);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Link"), link.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl);
        }
示例#2
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            LinkInfo link = new LinkInfo();

            link.ID        = RequestHelper.GetQueryString <int>("ID");
            link.LinkClass = 1;

            link.Display = TextDisplay.Text;

            link.URL    = URL.Text;
            link.Remark = Remark.Text;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (link.ID == int.MinValue)
            {
                CheckAdminPower("AddLink", PowerCheckType.Single);
                int id = LinkBLL.AddLink(link);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Link"), id);
            }
            else
            {
                CheckAdminPower("UpdateLink", PowerCheckType.Single);
                LinkBLL.UpdateLink(link);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Link"), link.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadLink", PowerCheckType.Single);
         string queryString = RequestHelper.GetQueryString <string>("Action");
         int    id          = RequestHelper.GetQueryString <int>("ID");
         if ((queryString != string.Empty) && (id != -2147483648))
         {
             base.CheckAdminPower("UpdateLink", PowerCheckType.Single);
             string str2 = queryString;
             if (str2 != null)
             {
                 if (!(str2 == "Up"))
                 {
                     if (str2 == "Down")
                     {
                         LinkBLL.ChangeLinkOrder(ChangeAction.Down, id);
                     }
                 }
                 else
                 {
                     LinkBLL.ChangeLinkOrder(ChangeAction.Up, id);
                 }
             }
             AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Link"), id);
         }
         this.classID = RequestHelper.GetQueryString <int>("ClassID");
         if (this.classID == -2147483648)
         {
             this.classID = 1;
         }
         base.BindControl(LinkBLL.ReadLinkCacheListByClass(this.classID), this.RecordList);
     }
 }
示例#4
0
        /// <summary>
        /// 添加链接
        /// </summary>
        /// <param name="urls"></param>
        /// <param name="depth"></param>
        /// <param name="baseUrl"></param>
        /// <param name="unload"></param>
        /// <param name="loaded"></param>
        private static void AddUrls(string[] urls, int depth, string baseUrl)
        {
            if (depth >= 10)
            {
                return;
            }
            LinkBLL bllLink = new LinkBLL();

            bllLink.AddUrls(urls, depth, baseUrl);
        }
示例#5
0
        public ActionResult UpdateLinks(int id)
        {
            link link = LinkBLL.UpdateLinks(id);

            ViewBag.lid = link.id;
            ViewBag.tit = link.title;
            ViewBag.url = link.url;
            ViewBag.des = link.desc;
            return(View());
        }
示例#6
0
        public void ManyDelete(string idStr)
        {
            string str = idStr.Substring(0, idStr.LastIndexOf(','));

            string[] idTemp = str.Split(',');
            foreach (var item in idTemp)
            {
                int daa = int.Parse(item);
                LinkBLL.ManyDelete(daa);
            }
        }
示例#7
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            base.CheckAdminPower("DeleteLink", PowerCheckType.Single);
            string intsForm = RequestHelper.GetIntsForm("SelectID");

            if (intsForm != string.Empty)
            {
                LinkBLL.DeleteLink(intsForm);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Link"), intsForm);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
示例#8
0
        // GET: Link
        public ActionResult Index(int page = 1)
        {
            int pagesize = 5;

            if (Session["username"] == null)
            {
                Response.Redirect("/Admin/Login");
            }
            var result = LinkBLL.Index();

            return(View(result.ToPagedList <link>(page, pagesize)));
        }
示例#9
0
        public JsonResult IsCheckUpdateLinks(int linkId, string title, string url, string desc)
        {
            var result = LinkBLL.IsCheckUpdateLinks(linkId, title, url, desc);

            if (result == 0)
            {
                return(Json(new { status = 0, data = "该友情链接已存在,请重新输入!" }));
            }
            else
            {
                return(Json(new { status = 1, data = "修改成功!" }));
            }
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            CheckAdminPower("ReadLink", PowerCheckType.Single);
            string action = RequestHelper.GetQueryString <string>("Action");

            if (action == "Delete")
            {
                CheckAdminPower("DeleteLink", PowerCheckType.Single);
                string deleteID = RequestHelper.GetQueryString <string>("ID");
                if (deleteID != string.Empty)
                {
                    LinkBLL.DeleteLink(deleteID);
                    AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Link"), deleteID);
                    ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), "Link.aspx");
                }
            }
            int linkID = RequestHelper.GetQueryString <int>("ID");

            if (action != string.Empty && linkID != int.MinValue)
            {
                CheckAdminPower("UpdateLink", PowerCheckType.Single);
                switch (action)
                {
                case "Up":
                    LinkBLL.ChangeLinkOrder(ChangeAction.Up, linkID);
                    break;

                case "Down":
                    LinkBLL.ChangeLinkOrder(ChangeAction.Down, linkID);
                    break;

                default:
                    break;
                }
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Link"), linkID);
            }
            classID = RequestHelper.GetQueryString <int>("ClassID");
            if (classID == int.MinValue)
            {
                classID = 1;
            }
            BindControl(LinkBLL.ReadLinkCacheListByClass(classID), RecordList);
        }
示例#11
0
        public JsonResult IsCheckLinkAdd(string title, string url, string desc)
        {
            link link = new link();

            link.title = title;
            link.url   = url;
            link.desc  = desc;
            var result = LinkBLL.IsCheckLinkAdd(link);

            if (result == 0)
            {
                return(Json(new { status = 0, data = "链接已存在,请重新添加!" }));
            }
            else
            {
                return(Json(new { status = 1, data = "添加成功!" }));
            }
        }
示例#12
0
        protected override void PageLoad()
        {
            ProductClassList = ProductClassBLL.ReadList();
            TopBanner        = AdImageBLL.ReadList((int)AdImageType.TopBanner).FirstOrDefault() ?? new AdImageInfo();

            hotKeyword       = ShopConfig.ReadConfigInfo().HotKeyword;
            productClassList = ProductClassBLL.ReadRootList();
            helpClassList    = ArticleClassBLL.ReadChilds(ArticleClass.Help);
            bottomList       = ArticleBLL.ReadBottomList();

            strHistorySearch = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistorySearch"));

            textLinkList = LinkBLL.ReadLinkCacheListByClass((int)LinkType.Text);

            topNavMenuList = NavMenuBLL.ReadList(true);

            ReadCart();
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                classID = RequestHelper.GetQueryString <int>("ClassID");

                int linkID = RequestHelper.GetQueryString <int>("ID");
                if (linkID != int.MinValue)
                {
                    CheckAdminPower("ReadLink", PowerCheckType.Single);
                    LinkInfo link = LinkBLL.ReadLinkCache(linkID);

                    TextDisplay.Text = link.Display;

                    URL.Text    = link.URL;
                    Remark.Text = link.Remark;
                }
            }
        }
示例#14
0
        protected override void PageLoad()
        {
            base.PageLoad();

            topNav = 1;

            imageList = AdImageBLL.ReadList();



            int count = 0;

            likeProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo {
                ProductOrderType = "LikeNum", IsSale = (int)BoolType.True
            }, ref count);

            newsList = ArticleBLL.SearchList(1, 7, new ArticleSearchInfo {
                ClassId = "|1|", IsTop = (int)BoolType.True
            }, ref count);

            newProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo {
                IsNew = (int)BoolType.True, IsTop = (int)BoolType.True, IsSale = (int)BoolType.True
            }, ref count);

            hotProductList = ProductBLL.SearchList(1, 10, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsTop = (int)BoolType.True, IsSale = (int)BoolType.True
            }, ref count);

            specialProductList = ProductBLL.SearchList(1, 10, new ProductSearchInfo {
                IsSpecial = (int)BoolType.True, IsTop = (int)BoolType.True, IsSale = (int)BoolType.True
            }, ref count);

            textLinkList = LinkBLL.ReadLinkCacheListByClass((int)LinkType.Text);

            pictureLinkList = LinkBLL.ReadLinkCacheListByClass((int)LinkType.Picture);
        }
示例#15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         this.classID        = RequestHelper.GetQueryString <int>("ClassID");
         this.LinkClass.Text = this.classID.ToString();
         int queryString = RequestHelper.GetQueryString <int>("ID");
         if (queryString != -2147483648)
         {
             base.CheckAdminPower("ReadLink", PowerCheckType.Single);
             LinkInfo info = LinkBLL.ReadLinkCache(queryString);
             if (info.LinkClass == 1)
             {
                 this.TextDisplay.Text = info.Display;
             }
             else
             {
                 this.PictureDisplay.Text = info.Display;
             }
             this.URL.Text    = info.URL;
             this.Remark.Text = info.Remark;
         }
     }
 }
示例#16
0
        static void Main(string[] args)
        {
            ConsoleInitial();
            LinkBLL    bllLink    = new LinkBLL();
            ArticleBLL bllArticle = new ArticleBLL();

            linkList = bllLink.SelectByStatus(100, Link.StatusAttribute.IsUse);

            if (linkList.Count <= 0)
            {
                Link link = new Link();
                link.Url   = BaseUrl;
                link.Depth = 0;
                bllLink.AddUrl(BaseUrl, 0);
                linkList.Add(link);
            }
            int isUseLinkIndex = linkList.Count - 1;

            while (linkList.Count > 0)
            {
                Link link = linkList[isUseLinkIndex];

                //添加加载记录,修改成不能用(下次不查询)
                //Loaded.Add(url, depth);
                bllLink.UpdateStatusByNotUse(link.Url);
                HttpHelper.HttpItem httpItem = new HttpHelper.HttpItem();
                httpItem.URL      = link.Url;
                httpItem.Method   = "GET";
                httpItem.Encoding = Encoding.UTF8;
                string html = HttpHelper.GetHtml(httpItem);

                CrawlerHelper crawlerHelper = new CrawlerHelper(html);
                string[]      links         = crawlerHelper.GetLinks;

                AddUrls(links, link.Depth + 1, BaseUrl);

                Console.WriteLine(string.Format("需加载{0},已加载{1}", bllLink.SelectCountByStatusIsUse(), bllLink.SelectCountByStatusNotUse()));
                //删除 当前需要加载的
                //Unload.Remove(url);
                isUseLinkIndex--;
                if (isUseLinkIndex <= -1)
                {
                    linkList       = bllLink.SelectByStatus(100, Link.StatusAttribute.IsUse);
                    isUseLinkIndex = linkList.Count - 1;
                }
            }


            //加载需要下载的链接
            linkList = bllLink.SelectByIsUseDownload(100, ArticleSuffix);
            int isDownloadIndex = linkList.Count - 1;

            while (linkList.Count > 0)
            {
                Link link = linkList[isDownloadIndex];
                Console.WriteLine("----{0}=={1}-----", isDownloadIndex, link.Id);

                HttpHelper.HttpItem httpItem = new HttpHelper.HttpItem();
                httpItem.URL      = link.Url;
                httpItem.Method   = "GET";
                httpItem.Encoding = Encoding.UTF8;
                string html = HttpHelper.GetHtml(httpItem);

                CrawlerHelper crawlerHelper = new CrawlerHelper(html);
                Article       article       = crawlerHelper.GetArticle;
                if (article.Title != string.Empty && article.Content != string.Empty)
                {
                    article.ArticleUrl = link.Url;
                    int artInsertId = bllArticle.InsertByLinkId(article, link.Id);
                    if (artInsertId > 0)
                    {
                        Console.WriteLine("添加成功-----{0}", article.Title);
                    }
                }
                else
                {
                    bllLink.UpdateIsDownloadById(link.Id);
                }
                isDownloadIndex--;
                if (isDownloadIndex <= -1)
                {
                    linkList        = bllLink.SelectByIsUseDownload(100, ArticleSuffix);
                    isDownloadIndex = linkList.Count - 1;
                }
            }
            Console.ReadKey();


            Console.WriteLine("按任意键退出...");
            Console.ReadKey();
        }
示例#17
0
 public void DeleteLink(int id)
 {
     LinkBLL.DeleteLink(id);
 }