/// <summary>
        /// 根据name获取信息
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public ResultInfo.Info GetInfoByName(string name)
        {
            info.ResultType = ResultInfo.BaseResultType.Error;
            var data = db.EnterpriseInfo.AsQueryable().Where(p => p.Title == name).Select(p => new { p.Id, p.Title, p.Content, p.Admin, p.AddDate, p.HtmlRegion, p.HtmlRegion.HtmlPage });

            if (data != null)
            {
                var list = data.ToList();
                LimitPropsContractResolver limitProps = null;
                if (list.Count() > 0)
                {
                    limitProps = new LimitPropsContractResolver();
                    limitProps.Add <EnterpriseInfo>(p => new { p.Id, p.Title, p.Content, p.Admin, p.AddDate, p.HtmlRegion });
                    limitProps.Add <Admin>(p => new { p.Id, p.Name });
                    limitProps.Add <HtmlRegion>(p => new { p.Id, p.RegionName, p.HtmlPage });
                    limitProps.Add <HtmlPage>(p => new { p.Id, p.PageName });
                }
                info.DataObj    = list.ToJson(limitProps);
                info.ResultType = ResultInfo.BaseResultType.Success;
                info.Msg        = "获取成功!";
            }
            else
            {
                info.Msg = "获取失败!或许已经删除";
            }
            return(info);
        }
        /// <summary>
        /// 查询企业信息
        /// </summary>
        /// <returns></returns>
        public ResultInfo.Info QueryInfo(string startDate, string endDate, string title)
        {
            var data = db.EnterpriseInfo.AsQueryable().Select(p => new { p.Id, p.Title, p.Admin, p.AddDate, p.HtmlRegion, p.HtmlRegion.HtmlPage });

            if (!string.IsNullOrEmpty(startDate))
            {
                var time = Convert.ToDateTime(startDate);
                data = data.Where(p => Convert.ToDateTime(p.AddDate) > time);
            }
            if (!string.IsNullOrEmpty(endDate))
            {
                var time = Convert.ToDateTime(endDate);
                data = data.Where(p => Convert.ToDateTime(p.AddDate) < time);
            }
            if (!string.IsNullOrEmpty(title))
            {
                data = data.Where(p => p.Title.Contains(title));
            }
            var list = data.OrderByDescending(p => p.AddDate).ToList();
            LimitPropsContractResolver limitProps = null;

            if (list.Count() > 0)
            {
                limitProps = new LimitPropsContractResolver();
                limitProps.Add <EnterpriseInfo>(p => new { p.Id, p.Title, p.Admin, p.AddDate, p.HtmlRegion });
                limitProps.Add <Admin>(p => new { p.Id, p.Name });
                limitProps.Add <HtmlRegion>(p => new { p.Id, p.RegionName, p.HtmlPage });
                limitProps.Add <HtmlPage>(p => new { p.Id, p.PageName });
            }
            info.DataObj    = list.ToJson(limitProps);
            info.ResultType = ResultInfo.BaseResultType.Success;
            return(info);
        }
        /// <summary>
        /// 获取该图片组的信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ResultInfo.Info GetImageList(string tile)
        {
            var data = db.HtmlElement.Where(p => p.Title == tile).Select(p => new { p.Id, p.Title, p.Admin, p.AddDate, p.HtmlRegion, p.HtmlRegion.HtmlPage, p.Image, p.Width, p.Height, p.Remark });
            var list = data.ToList();
            LimitPropsContractResolver limitProps = null;

            if (list.Count() > 0)
            {
                limitProps = new LimitPropsContractResolver();
                limitProps.Add <HtmlElement>(p => new { p.Id, p.Title, p.Admin, p.AddDate, p.HtmlRegion, p.Image });
                limitProps.Add <Admin>(p => new { p.Id, p.Name });
                limitProps.Add <HtmlRegion>(p => new { p.Id, p.RegionName, p.HtmlPage });
                limitProps.Add <HtmlPage>(p => new { p.Id, p.PageName });
                limitProps.Add <Image>(p => new { p.Id, p.Name, p.Sort, p.Url, p.Alt });
                info.DataObj    = list.ToJson(limitProps);
                info.ResultType = ResultInfo.BaseResultType.Success;
            }
            else
            {
                info.ResultType = ResultInfo.BaseResultType.Error;
                info.Msg        = "未查询到该图片组!";
            }

            return(info);
        }
        /// <summary>
        /// 查询留言
        /// </summary>
        /// <returns></returns>
        public ResultInfo.Info QueryMessage(string startDate, string endDate, string keyWord, string htmlPageId, bool?isAdmin)
        {
            var data = db.Message.AsQueryable();

            if (!string.IsNullOrEmpty(startDate))
            {
                var time = Convert.ToDateTime(startDate);
                data = data.Where(p => Convert.ToDateTime(p.AddDate) > time);
            }
            if (!string.IsNullOrEmpty(endDate))
            {
                var time = Convert.ToDateTime(endDate);
                data = data.Where(p => Convert.ToDateTime(p.AddDate) < time);
            }
            if (!string.IsNullOrEmpty(keyWord))
            {
                data = data.Where(p => p.Mobile.Contains(keyWord) || p.MessageContent.Contains(keyWord) || p.Nick.Contains(keyWord));
            }
            if (!string.IsNullOrEmpty(htmlPageId))
            {
                data = data.Where(p => p.HtmlPage.Id == Convert.ToInt32(htmlPageId));
            }
            if (isAdmin != null)
            {
                data = data.Where(p => p.IsAdmin == isAdmin);
            }
            var list = data.OrderByDescending(p => p.Id).ToList();
            LimitPropsContractResolver limitProps = null;

            if (list.Count() > 0)
            {
                limitProps = new LimitPropsContractResolver();
                limitProps.Add <Message>(p => new { p.Id, p.MessageContent, p.Admin, p.AddDate, p.HtmlPage, p.Mobile, p.Nick, p.UpperLeve });
                limitProps.Add <Admin>(p => new { p.Id, p.Name });
                limitProps.Add <HtmlPage>(p => new { p.Id, p.PageName });
            }
            info.DataObj    = list.ToJson(limitProps);
            info.ResultType = ResultInfo.BaseResultType.Success;
            return(info);
        }
        /// <summary>
        /// 获取指定id的留言
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResultInfo.Info GetMessageById(int id)
        {
            var data = db.Message.Where(p => p.Id == id).Select(p => new { p.Id, p.MessageContent, p.Admin, p.AddDate, p.HtmlPage, p.Mobile, p.Nick, p.UpperLeve }).ToList();

            if (data != null)
            {
                LimitPropsContractResolver limitProps = null;
                if (data.Count() > 0)
                {
                    limitProps = new LimitPropsContractResolver();
                    limitProps.Add <Message>(p => new { p.Id, p.MessageContent, p.Admin, p.AddDate, p.HtmlPage, p.Mobile, p.Nick, p.UpperLeve });
                    limitProps.Add <Admin>(p => new { p.Id, p.Name });
                    limitProps.Add <HtmlPage>(p => new { p.Id, p.PageName });
                }
                info.DataObj    = data.ToJson(limitProps);
                info.ResultType = ResultInfo.BaseResultType.Success;
            }
            else
            {
                info.Msg        = "该留言不存在,或已被删除!";
                info.ResultType = ResultInfo.BaseResultType.Error;
            }
            return(info);
        }