private void btnNullify_Click(object sender, EventArgs e)
        {
            List <CustomerPaymentAssign> assigns = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetAssigns((UpdatingItem as ExpenditureRecord).ID).QueryObjects;

            if (assigns != null && assigns.Count > 0)
            {
                string msg = "\"作废\"的操作会删除相关的应收核销项,是否继续?";
                if (MessageBox.Show(msg, "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                {
                    return;
                }
            }
            if (assigns != null && assigns.Count > 0)
            {
                bool allSuccess = true;
                foreach (CustomerPaymentAssign assign in assigns)
                {
                    CommandResult ret = (new CustomerPaymentAssignBLL(AppSettings.Current.ConnStr)).UndoAssign(assign);
                    if (ret.Result != ResultCode.Successful)
                    {
                        allSuccess = false;
                    }
                }
                if (!allSuccess)
                {
                    MessageBox.Show("某些应收核销项删除失败,请手动删除这些应收核销项后再继续\"作废\"的操作", "消息");
                    UpdatingItem = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetByID((UpdatingItem as CustomerPayment).ID).QueryObject;
                    OnItemUpdated(new ItemUpdatedEventArgs(UpdatingItem));
                    return;
                }
            }
            ExpenditureRecordBLL processor = new ExpenditureRecordBLL(AppSettings.Current.ConnStr);

            PerformOperation <ExpenditureRecord>(processor, SheetOperation.Nullify);
            UpdatingItem = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetByID((UpdatingItem as CustomerPayment).ID).QueryObject;
            OnItemUpdated(new ItemUpdatedEventArgs(UpdatingItem));
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            ExpenditureRecordBLL processor = new ExpenditureRecordBLL(AppSettings.Current.ConnStr);

            PerformOperation <ExpenditureRecord>(processor, IsAdding ? SheetOperation.Create : SheetOperation.Modify);
        }
        private void btnApprove_Click(object sender, EventArgs e)
        {
            ExpenditureRecordBLL processor = new ExpenditureRecordBLL(AppSettings.Current.ConnStr);

            PerformOperation <ExpenditureRecord>(processor, SheetOperation.Approve);
        }
        protected override CommandResult UpdateItem(object item)
        {
            ExpenditureRecordBLL bll = new ExpenditureRecordBLL(AppSettings.Current.ConnStr);

            return(bll.ProcessSheet(item as ExpenditureRecord, SheetOperation.Modify, Operator.Current.Name, Operator.Current.ID));
        }