Example #1
0
        /// <summary>
        /// 提交修改
        /// </summary>
        private async void ModifyHouse()
        {
            try
            {
                Para.DBName       = GlobalVariables.LoggedUser.DBName;
                Para.CityName     = Estate.CityName;
                Para.DistrictName = Estate.DistrictName;
                Para.EstateID     = Estate.EstateID;
                Para.BuildNo      = BuildNo + Unit;
                Para.PriceUnit    = Para.Trade == "出售" ? (Double.Parse(Para.Price) * 10000 / Double.Parse(Para.Square)).ToString() : (Double.Parse(Para.Price) / Double.Parse(Para.Square)).ToString();
                Para.EmpNoOrTel   = GlobalVariables.LoggedUser.EmpNo;

                Para.FlagMWWY = FlagMWWY ? "1" : "0";
                Para.FlagWDY  = FlagWDY ? "1" : "0";
                Para.FlagKDK  = FlagKDK ? "1" : "0";
                Para.FlagXSFY = FlagXSFY ? "1" : "0";

                Para.HandOverDate = ReleaseDate.Year + "-" + ReleaseDate.Month + "-" + ReleaseDate.Day;
                Para.HangDate     = EntrustDate.Year + "-" + EntrustDate.Month + "-" + EntrustDate.Day;

                string content = await RestSharpService.ModifyHouse(Para);

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("服务器错误", ToastLength.Short);
                    return;
                }

                BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(content);

                switch (baseResponse.Flag)
                {
                case "CompleteSuccess":
                {
                    CrossToastPopUp.Current.ShowToastSuccess(baseResponse.Msg, ToastLength.Short);
                    await Application.Current.MainPage.Navigation.PopAsync();
                }
                break;

                case "SQLSuccess":
                {
                    CrossToastPopUp.Current.ShowToastSuccess(baseResponse.Msg, ToastLength.Short);
                    await Application.Current.MainPage.Navigation.PopAsync();
                }
                break;

                case "SQLSuccessButUploadFailed": CrossToastPopUp.Current.ShowToastError(baseResponse.Msg, ToastLength.Short); break;

                case "SQLSuccessAndUploadSemiSuccess": CrossToastPopUp.Current.ShowToastError(baseResponse.Msg, ToastLength.Short); break;

                case "SQLExistProperty": CrossToastPopUp.Current.ShowToastWarning(baseResponse.Msg, ToastLength.Short); break;

                default: CrossToastPopUp.Current.ShowToastError(baseResponse.Msg, ToastLength.Short); break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        /// <summary>
        /// 检查该商品是否被收藏
        /// </summary>
        private async void CheckCollected()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                string content = await RestSharpService.CheckCollection(House.PropertyID);

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("查询收藏状态失败", ToastLength.Short);
                    return;
                }

                if (content.Contains("Uncollected"))
                {
                    StarSource  = "star.png";
                    IsCollected = false;
                }
                else
                {
                    StarSource  = "star_yellow.png";
                    IsCollected = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        /// <summary>
        /// 支付宝
        /// </summary>
        private void Alipay()
        {
            if (Order.orderStatus == "0")
            {
                string body = "test_body";
                foreach (var item in Order.goodsList)
                {
                    body += item.productName + "//";
                }

                //string out_trade_no = "DJ" + DateTime.Now.ToString("yyyyMMddhhmmss");
                string out_trade_no = Order.orderId.ToString();
                string product_code = "QUICK_MSECURITY_PAY";
                string subject      = "美而好家具";
                string total_amount = Order.orderTotal.ToString("0.00");

                JObject json = new JObject();
                json.Add("body", body);
                json.Add("out_trade_no", out_trade_no);
                json.Add("product_code", product_code);
                json.Add("subject", subject);
                json.Add("total_amount", total_amount);

                string  con    = RestSharpService.GetAliPaySign(json.ToString());
                JObject result = JObject.Parse(con);
                string  sign   = result["data"].ToString();

                MessagingCenter.Send(new object(), "Pay", sign);

                //CrossToastPopUp.Current.ShowToastMessage("支付成功", ToastLength.Long);
                //PayWebPage payWebPage = new PayWebPage();
                //Application.Current.MainPage.Navigation.PushAsync(payWebPage);
            }
        }
        private async void AddToCartAsync()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();

                string memberId       = GlobalVariables.LoggedUser.id.ToString();
                string productId      = Product.productId.ToString();
                string num            = ProductNum.ToString();
                string attributeValue = Product.itemAttributeValues[Index].attributeValue;

                SimpleRD simpleRD = await _restSharpService.AddToCart(memberId, productId, num, attributeValue);

                if (simpleRD.message == "success")
                {
                    CrossToastPopUp.Current.ShowToastSuccess("已添加到购物车!", ToastLength.Short);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("添加到购物车失败!", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #5
0
        /// <summary>
        /// 初始化District选择器
        /// </summary>
        private async void InitDistrictPicker()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                string content = await RestSharpService.GetDistrictList();

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("服务器错误", ToastLength.Short);
                    return;
                }

                BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(content);

                if (baseResponse.Flag == "success")
                {
                    DistrictList = JsonConvert.DeserializeObject <List <string> >(baseResponse.Result.ToString());
                }
                else
                {
                    DistrictList = new List <string>();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #6
0
        /// <summary>
        /// 响应发送验证码
        /// </summary>
        private async void SendAuthCode()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                SimpleRD simpleRD = await RestSharpService.SendAuthCode(Tel);

                if (simpleRD.code == 200)
                {
                    myTimer = new MyTimer {
                        EndDate = DateTime.Now.Add(new TimeSpan(900000000))
                    };
                    LoadAsync();
                    CrossToastPopUp.Current.ShowToastSuccess("请注意查收短信!", ToastLength.Long);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError(simpleRD.message, ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #7
0
        public async void Init()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }
                IndicatorIsRunning = true;
                ProductList.Clear();

                RestSharpService _restSharpService = new RestSharpService();
                ProductListRD    productListRD     = await _restSharpService.GetCollections();

                if (productListRD.result.total > 0)
                {
                    foreach (var item in productListRD.result.data)
                    {
                        ProductList.Add(item);
                    }
                    ProductNum = productListRD.result.total;
                    Visible    = false;
                }
                else
                {
                    Visible = true;
                }
                IndicatorIsRunning = false;
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #8
0
        private async void InitCustomerListAsync()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                //RestSharpService _restSharpService = new RestSharpService();
                CustomerListRD customerListRD = await RestSharpService.GetCustomers(GlobalVariables.LoggedUser.phone.ToString());

                if (customerListRD.result.Count > 0)
                {
                    List <UserInfo> temp = new List <UserInfo>();
                    foreach (var item in customerListRD.result)
                    {
                        temp.Add(item);
                    }
                    CustomerList = temp;

                    Visible = false;
                }
                else
                {
                    Visible = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #9
0
        /// <summary>
        /// 获取商品详细信息,初始化页面
        /// </summary>
        /// <param name="productId"></param>
        private async void InitProductDetailPageAsync(string productId)
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                ProductDetailRD productDetailRD = await RestSharpService.GetProductDetail(productId);

                if (GlobalVariables.IsLogged)
                {
                    string judgeRD = await RestSharpService.JudgeCollection(productId);

                    var json = JObject.Parse(judgeRD);
                    isCollected = (bool)json["success"];
                }
                else
                {
                    isCollected = false;
                }

                if (productDetailRD.result != null)
                {
                    Product    = productDetailRD.result;
                    StarSource = isCollected ? "star_yellow.png" : "star_gray.png";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #10
0
        /// <summary>
        /// 初始化看跟进页面
        /// </summary>
        private async void InitSeeFollowPage(string id, bool isProperty)
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                InquiryFollowRD inquiryFollowRD = new InquiryFollowRD();
                string          content         = isProperty ? await RestSharpService.GetHouseFollowInfo(id) : await RestSharpService.GetInquiryFollowInfo(id);

                if (!string.IsNullOrWhiteSpace(content))
                {
                    BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(content);

                    if (baseResponse.Flag == "success")
                    {
                        List <InquiryFollowItemInfo> list = JsonConvert.DeserializeObject <List <InquiryFollowItemInfo> >(baseResponse.Result.ToString());

                        FollowInfoList = new ObservableCollection <InquiryFollowItemInfo>(list);
                    }
                    else
                    {
                        FollowInfoList = new ObservableCollection <InquiryFollowItemInfo>();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// 取消订单
        /// </summary>
        private async void CancelOrder()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                SimpleRD simpleRD = await RestSharpService.CancelOrder(Order);

                if (simpleRD.success)
                {
                    CrossToastPopUp.Current.ShowToastSuccess("该订单已关闭!", ToastLength.Long);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("该订单取消失败!请联系客服人员!", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #12
0
        /// <summary>
        ///重置密码
        /// </summary>
        private async void ResetPassword()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                string content = await RestSharpService.ResetPassword(TelOrEmpNo, Password);

                if (!string.IsNullOrWhiteSpace(content))
                {
                    BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(content);
                    if (baseResponse.Flag == "success")
                    {
                        CrossToastPopUp.Current.ShowToastSuccess("密码重置成功", ToastLength.Long);
                    }
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("密码重置失败,请稍后重试", ToastLength.Short);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #13
0
        /// <summary>
        /// 业务办理
        /// </summary>
        private async void ToBusiness()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                string content = await RestSharpService.GetBusinessHand();

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("服务器出错", ToastLength.Short);
                    return;
                }
                else
                {
                    JObject jObject = JObject.Parse(content);
                    WebPage webPage = new WebPage(jObject["ShareUrl"].ToString(), "业务办理");
                    await Application.Current.MainPage.Navigation.PushAsync(webPage);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #14
0
        /// <summary>
        /// 初始化
        /// </summary>
        private async void InitCategories()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                //RestSharpService _restSharpService = new RestSharpService();
                CategoryRD categoryRD = await RestSharpService.GetCategories();

                List <Category> categoryList = categoryRD.result;

                foreach (var item in categoryList)
                {
                    if (!item.isParent)
                    {
                        SubCategoryList.Add(item);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #15
0
        /// <summary>
        /// 初始化
        /// </summary>
        private async void InitCategories()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();
                CategoryRD       categoryRD        = await _restSharpService.GetCategories();

                categoryViewModel.categoryList = categoryRD.result;

                foreach (var item in categoryViewModel.categoryList)
                {
                    if (item.isParent)
                    {
                        categoryViewModel.ParentCategoryList.Add(item);
                    }
                }

                ParentStack.Children[0].Behaviors[0].SetValue(RadioBehavior.IsCheckedProperty, true);
                categoryViewModel.GetSubCategories(categoryViewModel.ParentCategoryList[0].id);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #16
0
        /// <summary>
        /// 获取地址列表
        /// </summary>
        public async void InitAddressList()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();

                string memberId = GlobalVariables.LoggedUser.id.ToString();

                AddressRD addressRD = await _restSharpService.GetAddressListById(memberId);

                if (addressRD.result.Count != 0)
                {
                    AddressList = new ObservableCollection <AddressInfo>(addressRD.result);
                    Visible     = false;
                }
                else
                {
                    Visible = true;
                    CrossToastPopUp.Current.ShowToastError("无收货地址列表,请添加。", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #17
0
        /// <summary>
        /// 收藏
        /// </summary>
        private async void Collect()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                //List<Page> pageList = Application.Current.MainPage.Navigation.NavigationStack.ToList<Page>();

                if (!GlobalVariables.IsLogged)
                {
                    LoginPage loginPage = new LoginPage();
                    await Application.Current.MainPage.Navigation.PushAsync(loginPage);

                    return;
                }

                if (IsCollected)
                {
                    //取消收藏
                    StupidRD stupidRD = await RestSharpService.DeleteCollection(Product.productId.ToString());

                    if (stupidRD.success)
                    {
                        CrossToastPopUp.Current.ShowToastSuccess("取消收藏成功", ToastLength.Short);
                        StarSource  = "star_gray.png";
                        IsCollected = false;
                    }
                    else
                    {
                        CrossToastPopUp.Current.ShowToastWarning("取消收藏失败", ToastLength.Short);
                    }
                }
                else
                {
                    //收藏
                    StupidRD stupidRD = await RestSharpService.AddToCollection(Product.productId.ToString());

                    if (stupidRD.success)
                    {
                        CrossToastPopUp.Current.ShowToastSuccess("收藏成功", ToastLength.Short);
                        StarSource  = "star_yellow.png";
                        IsCollected = true;
                    }
                    else
                    {
                        CrossToastPopUp.Current.ShowToastWarning("收藏失败", ToastLength.Short);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #18
0
        /// <summary>
        /// 获取栋座
        /// </summary>
        public async void GetBuildings()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                string content = await RestSharpService.GetDongzuoByEstateID(Estate.EstateID);

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("服务器错误", ToastLength.Short);
                    return;
                }

                BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(content);

                if (baseResponse.Flag == "success")
                {
                    List <BuildingInfo> list = JsonConvert.DeserializeObject <List <BuildingInfo> >(baseResponse.Result.ToString());

                    BuildingList = new ObservableCollection <string>();
                    foreach (var item in list)
                    {
                        BuildingList.Add(item.BuildingName);
                    }
                    RawBuildingList = list;
                }
                else
                {
                    BuildingList = new ObservableCollection <string>();
                }

                /*
                 * if (buildingRD.Msg == "EmptyList")
                 * {
                 *  CrossToastPopUp.Current.ShowToastError("该小区下没有栋座信息,拒绝新增,请在电脑端完善后再进行录入。", ToastLength.Short);
                 *  return;
                 * }
                 * else
                 * {
                 *  BuildingList = new ObservableCollection<string>();
                 *  foreach (var item in buildingRD.Dongzuo)
                 *  {
                 *      BuildingList.Add(item.BuildingName);
                 *  }
                 *  RawBuildingList = buildingRD.Dongzuo;
                 * }*/
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #19
0
        private async void InitHomePage()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();
                HomeContentRD    homeContentRD     = await _restSharpService.GetHomeContent();

                CategoryRD categoryRD = await _restSharpService.GetCategories();

                //CarouselList = homeContentRD.result[0].panelContents.ToList<HomePanelContent>();
                HotProductList = homeContentRD.result[1].panelContents.ToList <HomePanelContent>();
                //OfficialChoiceList = homeContentRD.result[2].panelContents.ToList<HomePanelContent>();
                //GoodBrandList = homeContentRD.result[3].panelContents.ToList<HomePanelContent>();
                //BrandChoiceList = homeContentRD.result[4].panelContents.ToList<HomePanelContent>();

                CarouselList = new List <HomePanelContent>
                {
                    new HomePanelContent
                    {
                        picUrl  = "sanye.png",
                        fullUrl = "http://www.sanecn.com/"
                    },
                    new HomePanelContent
                    {
                        picUrl  = "bianselong.jpg",
                        fullUrl = "http://www.cdbsljs.com/"
                    },
                    new HomePanelContent
                    {
                        picUrl  = "jiabei.jpg",
                        fullUrl = "http://www.cdbsljs.com/"
                    }
                };

                List <Category> temp = new List <Category>();
                foreach (var item in categoryRD.result)
                {
                    if (!item.isParent)
                    {
                        temp.Add(item);
                    }
                }
                CatList = temp.GetRange(0, 10);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #20
0
        /// <summary>
        /// openid注册
        /// </summary>
        private async void OnRegister(RegisterByOpenIdPara registerByOpenIdPara)
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                registerByOpenIdPara.authCode    = AuthCode;
                registerByOpenIdPara.tel         = Tel;
                registerByOpenIdPara.userPwd     = Pwd;
                registerByOpenIdPara.invitePhone = InvitePhone;
                registerByOpenIdPara.userType    = SelectedIdentityIndex.ToString();

                SimpleRD simpleRD = await RestSharpService.RegisterByOpenId(registerByOpenIdPara);

                if (simpleRD.code == 200)
                {
                    LoginRD loginRD = await RestSharpService.LoginByOpenId(registerByOpenIdPara.openId);

                    if (loginRD.result.message == null)
                    {
                        CrossToastPopUp.Current.ShowToastSuccess("欢迎您登录美而好家具!", ToastLength.Long);

                        GlobalVariables.LoggedUser = loginRD.result;   //将登录用户的信息保存成全局静态变量
                        GlobalVariables.IsLogged   = true;

                        JObject log = new JObject();
                        log.Add("LoginTime", DateTime.UtcNow);
                        log.Add("UserInfo", JsonConvert.SerializeObject(loginRD.result));
                        string fileName = Path.Combine(FileSystem.CacheDirectory, "log.dat");
                        File.WriteAllText(fileName, log.ToString());

                        Application.Current.MainPage.Navigation.RemovePage(Application.Current.MainPage.Navigation.NavigationStack[0]);
                        MainPage mainPage = new MainPage();
                        await Application.Current.MainPage.Navigation.PushAsync(mainPage);
                    }
                    else
                    {
                        CrossToastPopUp.Current.ShowToastError(loginRD.result.message, ToastLength.Long);
                    }
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("注册失败!请联系管理员!", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #21
0
        private void SearchWord(string searchWord)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(searchWord))
                {
                    return;
                }

                searchWord = searchWord.TrimStart().TrimEnd().ToLower();

                if (temp == searchWord)
                {
                    return;
                }

                _Word = temp = searchWord;
                WordList?.Clear();

                if (!Regex.IsMatch(searchWord, @"[a-z]+[\-\']?[a-z]*"))
                {
                    WordList?.Add(new Word()
                    {
                        word = searchWord, translation = "无释义"
                    });
                    return;
                }

                string result = RestSharpService.Search(searchWord);
                Console.WriteLine(result);

                if (result == "[]")
                {
                    WordList?.Add(new Word()
                    {
                        word = searchWord, translation = "无释义"
                    });
                }
                else
                {
                    List <Word> list = JsonConvert.DeserializeObject <List <Word> >(result);

                    if (list?.Count > 0)
                    {
                        list.ForEach(item => WordList.Add(item));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #22
0
        /// <summary>
        /// 收藏或取消收藏
        /// </summary>
        private async void CollectOrCancel()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                string content = await RestSharpService.CollectOrCancel(House.PropertyID);

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("未知错误,操作未成功", ToastLength.Short);
                    return;
                }

                if (content.Contains("CollectSuccess"))
                {
                    CrossToastPopUp.Current.ShowToastSuccess("收藏成功", ToastLength.Short);
                    StarSource  = "star_yellow.png";
                    IsCollected = true;
                    return;
                }
                else if (content.Contains("CollectFail"))
                {
                    CrossToastPopUp.Current.ShowToastError("收藏失败,请稍后再试", ToastLength.Short);
                    return;
                }
                else if (content.Contains("CancelSuccess"))
                {
                    CrossToastPopUp.Current.ShowToastSuccess("取消收藏成功", ToastLength.Short);
                    StarSource  = "star.png";
                    IsCollected = false;
                    return;
                }
                else if (content.Contains("CancelFail"))
                {
                    CrossToastPopUp.Current.ShowToastError("取消收藏失败,请稍后再试", ToastLength.Short);
                    return;
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("未知错误,操作未成功", ToastLength.Short);
                    return;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #23
0
        // 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法
        public void OnResp(BaseResp resp)
        {
            const int RETURN_MSG_TYPE_LOGIN = 1;
            const int RETURN_MSG_TYPE_SHARE = 2;

            CrossToastPopUp.Current.ShowToastSuccess("微信回调成功2", Plugin.Toast.Abstractions.ToastLength.Short);

            switch (resp.MyErrCode)
            {
            case BaseResp.ErrCode.ErrAuthDenied:
                CrossToastPopUp.Current.ShowToastError("用户拒绝授权", Plugin.Toast.Abstractions.ToastLength.Short);
                Finish();
                break;

            case BaseResp.ErrCode.ErrUserCancel:
                if (RETURN_MSG_TYPE_SHARE == resp.Type)
                {
                    CrossToastPopUp.Current.ShowToastError("分享失败", Plugin.Toast.Abstractions.ToastLength.Short);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("用户取消", Plugin.Toast.Abstractions.ToastLength.Short);
                }
                Finish();
                break;

            case BaseResp.ErrCode.ErrOk:
                switch (resp.Type)
                {
                case RETURN_MSG_TYPE_LOGIN:
                    //拿到了微信返回的code,立马再去请求access_token
                    string code = ((SendAuth.Resp)resp).Code;

                    //就在这个地方,用网络库什么的或者自己封的网络api,发请求去咯,注意是get请求
                    string result = RestSharpService.GetWechatUserInfo(appID, appSecret, code);
                    RunOnUiThread(() => { MessagingCenter.Send(new object(), "LoginSuccess", result); });

                    break;

                case RETURN_MSG_TYPE_SHARE:
                    CrossToastPopUp.Current.ShowToastSuccess("分享", Plugin.Toast.Abstractions.ToastLength.Short);
                    Finish();
                    break;
                }
                Finish();
                break;

            default:
                Finish();
                break;
            }
        }
Example #24
0
        /// <summary>
        /// 提交订单
        /// </summary>
        private async void OrderAsync()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                //RestSharpService _restSharpService = new RestSharpService();
                OrderPara orderPara = new OrderPara
                {
                    addressId   = AddressId,
                    goodsList   = ProductList,
                    orderTotal  = TotalSelectedPrice,
                    paymentType = SelectedTypeIndex + 1,
                    streetName  = StreetName,
                    tel         = Tel,
                    userId      = GlobalVariables.LoggedUser.id.ToString(),
                    userName    = UserName
                };
                foreach (var item in orderPara.goodsList)
                {
                    item.salePrice = item.memberPrice;
                }

                StupidRD stupidRD = RestSharpService.Order(orderPara);

                if (stupidRD.result != 0)
                {
                    CrossToastPopUp.Current.ShowToastSuccess("提交订单成功!请及时支付!", ToastLength.Long);

                    //var stack1 = Application.Current.MainPage.Navigation.NavigationStack;
                    //var stack2 = Application.Current.MainPage.Navigation.ModalStack;
                    //Application.Current.MainPage.Navigation.RemovePage(stack2[stack2.Count - 1]);
                    await Application.Current.MainPage.Navigation.PopAsync();

                    OrderDetailPage orderDetailPage = new OrderDetailPage(stupidRD.result);
                    await Application.Current.MainPage.Navigation.PushAsync(orderDetailPage);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("提交订单失败!有问题请联系客服人员。", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// 上传新头像
        /// </summary>
        private async void UploadAvatar()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                if (string.IsNullOrWhiteSpace(base64))
                {
                    CrossToastPopUp.Current.ShowToastWarning("请选择新头像", ToastLength.Long);
                    return;
                }

                //RestSharpService _restSharpService = new RestSharpService();
                SimpleRD uploadImageRD = await RestSharpService.UploadImage(base64);

                if (uploadImageRD.success)
                {
                    LoginRD loginRD = await RestSharpService.GetUserInfo();

                    if (loginRD.result.message == null)
                    {
                        GlobalVariables.LoggedUser = loginRD.result;   //将登录用户的信息保存成全局静态变量
                        GlobalVariables.IsLogged   = true;

                        string  fileName = Path.Combine(FileSystem.CacheDirectory, "log.dat");
                        JObject log      = new JObject();
                        log.Add("LoginTime", DateTime.UtcNow);
                        log.Add("UserInfo", JsonConvert.SerializeObject(loginRD.result));
                        //string text = "State:Checked\n" + "Account:" + Tel + "\nPassword:"******"\nLoginTime:" + DateTime.UtcNow;
                        File.WriteAllText(fileName, log.ToString());
                    }

                    CrossToastPopUp.Current.ShowToastSuccess("修改成功!", ToastLength.Short);
                    await Application.Current.MainPage.Navigation.PopAsync();
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("修改失败,请稍后再试。", ToastLength.Short);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #26
0
        /// <summary>
        /// 登录
        /// </summary>
        private async void OnLogin()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                LoginPara loginPara = new LoginPara
                {
                    userPwd  = Pwd,
                    authCode = "",
                    tel      = Tel
                };

                //RestSharpService _restSharpService = new RestSharpService();
                LoginRD loginRD = await RestSharpService.Login(loginPara);

                if (loginRD.result.message == null)
                {
                    CrossToastPopUp.Current.ShowToastSuccess("欢迎您登录美而好家具!", ToastLength.Long);

                    GlobalVariables.LoggedUser = loginRD.result;   //将登录用户的信息保存成全局静态变量
                    GlobalVariables.IsLogged   = true;

                    JObject log = new JObject();
                    log.Add("LoginTime", DateTime.UtcNow);
                    log.Add("UserInfo", JsonConvert.SerializeObject(loginRD.result));
                    string fileName = Path.Combine(FileSystem.CacheDirectory, "log.dat");
                    File.WriteAllText(fileName, log.ToString());

                    Application.Current.MainPage.Navigation.RemovePage(Application.Current.MainPage.Navigation.NavigationStack[0]);
                    MainPage mainPage = new MainPage();
                    await Application.Current.MainPage.Navigation.PushAsync(mainPage);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError(loginRD.result.message, ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #27
0
        /// <summary>
        ///
        /// </summary>
        private async void InitAddress()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                //RestSharpService _restSharpService = new RestSharpService();

                string memberId = GlobalVariables.LoggedUser.id.ToString();

                AddressRD addressRD = await RestSharpService.GetAddressListById(memberId);

                if (addressRD.result.Count != 0)
                {
                    foreach (var item in addressRD.result)
                    {
                        if (item.isDefault)
                        {
                            AddressId  = item.addressId;
                            UserName   = item.userName;
                            Tel        = item.tel;
                            IsDefault  = item.isDefault;
                            StreetName = item.streetName;
                            break;
                        }
                    }

                    if (AddressId == 0)
                    {
                        UserName = "******";
                    }
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("无收货地址列表,请添加。", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #28
0
        /// <summary>
        ///
        /// </summary>
        private async void GetHouseList(string cityPinYin, string pageNum, string pageSize)
        {
            try
            {
                IsLoading = true;
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                //SaleHousePara.SearchContent = SearchContent;
                //HouseRD houseRD = await RestSharpService.GetHouseAsync(SaleHousePara, SortType);
                string content = await RestSharpService.GetHouseAsync(cityPinYin, pageNum, pageSize);

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("服务器错误", ToastLength.Short);
                    return;
                }

                JObject jObject = JObject.Parse(content);

                if (jObject["code"].ToString() == "200")
                {
                    PageNum   = jObject["data"]["pageNum"].ToString();
                    PageSize  = jObject["data"]["pageSize"].ToString();
                    TotalPage = jObject["data"]["totalPage"].ToString();
                    Total     = jObject["data"]["total"].ToString();

                    IsEnable = !(PageNum == TotalPage);

                    List <HouseInfo2> houseInfoList = JsonConvert.DeserializeObject <List <HouseInfo2> >(jObject["data"]["list"].ToString());

                    foreach (var h in houseInfoList)
                    {
                        HouseItemList.Add(h);
                    }
                }
                IsLoading = false;
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #29
0
        private async void TwoTapped_TappedAsync(long id)
        {
            try
            {
                string action = await Application.Current.MainPage.DisplayActionSheet("选择操作", "取消", null, "删除", "修改");

                if (action == "删除")
                {
                    if (!Tools.IsNetConnective())
                    {
                        CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                        return;
                    }

                    CartItemInfo temp = new CartItemInfo();
                    foreach (var item in ItemList)
                    {
                        if (item.productId == id)
                        {
                            temp = item;
                            //ItemList.Remove(item);
                        }
                    }

                    //Frame frame = sender as Frame;
                    //int index = ItemStack.Children.IndexOf(frame);

                    StupidRD stupidRD = await RestSharpService.DeleteItemInCart(temp);

                    if (stupidRD.success)
                    {
                        CrossToastPopUp.Current.ShowToastSuccess("删除成功!", ToastLength.Short);
                        InitCart();
                    }
                    else
                    {
                        CrossToastPopUp.Current.ShowToastError("删除失败!", ToastLength.Short);
                    }
                }
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Example #30
0
        /// <summary>
        /// 获取客源
        /// </summary>
        private async void GetClientList()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Short);
                    return;
                }

                clientPara.SearchContent = SearchContent;
                string content = await RestSharpService.GetClientAsync(clientPara, "Rent");

                if (string.IsNullOrWhiteSpace(content))
                {
                    CrossToastPopUp.Current.ShowToastError("服务器错误", ToastLength.Short);
                    return;
                }

                BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(content);

                if (baseResponse.Flag == "success")
                {
                    if (int.Parse(baseResponse.Msg) > 0)
                    {
                        List <ClientItemInfo> list = JsonConvert.DeserializeObject <List <ClientItemInfo> >(baseResponse.Result.ToString());

                        RentClientList.Clear();
                        foreach (var item in list)
                        {
                            item.FirstChar = item.CustName.Substring(0, 1);
                            RentClientList.Add(item);
                        }
                    }
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError(baseResponse.Msg, ToastLength.Short);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }