Exemple #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());
        }
 /// <summary>
 /// 添加单个实例
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public virtual bool AddEntity(TCat category)
 {
     if (category == null)
     {
         return(false);
     }
     return(AddEntityFrame(() => InfoCategory.SetValue(Entity, GetCategoryKeyValue(category), null)));
 }
Exemple #3
0
        public override void OutputInfo(string text, InfoCategory infoCategory)
        {
            if (infoCategory == InfoCategory.Title)
            {
                return;
            }

            TextBlock x = null;
            var       useSameTxtInfo = false;

            if (infoCategory == InfoCategory.FixedResponse)
            {
                if (this.txtFixedInfo == null)
                {
                    this.txtFixedInfo = new TextBlock();
                }
                else
                {
                    useSameTxtInfo = true;
                }

                x = this.txtFixedInfo;
            }
            else
            {
                var txtBlock = new TextBlock();
                x = txtBlock;
            }

            if (infoCategory == InfoCategory.SubTitle)
            {
                x.FontSize   = 18;
                x.Foreground = Aval.Media.Brushes.DarkCyan;
            }

            if (infoCategory == InfoCategory.Default)
            {
                x.FontSize   = 13;
                x.Foreground = Aval.Media.Brushes.Black;
            }

            if (infoCategory == InfoCategory.Response || infoCategory == InfoCategory.FixedResponse)
            {
                x.FontSize   = 14;
                x.Foreground = Aval.Media.Brushes.Black;
                x.FontWeight = Aval.Media.FontWeight.Bold;
            }

            x.Text = text;
            x.HorizontalAlignment = defHorizAlign;
            x.VerticalAlignment   = defVertAlign;

            if (!useSameTxtInfo)
            {
                mainPanel.Children.Add(x);
            }
        }
        /// <summary>
        /// 获取信息列表
        /// </summary>
        /// <param name="category">
        /// The category.
        /// </param>
        /// <param name="pageIndex">
        /// The page Index.
        /// </param>
        /// <param name="pageSize">
        /// The page Size.
        /// </param>
        /// <returns>
        /// </returns>
        public ActionResult List(InfoCategory category, int pageIndex, int pageSize = 20)
        {
            var pager = Info.Pages(new Pager <InfoView>()
            {
                PageIndex = pageIndex, PageSize = pageSize
            }, r => r.Category == category, r => r.Name);

            return(this.Json(pager, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        /// <summary>
        /// 获取信息名值列表
        /// </summary>
        /// <param name="category"></param>
        /// <param name="allowEmpty"></param>
        /// <returns></returns>
        public static List <string> ToSelectItems(InfoCategory category, bool allowEmpty = true)
        {
            var result = new List <string>();

            if (allowEmpty)
            {
                result.Add(string.Empty);
            }
            result.AddRange(Get(r => r.Category == category).Select(r => r.Name).OrderBy(r => r).ToList());
            return(result);
        }
        public ActionResult AddInfoCategory(InfoCategory category)
        {
            int n = db.InfoCategories.Where(u => u.InfoCategory1 == category.InfoCategory1).Count();

            if (n >= 1)
            {
                ViewBag.masg = "此类别id已经存在";
            }
            else
            {
                db.InfoCategories.Add(category);
                db.SaveChanges();
            }

            return(RedirectToAction("InfoCategorylist"));
        }
        public override void OutputInfo(string text, InfoCategory infoCategory)
        {
            switch (infoCategory)
            {
            case InfoCategory.Title:
                BreakLine();
                ForegroundColor = ConsoleColor.Cyan;
                BreakLine();
                break;

            case InfoCategory.SubTitle:
                ForegroundColor = ConsoleColor.Green;
                break;

            case InfoCategory.Default:
                ForegroundColor = ConsoleColor.Gray;
                break;
            }
            Write(text);
        }
        public ActionResult Updata(int id)
        {
            InfoCategory category = db.InfoCategories.Find(id);

            List <SelectListItem> Istate = new List <SelectListItem>();

            Istate.Add(new SelectListItem
            {
                Text = "-- 状态--", Value = "0"
            });

            Istate.Add(new SelectListItem {
                Text = "正常", Value = "1"
            });
            Istate.Add(new SelectListItem
            {
                Text  = "停用",
                Value = "0"
            });
            ViewBag.Istate = Istate;
            return(View(category));
        }
        public ActionResult Updata(InfoCategory category)
        {
            if (ModelState.IsValid)
            {
                InfoCategory categorylist = db.InfoCategories.Find(category.Id);
                categorylist.InfoName      = category.InfoName;
                categorylist.InfoCategory1 = category.InfoCategory1;

                categorylist.State = category.State;
                int n = db.SaveChanges();
                if (n > 0)
                {
                    return(RedirectToAction("InfoCategorylist"));
                }
            }


            List <SelectListItem> Istate = new List <SelectListItem>();

            Istate.Add(new SelectListItem
            {
                Text = "-- 状态--", Value = "0"
            });

            Istate.Add(new SelectListItem {
                Text = "正常", Value = "1"
            });
            Istate.Add(new SelectListItem
            {
                Text  = "停用",
                Value = "0"
            });
            ViewBag.Istate = Istate;

            return(View(category));
        }
Exemple #10
0
 public void Info(string message, InfoCategory category)
 {
 }
 public abstract void OutputInfo(string text, InfoCategory infoCategory);
Exemple #12
0
 public void Info(string message, InfoCategory category)
 {
     _logger.Info($"{category}: {message}");
 }
 public static string DisplayName(this YellowPageType SmallType)
 {
     return(InfoCategory.GetCategory(SmallType).Name);
 }
Exemple #14
0
        public ActionResult s2()
        {
            var cityCode = this.RouteData.Values["city"].ToString();
            var city     = City.GetCityByCode(cityCode);

            ViewData["City"] = city;

            var Code = this.RouteData.Values["values"].ToString().ToLower();
            YellowPageBigType BigType;

            if (Code.TryParse <YellowPageBigType>(true, out BigType))//黄页
            {
                var categories = InfoCategory.GetCategory(BigType);
                this.ViewData["categories"] = categories;
            }
            else if (Code == "zhaopin" ||//全职招聘
                     Code == "qiuzhi"//全职简历
                     )
            {
                //var jobCategories = InfoCategory.GetCategory<JobCategory>().Children as IEnumerable<JobCategory>;//.net 3.5不能这样做.
                var jobCategories = InfoCategory.GetCategory <JobCategory>().Children.Select(item => item as JobCategory);
                var categories    = jobCategories.Where(item => !item.JobType.ToString().ToLower().StartsWith("jianzhi"));
                this.ViewData["categories"] = categories;
                this.ViewData["ParentCode"] = Code;
                return(View("s2_job"));
            }
            else if (Code == "zhaopinjz" ||//兼职招聘
                     Code == "qiuzhijz"//兼职简历
                     )
            {
                //var jobCategories = InfoCategory.GetCategory<JobCategory>().Children as IEnumerable<JobCategory>;//.net 3.5不能这样做.
                var jobCategories = InfoCategory.GetCategory <JobCategory>().Children.Select(item => item as JobCategory);
                var categories    = jobCategories.Where(item => item.JobType.ToString().ToLower().StartsWith("jianzhi"));
                this.ViewData["categories"] = categories;
                if (Code == "zhaopinjz")
                {
                    this.ViewData["ParentCode"] = "zhaopin";
                }
                else
                {
                    this.ViewData["ParentCode"] = "qiuzhi";
                }
                return(View("s2_jobjz"));
            }
            else if (Code == "zhaopinhui")//招聘会
            {
            }
            else
            {
                InfoCategory parentCategory = null;
                foreach (var category in InfoCategory.Categories)
                {
                    if (category.Code != null && category.Code.ToLower() == Code)
                    {
                        parentCategory = category;
                        break;
                    }
                }
                var categories = parentCategory.Children;
                this.ViewData["categories"] = categories;
            }

            return(View());
        }
        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);
        }
Exemple #16
0
 /// <summary>
 /// 获取信息名值列表
 /// </summary>
 /// <param name="category"></param>
 /// <param name="allowEmpty"></param>
 /// <returns></returns>
 public static List<string> ToSelectItems(InfoCategory category, bool allowEmpty = true)
 {
     var result = new List<string>();
     if (allowEmpty)
     {
         result.Add(string.Empty);
     }
     result.AddRange(Get(r => r.Category == category).Select(r => r.Name).OrderBy(r => r).ToList());
     return result;
 }
Exemple #17
0
        public IAliceResponseBase ProcessRequest(SportsRequest sportsRequest)
        {
            if (sportsRequest == null)
            {
                throw new ArgumentNullException(nameof(sportsRequest));
            }

            if (sportsRequest.Request.OriginalUtterance == "ping")
            {
                return(new SportsResponse(sportsRequest, "Привет, Яндекс! У меня все в порядке :)"));
            }

            SceneType currentSceneType = SceneType.Undefined;

            if (sportsRequest.Session.New)
            {
                currentSceneType            = SceneType.Welcome;
                sportsRequest.State.Session = new SportsSessionState();
            }

            if (sportsRequest.Request.Nlu.Intents.Read != null)
            {
                InfoType infoType = InfoType.Undefined;
                if (sportsRequest.Request.Nlu.Intents.Read.Slots.InfoType != null)
                {
                    infoType = sportsRequest.Request.Nlu.Intents.Read.Slots.InfoType.Value;
                }

                InfoCategory infoCategory = InfoCategory.Undefined;
                if (sportsRequest.Request.Nlu.Intents.Read.Slots.InfoCategory != null)
                {
                    infoCategory = sportsRequest.Request.Nlu.Intents.Read.Slots.InfoCategory.Value;
                }

                if (infoType == InfoType.Comments)
                {
                    currentSceneType = SceneType.BestComments;
                }
                else if (infoType == InfoType.News)
                {
                    if (infoCategory == InfoCategory.Main)
                    {
                        currentSceneType = SceneType.MainNews;
                    }
                    else
                    {
                        currentSceneType = SceneType.LatestNews;
                    }
                }
            }
            else if (sportsRequest.Request.Nlu.Intents.IsHelp)
            {
                currentSceneType = SceneType.Help;
            }

            Scene currentScene;

            if (currentSceneType != SceneType.Undefined)
            {
                currentScene = _scenesProvider.GetScene(currentSceneType);
                return(currentScene.Reply(sportsRequest));
            }
            else
            {
                currentScene = _scenesProvider.GetScene(sportsRequest.State.Session.CurrentScene);
                if (sportsRequest.Request.Nlu.Intents.IsRepeat)
                {
                    return(currentScene.Repeat(sportsRequest));
                }
                var nextScene = currentScene.MoveToNextScene(sportsRequest);
                if (nextScene != null)
                {
                    return(nextScene.Reply(sportsRequest));
                }
            }

            var options = new JsonSerializerOptions
            {
                Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.Cyrillic),
            };
            var requestText = JsonSerializer.Serialize(sportsRequest, options);

            _fallbackLogger.LogInformation("FALLBACK. Request: {0}", requestText);
            return(currentScene.Fallback(sportsRequest));
        }