Ejemplo n.º 1
0
        public static void CreateBaoYangFile()
        {
            List <string>             baoyangUrlList = new List <string>();
            IEnumerable <VehicleInfo> Vehicles       = BaseDataDAL.GetVehicleInfo(true);

            if (Vehicles.Any())
            {
                WeeklySitemapJob.Logger.Info("有" + Vehicles.Count() + "个保养地址需要收录");
            }

            if (Vehicles != null && Vehicles.Any())
            {
                foreach (var vehicle in Vehicles.Where(q => q != null))
                {
                    for (int i = vehicle.StartYear; i <= vehicle.EndYear; i++)
                    {
                        string title = vehicle.Brand + vehicle.VehicleSeries + "系列" + vehicle.PaiLiang + i + "年保养";
                        baoyangUrlList.Add(string.Format("<li><a target=\"_blank\" title=\"{3}\" href=\"http://by.tuhu.cn/baoyang/{0}/pl{1}-n{2}.html\">{3}</a></li>", vehicle.VehicleID, vehicle.PaiLiang, i, title));
                    }
                }
            }
            Stream baoyangstream = GenerateStreamFromString(baoyangUrlList);

            Attachment fileattachment = new Attachment(baoyangstream, "SEOBaoYang.html");

            SendMail("SEOBaoYangHtml", ConfigurationManager.AppSettings["SEOFileJob:To"], fileattachment);
        }
Ejemplo n.º 2
0
        public static bool InsertDianPingURL(bool isFull = false)
        {
            List <string>             dianpingUrlList = new List <string>();
            IEnumerable <VehicleInfo> Vehicles        = BaseDataDAL.GetVehicleInfo(isFull);

            if (Vehicles != null && Vehicles.Any())
            {
                foreach (var vehicle in Vehicles.Where(q => q != null))
                {
                    for (int i = vehicle.StartYear; i <= vehicle.EndYear; i++)
                    {
                        dianpingUrlList.Add(string.Format("http://www.tuhu.cn/spages/Battery.aspx?pid={0}&n={1}&pl={2}", vehicle.VehicleID, i, vehicle.PaiLiang));
                    }
                }
            }
            return(InsertURLToDB(dianpingUrlList, "DianPing"));
        }
Ejemplo n.º 3
0
        public static bool InsertBaoYangURL(bool isFull = false)
        {
            List <string>             baoyangUrlList = new List <string>();
            IEnumerable <VehicleInfo> Vehicles       = BaseDataDAL.GetVehicleInfo(isFull);

            if (Vehicles != null && Vehicles.Any())
            {
                foreach (var vehicle in Vehicles.Where(q => q != null))
                {
                    for (int i = vehicle.StartYear; i <= vehicle.EndYear; i++)
                    {
                        baoyangUrlList.Add(string.Format("http://by.tuhu.cn/baoyang/{0}/pl{1}-n{2}.html", vehicle.VehicleID, vehicle.PaiLiang, i));
                    }
                }
            }
            WeeklySitemapJob.Logger.Info("有" + baoyangUrlList.Count() + "需要导入库");
            return(InsertURLToDB(baoyangUrlList, "BaoYang"));
        }