Пример #1
0
        private async void CancelTenders2()
        {
            btnCancelTenders2.Enabled = false;
            decimal totalAmt = 0;
            var     ttIds    = new List <long>();

            for (int i = 0; i < myGridViewBinding1.View.SelectedRows.Count; ++i)
            {
                totalAmt += Convert.ToDecimal(myGridViewBinding1.GetCellValue(myGridViewBinding1.View.SelectedRows[i].Index, "amt"));
                ttIds.Add(Convert.ToInt64(myGridViewBinding1.GetCellValue(myGridViewBinding1.View.SelectedRows[i].Index, "ttId")));
            }

            if (!Commons.ShowConfirmBox(this, string.Format("撤销选中的投标,共计{0:N}元,此操作无法撤销!确认吗?", totalAmt)))
            {
                btnCancelTenders2.Enabled = true;
                return;
            }

            foreach (var ttId in ttIds)
            {
                var p = new Dictionary <string, object>();
                p["tt-id"]  = ttId;
                p["remark"] = "撤销订单";

                var r = await Projects.CreateCancelTender(p);

                if (r.IsOk)
                {
                    var d = JObject.Parse(r.AsString);
                    var c = new JsonResult(d["ttId"].ToString());
                    myGridViewBinding1.BindTo(c, Commons.BindFlag.Delete, "ttId");
                }
                else
                {
                    Commons.ShowResultErrorBox(this, r);
                }
            }

            btnCancelTenders2.Enabled = true;
        }