示例#1
0
        public void CreateHouse()
        {
            //System.Data.Entity.Database.SetInitializer(new FxHouseInitializer());
            FxHouseContext context = new FxHouseContext();
            var            entity  = new Fx.Entity.FxHouse.HouseBuyInfo()
            {
                Action           = "Action",
                AreaId           = 1,
                Bill             = false,
                CatagroyId       = 1,
                CityId           = 1,
                Controller       = "Controller",
                HasFurniture     = false,
                Mark             = "Mark",
                Price            = 1000,
                PublishTitle     = "Title",
                PublishUserEmail = "PublishUserEmail",
                RoomNumber       = 6,
                UserAccount      = "UserAccount"
            };

            context.HouseBuyInfos.Add(entity);
            context.SaveChanges();
            context.HouseBuyInfos.Remove(entity);
            context.SaveChanges();
        }
 /// <summary>
 ///  根据用户获取所有的房屋求购信息
 /// </summary>
 /// <param name="email">用户帐号</param>
 /// <returns>房屋转让信息列表</returns>
 public List<HouseBuyInfo> GetBuys(string email)
 {
     using (var content = new FxHouseContext())
     {
         return content.HouseBuyInfos
             .Where(r => r.IsDelete == false && r.UserAccount == email)
             .ToList();
     }
 }
示例#3
0
 /// <summary>
 ///  根据用户获取所有的房屋求购信息
 /// </summary>
 /// <param name="email">用户帐号</param>
 /// <returns>房屋转让信息列表</returns>
 public List <HouseBuyInfo> GetBuys(string email)
 {
     using (var content = new FxHouseContext())
     {
         return(content.HouseBuyInfos
                .Where(r => r.IsDelete == false && r.UserAccount == email)
                .ToList());
     }
 }
示例#4
0
 /// <summary>
 /// 获取首页最新房屋信息
 /// </summary>
 /// <param name="count">获取数量</param>
 /// <returns>房屋转让信息列表</returns>
 public List <HouseTransferInfo> SearchLatestForHome(int count)
 {
     using (var content = new FxHouseContext())
     {
         return(content.HouseTransferInfos
                .Include(r => r.Pictures)
                .Where(r => r.IsPublish == true)
                .OrderByDescending(r => r.CreatedTime)
                .Take(count).ToList());
     }
 }
 /// <summary>
 /// 管理员获取所有的房屋求购信息
 /// </summary>
 /// <param name="page">页码</param>
 /// <returns>房屋转让信息列表</returns>
 public List<HouseBuyInfo> GetAdminBuys(int page = 0)
 {
     using (var content = new FxHouseContext())
     {
         return content.HouseBuyInfos
             .OrderByDescending(r => r.HouseBuyInfoId)
             .Where(r => r.IsDelete == false && r.IsPublish == true)
              .Skip(page * 100).Take(100)
             .ToList();
     }
 }
 /// <summary>
 /// 仅仅根据三级类别查询,用于大频道和后续仅仅点击页码的查询
 /// </summary>
 /// <param name="catagroy">三级分类目录列表id</param>
 /// <param name="page">页码</param>
 /// <param name="take">每页获取多少数据</param>
 /// <returns>房屋查询的结果集合</returns>
 public List <HouseBuyInfo> SearchByCatagroy(Entity.Catagroy.ChannelListDetailCatagroy catagroy, int page, int take)
 {
     using (var content = new FxHouseContext())
     {
         return(content.HouseBuyInfos
                .Where(r => r.IsPublish == true && r.CatagroyId == (int)catagroy)
                .OrderByDescending(r => r.CreatedTime)
                .Skip(page * take)
                .Take(take).ToList());
     }
 }
示例#7
0
 /// <summary>
 /// 管理员获取所有的房屋求购信息
 /// </summary>
 /// <param name="page">页码</param>
 /// <returns>房屋转让信息列表</returns>
 public List <HouseBuyInfo> GetAdminBuys(int page = 0)
 {
     using (var content = new FxHouseContext())
     {
         return(content.HouseBuyInfos
                .OrderByDescending(r => r.HouseBuyInfoId)
                .Where(r => r.IsDelete == false && r.IsPublish == true)
                .Skip(page * 100).Take(100)
                .ToList());
     }
 }
 public List<HouseTransferInfo> GetAdminTransfers(int page = 0)
 {
     using (var content = new FxHouseContext())
     {
         return content.HouseTransferInfos
             .OrderByDescending(r => r.HouseTransferInfoId)
             //.Include(r => r.UserAccount)
             .Where(r => r.IsDelete == false && r.IsPublish == true)
             .Skip(page * 100).Take(100)
             .ToList();
     }
 }
示例#9
0
        /// <summary>
        /// 按关键字查询 (标题) 缓存会
        /// </summary>
        /// <param name="key">关键字</param>
        /// <param name="page">页码</param>
        /// <param name="take">获取数据的数量</param>
        /// <param name="area">地区</param>
        /// <param name="city">城市</param>
        /// <param name="clc">帖子对应的二级或者三级频道Id</param>
        /// <returns>房屋转让信息列表</returns>
        public List <HouseTransferInfo> SearchByKey(string key, int area = 0,
                                                    int city             = 0, int page = 0,
                                                    int take             = 10, int clc = 0)
        {
            int start = 1 + page * 10;
            int end   = page * 10 + take;

            var where = CreateWhereExpress(key, area, city, clc);
            string sql = " SELECT [HouseTransferInfoId] FROM " +
                         "  ( SELECT ROW_NUMBER() OVER ( ORDER BY [HouseTransferInfoId] ) " +
                         "    AS RowNumber,[HouseTransferInfoId],CreatedTime " +
                         "      FROM [FxHouse].[House].[HouseTransferInfo] " + where.ToString() + " ) " +
                         "  AS A1 WHERE RowNumber BETWEEN " + start + " AND " + end;

            var dt  = GetDataTable(sql, key);
            var ids = new List <int>();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ids.Add(Convert.ToInt32(dt.Rows[i][0]));
                }
            }
            if (ids.Count > 0)
            {
                using (var context = new FxHouseContext())
                {
                    return(context.HouseTransferInfos
                           .Include(r => r.Pictures)
                           .Where(r => ids.Contains(r.HouseTransferInfoId)).ToList());
                }
            }
            else
            {
                return(new List <HouseTransferInfo>());
            }
        }