コード例 #1
0
        private void LoadPaymentTracker()
        {
            AndHUD.Shared.Show(this, "Please wait ...", -1, MaskType.Clear);

            string url   = Settings.InstanceURL;
            var    url2  = url + "/Api/GetDebtorPaymentHistory";
            var    json2 = new
            {
                Item = new
                {
                    ReferenceNumber = Settings.RefNumber
                }
            };

            try
            {
                var ObjectReturn = new DebtorInfoModel();

                string results = ConnectWebAPI.Request(url2, json2);



                if (string.IsNullOrEmpty(results))
                {
                    AndHUD.Shared.Dismiss();
                    this.RunOnUiThread(() => alert = new Alert(this, "Error", Resources.GetString(Resource.String.NoServer)));
                    this.RunOnUiThread(() => alert.Show());
                }
                else
                {
                    ObjectReturn = Newtonsoft.Json.JsonConvert.DeserializeObject <DebtorInfoModel>(results);

                    AndHUD.Shared.Dismiss();

                    this.HistoryInstalmentScheduleList = ObjectReturn.HistoryInstalmentScheduleList;
                    this.InstalmentScheduleList        = ObjectReturn.InstalmentScheduleList;
                    this.PaymentTrackerList            = this.InstalmentScheduleList;

                    paymentTrackerAdapter = new PaymentTrackerAdapter(this, this.PaymentTrackerList.ToList(), "Schedule");
                    this.paymentTrackerListView.Adapter = paymentTrackerAdapter;

                    if (this.PaymentTrackerList.Count() == 0)
                    {
                        this.paymentTrackerListView.Selector   = Resources.GetDrawable(Android.Resource.Color.Transparent);
                        this.paymentTrackerListView.Clickable  = false;
                        this.paymentTrackerListView.ChoiceMode = ChoiceMode.None;
                    }
                }
            }
            catch (Exception ee)
            {
                AndHUD.Shared.Dismiss();
            }
        }
コード例 #2
0
        private void Bt_Schedule_Click(object sender, EventArgs e)
        {
            bt_Schedule.Selected = true;
            bt_History.Selected  = false;

            this.PaymentTrackerList             = this.InstalmentScheduleList;
            paymentTrackerAdapter               = new PaymentTrackerAdapter(this, this.PaymentTrackerList.ToList(), "Schedule");
            this.paymentTrackerListView.Adapter = paymentTrackerAdapter;
            this.paymentTrackerListView.InvalidateViews();

            if (this.PaymentTrackerList.Count() == 0)
            {
                this.paymentTrackerListView.Selector   = Resources.GetDrawable(Android.Resource.Color.Transparent);
                this.paymentTrackerListView.Clickable  = false;
                this.paymentTrackerListView.ChoiceMode = ChoiceMode.None;
            }
        }
コード例 #3
0
        private void LoadPaymentTracker()
        {
            string url   = Settings.InstanceURL;
            var    url2  = url + "/Api/GetDebtorPaymentHistory";
            var    json2 = new
            {
                Item = new
                {
                    ReferenceNumber = Settings.RefNumber
                }
            };

            try
            {
                var ObjectReturn = new DebtorInfoModel();

                string results = ConnectWebAPI.Request(url2, json2);



                if (string.IsNullOrEmpty(results))
                {
                    this.RunOnUiThread(() => alert = new Alert(this, "Error", Resources.GetString(Resource.String.NoServer)));
                    this.RunOnUiThread(() => alert.Show());
                }
                else
                {
                    ObjectReturn = Newtonsoft.Json.JsonConvert.DeserializeObject <DebtorInfoModel>(results);
                    foreach (var item in ObjectReturn.HistoryInstalmentScheduleList)
                    {
                        var deferAmount = decimal.Parse(item.HistDeferredAmount);

                        var payAmount = decimal.Parse(item.HistPaymentAmount);
                        var payDate   = item.HistPaymentDate;

                        if (deferAmount > 0)
                        {
                        }
                        else if (payAmount == 0 && string.IsNullOrEmpty(payDate))
                        {
                            this.DeferList.Add(item);
                        }
                    }

                    this.totalDefer = ObjectReturn.TotalDefer;
                    this.totalUsed  = ObjectReturn.TotalUsedDefer;

                    if (this.DeferList.Count > 0)
                    {
                        this.bt_Defer.Text = "You used " + this.totalUsed + " of " + this.totalDefer + ". Continue?";
                    }
                    else
                    {
                        this.paymentTrackerListView.Selector   = Resources.GetDrawable(Android.Resource.Color.Transparent);
                        this.paymentTrackerListView.Clickable  = false;
                        this.paymentTrackerListView.ChoiceMode = ChoiceMode.None;

                        this.bt_Defer.Text = "Schedule Callback";
                    }

                    paymentTrackerAdapter = new PaymentTrackerAdapter(this, this.DeferList, "Defer");
                    this.paymentTrackerListView.Adapter = paymentTrackerAdapter;
                    this.paymentTrackerListView.InvalidateViews();
                }
            }
            catch (Exception ee)
            {
            }
        }