/// <summary> /// 获取出售/出租房源信息 /// </summary> /// <param name="DBName"></param> /// <param name="EmpNo"></param> /// <param name="DistrictName"></param> /// <param name="CountF"></param> /// <param name="Price"></param> /// <param name="Square"></param> /// <param name="PropertyUsage"></param> /// <param name="EstateName"></param> /// <param name="BuildNo"></param> /// <param name="RoomNo"></param> /// <param name="PanType"></param> /// <param name="Floor"></param> /// <returns></returns> public static async Task <string> GetHouseAsync(HousePara housePara, string type) { string url = ""; if (type.Equals("出售")) { url = "QuerySaleHouseSource"; } else if (type.Equals("出租")) { url = "QueryRentHouseSource"; } url = url + "?DBName=" + GlobalVariables.LoggedUser.DBName + "&EmpNo=" + GlobalVariables.LoggedUser.EmpNo + "&DistrictName=" + housePara.DistrictName + "&CountF=" + housePara.CountF + "&Price=" + housePara.Price + "&Square=" + housePara.Square + "&PropertyUsage=" + housePara.PropertyUsage + "&EstateName=" + housePara.EstateName + "&BuildNo=" + housePara.BuildNo + "&RoomNo=" + housePara.RoomNo + "&PanType=" + housePara.PanType + "&SearchContent=" + housePara.SearchContent + "&Page=" + housePara.Page + "&EmpID=" + housePara.EmpID; string content = await RestSharpHelper <string> .GetAsyncWithoutDeserialization(url); //content = GetSubString(content, "{", "}"); //HouseRD houseRD = JsonConvert.DeserializeObject<HouseRD>(content); return(content); }
public SaleHouseViewModel() { DistrictList = new[] { "全部区域", "青白江区", "郫都区", "金牛区", "成华区", "高新西区", "武侯区", "锦江区", "高新区", "天府新区", "温江区", "新都区", "青羊区", "双流区", "龙泉驿区" }; RoomStyleList = new[] { "全部房型", "1房", "2房", "3房", "4房及以上" }; SalePriceList = new[] { "全部价格", "0-30万", "30-50万", "50-100万", "100-150万", "150-200万", "200-300万", "300-500万", "500万以上" }; SquareList = new[] { "全部面积", "0-20平", "20-50平", "50-100平", "100-150平", "150-200平", "200-250平", "250-500平", "500-800平", "800平以上" }; StatusList = new[] { "全部状态", "有效", "暂缓", "无效" }; District = DistrictList[0]; RoomStyle = RoomStyleList[0]; SalePrice = SalePriceList[0]; Square = SquareList[0]; Status = StatusList[0]; HouseItemList = new ObservableCollection <HouseItemInfo>(); saleHouseItemList = new List <HouseItemInfo>(); saleHouseList = new List <HouseInfo>(); SaleHousePara = new HousePara { DistrictName = "区域", CountF = "房型", Price = "价格", Square = "面积", PropertyUsage = "用途", EstateName = "", BuildNo = "", RoomNo = "", PanType = "有效", Floor = "", MinPrice = "", MaxPrice = "", EmpID = GlobalVariables.LoggedUser.EmpID }; SortCommand = new Command <string>(async(t) => { switch (t) { //区域 case "0": { string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, DistrictList); District = result == null || result == "取消" ? District : result; } break; //房型 case "1": { string result = await Application.Current.MainPage.DisplayActionSheet("房型", "取消", null, RoomStyleList); RoomStyle = result == null || result == "取消" ? RoomStyle : result; //SaleHousePara.DistrictName = District == "全部区域" ? "区域" : District.TrimEnd('区'); //GetHouseList(); } break; //价格 case "2": { string result = await Application.Current.MainPage.DisplayActionSheet("价格", "取消", null, SalePriceList); SalePrice = result == null || result == "取消" ? SalePrice : result; //SaleHousePara.CountF = RoomStyle == "全部房型" ? "房型" : RoomStyle; //GetHouseList(); } break; //面积 case "3": { string result = await Application.Current.MainPage.DisplayActionSheet("面积", "取消", null, SquareList); Square = result == null || result == "取消" ? Square : result; //SaleHousePara.Price = SalePrice == "全部价格" ? "价格" : SalePrice; //GetHouseList(); } break; //状态 case "4": { string result = await Application.Current.MainPage.DisplayActionSheet("状态", "取消", null, StatusList); Status = result == null || result == "取消" ? Status : result; //SaleHousePara.Square = Square == "全部面积" ? "面积" : Square; //GetHouseList(); } break; default: break; } }, (t) => { return(true); }); SearchCommand = new Command(() => { GetHouseList(); }, () => { return(true); }); TappedCommand = new Command <string>((h) => { saleHouseList.ForEach((item) => { if (item.PropertyID == h) { HouseDetailPage houseDetailPage = new HouseDetailPage(item); Application.Current.MainPage.Navigation.PushAsync(houseDetailPage); } }); }, (h) => { return(true); }); RefreshCommand = new Command(() => { IsRefreshing = true; GetHouseList(); IsRefreshing = false; }, () => { return(true); }); GetHouseList(); }
public AllHouseListViewModel(string search) { SearchContent = search; SortTypeList = new[] { "出售", "出租" }; DistrictList = new[] { "全部区域", "青白江区", "郫都区", "金牛区", "成华区", "高新西区", "武侯区", "锦江区", "高新区", "天府新区", "温江区", "新都区", "青羊区", "双流区", "龙泉驿区" }; RoomStyleList = new[] { "全部房型", "1房", "2房", "3房", "4房及以上" }; SalePriceList = new[] { "全部价格", "0-30万", "30-50万", "50-100万", "100-150万", "150-200万", "200-300万", "300-500万", "500万以上" }; SquareList = new[] { "全部面积", "0-20平", "20-50平", "50-100平", "100-150平", "150-200平", "200-250平", "250-500平", "500-800平", "800平以上" }; //UsageList = new List<string> { "全部用途", "住宅", "商住", "商铺", "网店", "写字楼", "厂房", "写厂", "铺厂", "仓库", "地皮", "车位", "其他" }; //PanTypeList = new List<string> { "全部类型", "公盘", "私盘", "特盘", "封盘" }; SortType = SortTypeList[0]; District = DistrictList[0]; RoomStyle = RoomStyleList[0]; SalePrice = SalePriceList[0]; Square = SquareList[0]; HouseItemList = new ObservableCollection <HouseItemInfo>(); saleHouseItemList = new List <HouseItemInfo>(); rentHouseItemList = new List <HouseItemInfo>(); saleHouseList = new List <HouseInfo>(); rentHouseList = new List <HouseInfo>(); SaleHousePara = new HousePara { DistrictName = "区域", CountF = "房型", Price = "价格", Square = "面积", PropertyUsage = "用途", EstateName = "", BuildNo = "", RoomNo = "", PanType = "有效", Floor = "", MinPrice = "", MaxPrice = "", EmpID = "" }; SortList = new ObservableCollection <string>(); //radios = new bool[5] { false, false, false, false, false }; radios = new BitArray(5); tempRadios = new BitArray(5); SortCommand = new Command <string>((t) => { Visible = !Visible; if (!Visible) { return; } SortList.Clear(); switch (t) { //分类 case "0": { tempRadios[0] = true; radios = radios.Or(tempRadios).And(tempRadios); //先或再与,保证只有一个true tempRadios[0] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[0] = true; //SortList.Clear(); SortTypeList.ForEach(item => { SortList.Add(item); }); } break; //区域 case "1": { tempRadios[1] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[1] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[1] = true; //SortList.Clear(); DistrictList.ForEach(item => { SortList.Add(item); }); } break; //房型 case "2": { tempRadios[2] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[2] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[2] = true; //SortList.Clear(); RoomStyleList.ForEach(item => { SortList.Add(item); }); } break; //价格 case "3": { tempRadios[3] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[3] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[3] = true; //SortList.Clear(); SalePriceList.ForEach(item => { SortList.Add(item); }); } break; //面积 case "4": { tempRadios[4] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[4] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[4] = true; //SortList.Clear(); SquareList.ForEach(item => { SortList.Add(item); }); } break; default: break; } }, (t) => { return(true); }); OnSortChangedCommand = new Command <string>((t) => { int index = 0; foreach (var item in radios) { if ((bool)item) { break; } index++; } switch (index) { //分类 case 0: { SortType = t; if (SortType == "出售") { if (saleHouseItemList.Count == 0) { GetHouseList(); } else { HouseItemList.Clear(); saleHouseItemList.ForEach(item => { HouseItemList.Add(item); }); } } else if (SortType == "出租") { if (rentHouseItemList.Count == 0) { GetHouseList(); } else { HouseItemList.Clear(); rentHouseItemList.ForEach(item => { HouseItemList.Add(item); }); } } } break; //区域 case 1: { District = t; SaleHousePara.DistrictName = District == "全部区域" ? "区域" : District.TrimEnd('区'); GetHouseList(); } break; //房型 case 2: { RoomStyle = t; SaleHousePara.CountF = RoomStyle == "全部房型" ? "房型" : RoomStyle; GetHouseList(); } break; //价格 case 3: { SalePrice = t; SaleHousePara.Price = SalePrice == "全部价格" ? "价格" : SalePrice; GetHouseList(); } break; //面积 case 4: { Square = t; SaleHousePara.Square = Square == "全部面积" ? "面积" : Square; GetHouseList(); } break; default: break; } Visible = false; }, (t) => { return(true); }); /*SortCommand = new Command<string>(async (t) => * { * switch (t) * { * //分类 * case "0": * { * string result = await Application.Current.MainPage.DisplayActionSheet("分类", "取消", null, SortTypeList); * SortType = result == null || result == "取消" ? SortType: result; * * if (SortType == "出售") * { * if (saleHouseItemList.Count == 0) * { * GetHouseList(); * } * else * { * HouseItemList.Clear(); * saleHouseItemList.ForEach(item => { HouseItemList.Add(item); }); * } * } * else if (SortType == "出租") * { * if (rentHouseItemList.Count == 0) * { * GetHouseList(); * } * else * { * HouseItemList.Clear(); * rentHouseItemList.ForEach(item => { HouseItemList.Add(item); }); * } * } * } * break; * * //区域 * case "1": * { * string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, DistrictList); * District = result == null || result == "取消" ? District : result; * SaleHousePara.DistrictName = District == "全部区域" ? "区域" : District.TrimEnd('区'); * GetHouseList(); * } * break; * * //房型 * case "2": * { * string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, RoomStyleList); * RoomStyle = result == null || result == "取消" ? RoomStyle : result; * SaleHousePara.CountF = RoomStyle == "全部房型" ? "房型" : RoomStyle; * GetHouseList(); * } * break; * * //价格 * case "3": * { * string result = await Application.Current.MainPage.DisplayActionSheet("价格", "取消", null, SalePriceList); * SalePrice = result == null || result == "取消" ? SalePrice : result; * SaleHousePara.Price = SalePrice == "全部价格" ? "价格" : SalePrice; * GetHouseList(); * } * break; * * //面积 * case "4": * { * string result = await Application.Current.MainPage.DisplayActionSheet("面积", "取消", null, SquareList); * Square = result == null || result == "取消" ? Square : result; * SaleHousePara.Square = Square == "全部面积" ? "面积" : Square; * GetHouseList(); * } * break; * * default: * break; * } * }, (t) => { return true; });*/ VisibleCommand = new Command(() => { Visible = !Visible; }, () => { return(true); }); SearchCommand = new Command(() => { GetHouseList(); }, () => { return(true); }); TappedCommand = new Command <string>((h) => { if (SortType == "出售") { saleHouseList.ForEach((item) => { if (item.PropertyID == h) { HouseDetailPage houseDetailPage = new HouseDetailPage(item); Application.Current.MainPage.Navigation.PushAsync(houseDetailPage); } }); } else { rentHouseList.ForEach((item) => { if (item.PropertyID == h) { HouseDetailPage houseDetailPage = new HouseDetailPage(item); Application.Current.MainPage.Navigation.PushAsync(houseDetailPage); } }); } }, (h) => { return(true); }); GetHouseList(); }
public AllHouseListViewModel2() { PageSize = "20"; PageNum = "1"; DistrictList = new[] { "全部区域", "青白江区", "郫都区", "金牛区", "成华区", "高新西区", "武侯区", "锦江区", "高新区", "天府新区", "温江区", "新都区", "青羊区", "双流区", "龙泉驿区" }; RoomStyleList = new[] { "全部房型", "1房", "2房", "3房", "4房及以上" }; SalePriceList = new[] { "全部价格", "0-30万", "30-50万", "50-100万", "100-150万", "150-200万", "200-300万", "300-500万", "500万以上" }; SquareList = new[] { "全部面积", "0-20平", "20-50平", "50-100平", "100-150平", "150-200平", "200-250平", "250-500平", "500-800平", "800平以上" }; //UsageList = new List<string> { "全部用途", "住宅", "商住", "商铺", "网店", "写字楼", "厂房", "写厂", "铺厂", "仓库", "地皮", "车位", "其他" }; //PanTypeList = new List<string> { "全部类型", "公盘", "私盘", "特盘", "封盘" }; District = DistrictList[0]; RoomStyle = RoomStyleList[0]; SalePrice = SalePriceList[0]; Square = SquareList[0]; HouseItemList = new ObservableCollection <HouseInfo2>(); SaleHousePara = new HousePara { DistrictName = "区域", CountF = "房型", Price = "价格", Square = "面积", PropertyUsage = "用途", EstateName = "", BuildNo = "", RoomNo = "", PanType = "有效", Floor = "", MinPrice = "", MaxPrice = "", EmpID = "" }; SortCommand = new Command <string>((t) => { /* * switch (t) * { * //分类 * case "0": * { * string result = await Application.Current.MainPage.DisplayActionSheet("分类", "取消", null, SortTypeList); * SortType = result == null || result == "取消" ? SortType : result; * * if (SortType == "出售") * { * if (saleHouseItemList.Count == 0) * { * GetHouseList(); * } * else * { * HouseItemList.Clear(); * saleHouseItemList.ForEach(item => { HouseItemList.Add(item); }); * } * } * else if (SortType == "出租") * { * if (rentHouseItemList.Count == 0) * { * GetHouseList(); * } * else * { * HouseItemList.Clear(); * rentHouseItemList.ForEach(item => { HouseItemList.Add(item); }); * } * } * } * break; * * //区域 * case "1": * { * string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, DistrictList); * District = result == null || result == "取消" ? District : result; * SaleHousePara.DistrictName = District == "全部区域" ? "区域" : District.TrimEnd('区'); * GetHouseList(); * } * break; * * //房型 * case "2": * { * string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, RoomStyleList); * RoomStyle = result == null || result == "取消" ? RoomStyle : result; * SaleHousePara.CountF = RoomStyle == "全部房型" ? "房型" : RoomStyle; * GetHouseList(); * } * break; * * //价格 * case "3": * { * string result = await Application.Current.MainPage.DisplayActionSheet("价格", "取消", null, SalePriceList); * SalePrice = result == null || result == "取消" ? SalePrice : result; * SaleHousePara.Price = SalePrice == "全部价格" ? "价格" : SalePrice; * GetHouseList(); * } * break; * * //面积 * case "4": * { * string result = await Application.Current.MainPage.DisplayActionSheet("面积", "取消", null, SquareList); * Square = result == null || result == "取消" ? Square : result; * SaleHousePara.Square = Square == "全部面积" ? "面积" : Square; * GetHouseList(); * } * break; * * default: * break; * } */ }, (t) => { return(true); }); SearchCommand = new Command(() => { //GetHouseList(); }, () => { return(true); }); TappedCommand = new Command <long>((h) => { HouseInfo2 temp = new HouseInfo2(); foreach (var item in HouseItemList) { if (item.proId == h) { temp = item; } } HouseDetailPage2 houseDetailPage2 = new HouseDetailPage2(temp); Application.Current.MainPage.Navigation.PushAsync(houseDetailPage2); }, (h) => { return(true); }); LoadMoreCommand = new Command(() => { int page = int.Parse(PageNum) + 1; GetHouseList("chengdu", page.ToString(), PageSize); }, () => { return(true); }); GetHouseList("chengdu", PageNum, PageSize); }