コード例 #1
0
    public async Task <bool> PaidChargesPost(PaidChargesModel PaidModel)
    {
        var json = await PostAsyncCustom <PaidChargesModel>(UrlHelper.PaiditemCreate, PaidModel);

        if (json == "{\"success\":true}")
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #2
0
        private async void Update_Clicked(object sender, EventArgs e)
        {
            IfConnected(async() =>
            {
                PaidChargesModel paid = new PaidChargesModel();
                if (ModeOfPayment.SelectedIndex == -1)
                {
                    DisplayAlert(MessageHelper.SelectPaymentMode, "", "OK");
                }
                else
                {
                    paid.Date          = DateValue.Date.ToString("yyyy-MM-dd");
                    paid.Description   = description.Text;
                    paid.ModeOfPayment = ModeOfPayment.Items[ModeOfPayment.SelectedIndex];
                    var jsontemp       = JsonConvert.SerializeObject(Ids);
                    paid.PaidChargesId = jsontemp;

                    if (ModeOfPayment.SelectedIndex == 0)
                    {
                        paid.BankName  = BankNameValue.Text;
                        paid.Reference = ReferenceValue.Text;
                    }
                    else if (ModeOfPayment.SelectedIndex == 1)
                    {
                        paid.BankBranch   = BankBranchValue.Text;
                        paid.BankName     = BankNameValue.Text;
                        paid.ChequeNumber = chequeNoValue.Text;
                    }
                    else if (ModeOfPayment.SelectedIndex == 2)
                    {
                        paid.Reference = ReferenceValue.Text;
                    }
                    var service = DependencyService.Get <IDueService>();
                    var result  = await service.PaidChargesPost(paid);

                    if (result)
                    {
                        MessageHelper.ShowToast(ToastNotificationType.Success, "Success");
                        Navigation.PushAsync(new IHavePaid(hId));
                    }
                    else
                    {
                        MessageHelper.ShowToast(ToastNotificationType.Error, "Failure");
                    }
                }
            });
        }