Beispiel #1
0
        public ActionResult s4()
        {
            var values     = this.RouteData.Values["values"].ToString();
            var array      = values.Split(new char[] { '/' });
            var parentCode = array[0].ToLower();
            var childCode  = array[1].ToLower();

            if (childCode == "chengren")//暂时禁用chengren
            {
                childCode = "shouji";
            }
            var region = array[2].ToLower();

            YellowPageBigType BigType;

            if (parentCode.TryParse <YellowPageBigType>(true, out BigType))//黄页
            {
                YellowPageType SmallType = (YellowPageType)Enum.Parse(typeof(YellowPageType), childCode, true);
                this.ViewData["category"] = InfoCategory.GetCategory(SmallType);
            }
            else if (parentCode == "zhaopin" ||//全职招聘
                     parentCode == "qiuzhi" ||//全职简历
                     parentCode == "zhaopinjz" ||//兼职招聘
                     parentCode == "qiuzhijz"//兼职简历
                     )
            {
                JobType jobType = (JobType)Enum.Parse(typeof(JobType), childCode, true);
                this.ViewData["category"] = InfoCategory.GetCategory(jobType);
            }
            else if (parentCode == "zhaopinhui")//招聘会
            {
            }
            else
            {
                InfoCategory parentCategory = null;
                foreach (var category in InfoCategory.Categories)
                {
                    if (category.Code != null && category.Code.ToLower() == parentCode)
                    {
                        parentCategory = category;
                        break;
                    }
                }
                var categories = parentCategory.Children;
                this.ViewData["category"] = categories.First(item => item.Code != null && item.Code.ToLower() == childCode);
            }

            //this.ViewData["p"] = parentCode + "/" + childCode + "/" + region;
            this.ViewData["Region"]     = Region.GetRegion(Convert.ToInt16(region));
            this.ViewData["ParentCode"] = parentCode;
            this.ViewData["ChildCode"]  = childCode;
            this.ViewData["Circles"]    = Circle.GetCirclesByRegion(Convert.ToInt16(region));

            var cityCode = this.RouteData.Values["city"].ToString();
            var city     = City.GetCityByCode(cityCode);

            ViewData["City"] = city;
            return(View());
        }
Beispiel #2
0
        //public override YellowPage GetEmpty()
        //{
        //    return this;
        //}

        public Dictionary <int?, int> DataRecordCount(City city, YellowPageType yellowPageType)
        {
            var       sqlQuery         = "select RegionId,COUNT(*) Total from " + TableName + " where CityId=" + city.Id + " and YellowPageType=" + Convert.ToInt32(yellowPageType) + " group by RegionId";
            DbCommand cmd              = DataAccess.db.GetSqlStringCommand(sqlQuery);
            DataTable dt               = DataAccess.db.ExecuteDataSet(cmd).Tables[0];
            Dictionary <int?, int> dic = new Dictionary <int?, int>();

            foreach (DataRow dr in dt.Rows)
            {
                int?RegionId = null;
                if (dr["RegionId"] != DBNull.Value)
                {
                    RegionId = Convert.ToInt32(dr["RegionId"]);
                }
                dic[RegionId] = Convert.ToInt32(dr["Total"]);
            }
            return(dic);
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var parentCode = filterContext.RouteData.Values["controller"].ToString().ToLower();
            var childCode  = filterContext.RouteData.Values["smallcategory"].ToString().ToLower();

            if (childCode == "chengren")//暂时禁用chengren
            {
                childCode = "shouji";
            }
            string region = null;

            if (filterContext.RouteData.Values.ContainsKey("region"))
            {
                region = filterContext.RouteData.Values["region"].ToString().ToLower();
            }

            string circle = null;

            if (filterContext.RouteData.Values.ContainsKey("circle"))
            {
                circle = filterContext.RouteData.Values["circle"].ToString().ToLower();
            }

            YellowPageBigType BigType;

            //if (Enum.TryParse<YellowPageBigType>(parentCode, true, out BigType))//黄页
            if (parentCode.TryParse <YellowPageBigType>(true, out BigType))//黄页
            {
                YellowPageType SmallType = (YellowPageType)Enum.Parse(typeof(YellowPageType), childCode, true);
                filterContext.Controller.ViewData["category"] = InfoCategory.GetCategory(SmallType);
            }
            else if (parentCode == "zhaopin" //全职招聘
                                             //|| parentCode == "jianli"//全职简历
                     || parentCode == "qiuzhi" ||//全职简历
                     parentCode == "zhaopinjz" ||//兼职招聘
                     parentCode == "qiuzhijz"//兼职简历
                     )
            {
                JobType jobType = (JobType)Enum.Parse(typeof(JobType), childCode, true);
                filterContext.Controller.ViewData["category"] = InfoCategory.GetCategory(jobType);
            }
            else if (parentCode == "zhaopinhui")//招聘会
            {
            }
            else
            {
                InfoCategory parentCategory = null;
                foreach (var category in InfoCategory.Categories)
                {
                    if (category.Code != null && category.Code.ToLower() == parentCode)
                    {
                        parentCategory = category;
                        break;
                    }
                }
                var categories = parentCategory.Children;
                filterContext.Controller.ViewData["category"] = categories.First(item => item.Code != null && item.Code.ToLower() == childCode);
            }

            if (region != null)
            {
                filterContext.Controller.ViewData["Region"] = Region.GetRegion(Convert.ToInt16(region));
            }
            else
            {
                filterContext.Controller.ViewData["Region"] = null;
            }
            filterContext.Controller.ViewData["ParentCode"] = parentCode;
            filterContext.Controller.ViewData["ChildCode"]  = childCode;
            if (circle != null)
            {
                filterContext.Controller.ViewData["Circle"] = Circle.GetCircle(Convert.ToInt16(circle));
            }
            base.OnActionExecuting(filterContext);
        }
Beispiel #4
0
 public static Dictionary <int?, int> RecordCount(City city, YellowPageType yellowPageType)
 {
     return(new YellowPage().DataRecordCount(city, yellowPageType));
 }
 public static string DisplayName(this YellowPageType SmallType)
 {
     return(InfoCategory.GetCategory(SmallType).Name);
 }