Пример #1
0
        /// <summary>
        /// 获取客源列表
        /// </summary>
        /// <param name="clientPara"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static async Task <string> GetClientAsync(ClientPara clientPara, string type)
        {
            string url = (type == "Sale" ? "QuerySaleCustomerSource" : "QueryRentCustomerSource")
                         + "?DBName=" + GlobalVariables.LoggedUser.DBName + ""
                         + "&Tel=" + GlobalVariables.LoggedUser.EmpNo
                         + "&RoomStyle=" + clientPara.RoomStyle
                         + "&IsPublic=" + clientPara.IsPublic
                         + "&Floor=" + clientPara.Floor
                         + "&Square=" + clientPara.Square
                         + "&Price=" + clientPara.Price
                         + "&CusName=" + clientPara.CusName
                         + "&Phone=" + clientPara.Phone
                         + "&Contact=" + clientPara.Contact
                         + "&SearchContent=" + clientPara.SearchContent
                         + "&Page=" + clientPara.Page
                         + "&EmpID=" + clientPara.EmpID;

            string content = await RestSharpHelper <string> .GetAsyncWithoutDeserialization(url);

            return(content);
        }
Пример #2
0
        public RentClientViewModel()
        {
            FloorList     = new[] { "全部楼层", "0-10楼", "10-20楼", "20-30楼", "30楼以上" };
            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平以上" };

            Floor     = FloorList[0];
            RoomStyle = RoomStyleList[0];
            SalePrice = SalePriceList[0];
            Square    = SquareList[0];

            RentClientList = new ObservableCollection <ClientItemInfo>();

            clientPara = new ClientPara
            {
                RoomStyle     = "房型",
                IsPublic      = "类型",
                Floor         = "楼层",
                Square        = "面积",
                Price         = "价格",
                CusName       = "",
                Phone         = "",
                Contact       = "",
                SearchContent = SearchContent,
                Page          = "",
                EmpID         = ""
            };

            SortCommand = new Command <string>(async(t) =>
            {
                switch (t)
                {
                //房型
                case "0":
                    {
                        string result        = await Application.Current.MainPage.DisplayActionSheet("房型", "取消", null, RoomStyleList);
                        RoomStyle            = result == null || result == "取消" ? RoomStyle : result;
                        clientPara.RoomStyle = RoomStyle == "全部房型" ? "房型" : RoomStyle;
                        GetClientList();
                    }
                    break;

                //楼层
                case "1":
                    {
                        string result    = await Application.Current.MainPage.DisplayActionSheet("楼层", "取消", null, FloorList);
                        Floor            = result == null || result == "取消" ? Floor : result;
                        clientPara.Floor = Floor == "全部楼层" ? "楼层" : Floor;
                        GetClientList();
                    }
                    break;

                //面积
                case "2":
                    {
                        string result     = await Application.Current.MainPage.DisplayActionSheet("面积", "取消", null, SquareList);
                        Square            = result == null || result == "取消" ? Square : result;
                        clientPara.Square = Square == "全部面积" ? "面积" : Square;
                        GetClientList();
                    }
                    break;

                //价格
                case "3":
                    {
                        string result    = await Application.Current.MainPage.DisplayActionSheet("价格", "取消", null, SalePriceList);
                        SalePrice        = result == null || result == "取消" ? SalePrice : result;
                        clientPara.Price = SalePrice == "全部价格" ? "价格" : SalePrice;
                        GetClientList();
                    }
                    break;

                default:
                    GetClientList();
                    break;
                }
            }, (t) => { return(true); });

            SearchCommand = new Command(() =>
            {
                IsRefreshing = true;
                GetClientList();
                IsRefreshing = false;
            }, () => { return(true); });

            TappedCommand = new Command <string>((n) =>
            {
                foreach (var item in RentClientList)
                {
                    if (item.InquiryNo == n)
                    {
                        ClientDetailPage clientDetailPage = new ClientDetailPage(item);
                        Application.Current.MainPage.Navigation.PushAsync(clientDetailPage);
                    }
                }
            }, (n) => { return(true); });

            RefreshCommand = new Command(() =>
            {
                IsRefreshing = true;
                GetClientList();
                IsRefreshing = false;
            }, () => { return(true); });

            GetClientList();
        }