private void btnOk_Click(object sender, EventArgs e)
        {
            bool allSuccess = true;

            foreach (DataGridViewRow row in GridView.Rows)
            {
                DataGridViewCheckBoxCell chk = row.Cells["colCheck"] as DataGridViewCheckBoxCell;
                if ((bool)chk.EditedFormattedValue)
                {
                    decimal temp = Convert.ToDecimal(row.Cells["colAssign"].Value);
                    if (temp > 0)
                    {
                        CustomerPaymentAssign item = new CustomerPaymentAssign()
                        {
                            ID           = Guid.NewGuid(),
                            PaymentID    = CustomerPaymentID,
                            ReceivableID = (row.Tag as CustomerReceivable).ID,
                            Amount       = temp,
                        };
                        CommandResult ret = (new CustomerPaymentAssignBLL(AppSettings.Current.ConnStr)).Assign(item);
                        row.Cells["colMemo"].Value = ret.Result == ResultCode.Successful ? "成功" : "失败";
                        if (ret.Result != ResultCode.Successful)
                        {
                            allSuccess = false;
                        }
                    }
                }
                if (allSuccess)
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
        }
        private void mnu_UndoAssign_Click(object sender, EventArgs e)
        {
            List <DataGridViewRow> delRows = new List <DataGridViewRow>();

            if (ItemsGrid.SelectedRows != null && ItemsGrid.SelectedRows.Count > 0)
            {
                if (MessageBox.Show("是否要取消此核销项?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in ItemsGrid.SelectedRows)
                    {
                        CustomerPaymentAssign assign = row.Tag as CustomerPaymentAssign;
                        CommandResult         ret    = (new CustomerPaymentAssignBLL(AppSettings.Current.ConnStr)).UndoAssign(assign);
                        if (ret.Result == ResultCode.Successful)
                        {
                            delRows.Add(row);
                        }
                    }
                }
            }
            delRows.ForEach(it => ItemsGrid.Rows.Remove(it));
            UpdatingItem = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetByID((UpdatingItem as CustomerPayment).ID).QueryObject;
            OnItemUpdated(new ItemUpdatedEventArgs(UpdatingItem));
            ShowButtonState();
        }