//
        // GET: /Fenlei/QY/

        public ActionResult Index(int Id)
        {
            var model   = new Company();
            var company = model.DataSelect(Id);

            if (company == null)
            {
                var se = Spider.GetSearchEngine(Request);
                if (se != SearchEngine.None)
                {
                    var spiderField = SeoUitls.GetSpiderField(se);
                    company = model.DataSelectAll("select top 1 * from " + model.TableName + " order by " + spiderField + "").FirstOrDefault();
                }
            }
            return(View(company));
        }
Пример #2
0
        public ActionResult showresume(int Id)
        {
            var model  = new Resume();
            var resume = model.DataSelect(Id);

            if (resume == null)
            {
                var se = Spider.GetSearchEngine(Request);
                if (se != SearchEngine.None)
                {
                    var spiderField = SeoUitls.GetSpiderField(se);
                    resume = model.DataSelectAll("select top 1 * from " + model.TableName + " order by " + spiderField + "").FirstOrDefault();
                }
            }

            return(View(resume));
        }
Пример #3
0
        public void InitDetail <TModel>()
            where TModel : InfoBase <TModel>, new()
        {
            var model = new TModel();

            var tableName = model.TableName;

            ViewTag.Interface = model;
            ViewTag.CityId    = this.CityId;

            var Id = Convert.ToInt32(this.RouteData.Values["id"]);

            var info         = model.DataSelect(Id);
            var searchEngine = Spider.GetSearchEngine(Request);

            if (info == null)//不存在该信息,可能已经被删除.
            {
                if (searchEngine != SearchEngine.None)
                {
                    var spiderField = SeoUitls.GetSpiderField(searchEngine);
                    //spiderField = "BaiduSpiderTotal";//测试
                    var smallcategory = this.RouteData.Values["smallcategory"] as string;
                    if (model is YellowPage)
                    {
                        YellowPageType ypType;

                        if (smallcategory.TryParse <YellowPageType>(true, out ypType))
                        {
                            info = model.DataSelectAll("select top 1 * from " + model.TableName + " where YellowPageType=" + (int)ypType + " order by " + spiderField + "").FirstOrDefault();
                        }
                    }
                    else if (model is Recruit || model is JobSeek)
                    {
                        JobType jobType;
                        if (smallcategory.TryParse <JobType>(true, out jobType))
                        {
                            info = model.DataSelectAll("select top 1 * from " + model.TableName + " where JobType=" + (int)jobType + " order by " + spiderField + "").FirstOrDefault();
                        }
                    }

                    if (info == null)
                    {
                        info = model.DataSelectAll("select top 1 * from " + model.TableName + " order by " + spiderField + "").FirstOrDefault();
                    }
                }
            }

            if (searchEngine != SearchEngine.None)
            {
                //ViewData["SeoInfoList"] = SeoUitls.GetInfoList<TModel>(info, searchEngine);//百度搜site:taojen.com没有记录,可能被K了,所以取消.
                SeoUitls.AddSpiderTotal <TModel>(info, searchEngine);
            }



            ViewTag.Info = info;
            if (model is ICar || model is IHouse || model is ISale)
            {
                ViewTag.RecentOthers = model.RecentOthers(10);
            }
            ViewTag.Interface.CityId   = ViewTag.CityId.Value;
            ViewTag.Interface.RegionId = ViewTag.RegionId;
            ViewTag.Interface.CircleId = ViewTag.CircleId;

            if (info.ContainsProperty("ObjectType"))
            {
                var objType = info.GetValue("ObjectType");
                if (objType != null)
                {
                    ViewTag.ObjectTypeId = Convert.ToByte(objType);
                }
            }

            //SEO数据
            ViewTag.SEO          = new SEO();
            ViewTag.SEO.Keywords = ViewTag.Info.Keywords;

            ViewData["ViewTag"] = ViewTag;
        }