Exemple #1
0
        private async void ClosePrj()
        {
            btnPrjClose.Enabled = false;
            var temp = await Projects.Bonus(m_pId);

            string tips = "";

            if (temp.IsOk)
            {
                var dl = JArray.Parse(temp.AsString).ToList();
                if (dl.Count > 0)
                {
                    decimal unpaidAmt = 0;
                    foreach (var d in dl)
                    {
                        unpaidAmt += d["amt"].ToDecimal() - d["paidAmt"].ToDecimal();
                    }
                    if (unpaidAmt != 0)
                    {
                        tips = string.Format("尚有 {0:N} 元未还款,", unpaidAmt);
                    }
                }
            }
            else
            {
                Commons.ShowResultErrorBox(this, temp);
                btnPrjClose.Enabled = true;
                return;
            }

            if (Commons.ShowConfirmBox(this, tips + "确定结清此企业贷吗?", "结清"))
            {
                var p = await Projects.Complete(m_pId);

                if (p.IsOk)
                {
                    UpdateTable1();
                }
                else
                {
                    Commons.ShowResultErrorBox(this, p);
                }
            }

            btnPrjClose.Enabled = true;
        }