public static async Task <RebateRD> GetAllRebate(string designerId) { try { string url = "/member/getAllRebate?designerId=" + designerId; RebateRD rebateRD = await RestSharpHelper <RebateRD> .GetAsync(url); return(rebateRD); } catch (ApplicationException ex) { throw ex; } }
private async System.Threading.Tasks.Task InitAsync() { try { if (!Tools.IsNetConnective()) { CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long); return; } double total = 0; string result = await RestSharpHelper <string> .GetAsyncWithoutDeserialization("/member/getAllRebate?designerId=" + GlobalVariables.LoggedUser.id); if (!string.IsNullOrWhiteSpace(result)) { RebateRD rebateRD = JsonConvert.DeserializeObject <RebateRD>(result); if (rebateRD.result == null || rebateRD.result.Count == 0) { TodayRebate = "0"; } else { foreach (var item in rebateRD.result) { DateTime dateTime = DateTime.Parse(item.createDate); if (dateTime.Subtract(DateTime.Now).Days == 0) { total += item.rebate; RebateList.Add(item); } } TodayRebate = total.ToString(); } } else { TodayRebate = "0"; CrossToastPopUp.Current.ShowToastError("Error", ToastLength.Long); } } catch (Exception ex) { CrossToastPopUp.Current.ShowToastError(ex.Message, ToastLength.Long); } }